Update SQL query implementation based on thrift protocol.