You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Prafulla T (JIRA)" <ji...@apache.org> on 2014/12/21 02:24:13 UTC

[jira] [Commented] (HIVE-6992) Implement PreparedStatement.getMetaData(), getParmeterMetaData()

    [ https://issues.apache.org/jira/browse/HIVE-6992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14254997#comment-14254997 ] 

Prafulla T commented on HIVE-6992:
----------------------------------

I have some thoughts about how PraparedStatement.getMetadata can be implemented. 
Let me know your comments and I can go ahead and implement this functionality.

h4. Here is my proposal.
h5. On server-side:
Add couple of parameters TExecuteStatementReq  thrift  
* A bool variable prepareOnly indicate this is “prepare only” request. 
* An operation handle to indicate existing operation on server    .

Add couple of parameters to HiveSession.executeStatement and executeStatementAsy - operationHandle and prepareOnly.

In HiveSessionImpl.executeStatementInternal method, 
f prepareOnly flag is set and Create operation and invoke “prepare” method instead of run.
If ExecuteStatementReq has valid operationHandle ( non-null ), then use that operation instead of creating new operation.
If prepareOnly flag is not set, Invoke run method on corresponding Operation.
Return error if Operation(if given) is not in valid state. 

h5. On Client side:
In PreparedStatement.getMetadata, Check if cached schema is available, if yes return that.
Otherwise, send ExecuteStatementReq with prepareOnly flag and read schema using getSchema method.
When this returns, Save operationHandle locally and use it for sending when user actually invokes PrepareMethod.execute* methods.







> Implement PreparedStatement.getMetaData(), getParmeterMetaData()
> ----------------------------------------------------------------
>
>                 Key: HIVE-6992
>                 URL: https://issues.apache.org/jira/browse/HIVE-6992
>             Project: Hive
>          Issue Type: Bug
>          Components: JDBC
>            Reporter: Bill Oliver
>
> It would be very helpful to have methods PreparedStatement.getMetaData() and also PreparedStatement.getParameterMetaData() implemented.
> I especially would like PreparedStatmeent.getMetaData() implemented, as I could prepare a SQL statement, and then get information about the result set, as well as information that the query is valid.
> I am pretty sure this information is available in some form. When you do an "EXPLAIN query", the explain operation shows information about the result set including the column name/aliases and the column types.
> thanks you
> -bill



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)