You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by surendra lilhore <su...@huawei.com> on 2014/04/02 15:42:59 UTC

HiveServer2 : Can we perform parallel operation one same statement object in JDBC connection ?

Hi all,

                I am deleting all table using this code in HiveServer2,
but after deleting all the table hive sever is throwing "Invalid OperationHandle" exception.

                ResultSet resultSet = stmt.executeQuery("show tables");
       while (resultSet.next()) {
              stmt.execute("drop table " + resultSet.getString(1));
       }

                Same code is working with HiveServer.

                In checked code.

       HiveServer2 will create new operation handler for "show tables"  query,
      If I execute "drop table" on same statement object then HiveStatement.execute() will close old operation handler and then it will get new handler,
but HiveQueryResultSet will contain old handler only, again when resultSet.next() fetch new rows from server that time server will throw this exception.


    2014-04-02 17:58:18,911 WARN  thrift.ThriftCLIService (ThriftCLIService.java:FetchResults(394)) - Error getting result set metadata:
   org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle: OperationHandle [opType=EXECUTE_STATEMENT, getHandleIdentifier()=5edd24f8-3147-4428-9687- bab20db19773]
       at org.apache.hive.service.cli.operation.OperationManager.getOperation(OperationManager.java:129)

                Can we perform parallel operation one same statement object in JDBC connection ?

Thanks & Regards
Surendra

Re: HiveServer2 : Can we perform parallel operation one same statement object in JDBC connection ?

Posted by Vaibhav Gumashta <vg...@hortonworks.com>.
Surendra,

In HiveServer2, internally, the HiveStatement object keeps a reference to
the corresponding operation object it created to execute the query. If you
call another execute, it closes the previous operation, thus clearing the
operation handle. Check this line:
https://github.com/apache/hive/blob/trunk/jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java#L216
.

However, in HIVE-6472 <https://issues.apache.org/jira/browse/HIVE-6472>,
we've added support for a parallel cancel, which will let the user cancel a
long running job in another thread.

Thanks,
--Vaibhav


On Wed, Apr 2, 2014 at 9:23 PM, surendra lilhore <
surendra.lilhore@huawei.com> wrote:

> Thanks Xuefu for the reply.
>
> -----Original Message-----
> From: Xuefu Zhang [mailto:xzhang@cloudera.com]
> Sent: 02 April 2014 PM 10:29
> To: dev@hive.apache.org
> Cc: hive-dev@hadoop.apache.org
> Subject: Re: HiveServer2 : Can we perform parallel operation one same
> statement object in JDBC connection ?
>
> Based on my past experience, the answer is "no". You may reuse the
> statement object sequentially, but you cannot do so in a concurrent manner.
>
> --Xuefu
>
>
> On Wed, Apr 2, 2014 at 6:42 AM, surendra lilhore <
> surendra.lilhore@huawei.com> wrote:
>
> > Hi all,
> >
> >                 I am deleting all table using this code in
> > HiveServer2, but after deleting all the table hive sever is throwing
> > "Invalid OperationHandle" exception.
> >
> >                 ResultSet resultSet = stmt.executeQuery("show tables");
> >        while (resultSet.next()) {
> >               stmt.execute("drop table " + resultSet.getString(1));
> >        }
> >
> >                 Same code is working with HiveServer.
> >
> >                 In checked code.
> >
> >        HiveServer2 will create new operation handler for "show tables"
> >  query,
> >       If I execute "drop table" on same statement object then
> > HiveStatement.execute() will close old operation handler and then it
> > will get new handler, but HiveQueryResultSet will contain old handler
> > only, again when
> > resultSet.next() fetch new rows from server that time server will
> > throw this exception.
> >
> >
> >     2014-04-02 17:58:18,911 WARN  thrift.ThriftCLIService
> > (ThriftCLIService.java:FetchResults(394)) - Error getting result set
> > metadata:
> >    org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle:
> > OperationHandle [opType=EXECUTE_STATEMENT,
> > getHandleIdentifier()=5edd24f8-3147-4428-9687- bab20db19773]
> >        at
> > org.apache.hive.service.cli.operation.OperationManager.getOperation(Op
> > erationManager.java:129)
> >
> >                 Can we perform parallel operation one same statement
> > object in JDBC connection ?
> >
> > Thanks & Regards
> > Surendra
> >
>

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.

RE: HiveServer2 : Can we perform parallel operation one same statement object in JDBC connection ?

Posted by surendra lilhore <su...@huawei.com>.
Thanks Xuefu for the reply.

-----Original Message-----
From: Xuefu Zhang [mailto:xzhang@cloudera.com] 
Sent: 02 April 2014 PM 10:29
To: dev@hive.apache.org
Cc: hive-dev@hadoop.apache.org
Subject: Re: HiveServer2 : Can we perform parallel operation one same statement object in JDBC connection ?

Based on my past experience, the answer is "no". You may reuse the statement object sequentially, but you cannot do so in a concurrent manner.

--Xuefu


On Wed, Apr 2, 2014 at 6:42 AM, surendra lilhore < surendra.lilhore@huawei.com> wrote:

> Hi all,
>
>                 I am deleting all table using this code in 
> HiveServer2, but after deleting all the table hive sever is throwing 
> "Invalid OperationHandle" exception.
>
>                 ResultSet resultSet = stmt.executeQuery("show tables");
>        while (resultSet.next()) {
>               stmt.execute("drop table " + resultSet.getString(1));
>        }
>
>                 Same code is working with HiveServer.
>
>                 In checked code.
>
>        HiveServer2 will create new operation handler for "show tables"
>  query,
>       If I execute "drop table" on same statement object then
> HiveStatement.execute() will close old operation handler and then it 
> will get new handler, but HiveQueryResultSet will contain old handler 
> only, again when
> resultSet.next() fetch new rows from server that time server will 
> throw this exception.
>
>
>     2014-04-02 17:58:18,911 WARN  thrift.ThriftCLIService
> (ThriftCLIService.java:FetchResults(394)) - Error getting result set
> metadata:
>    org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle:
> OperationHandle [opType=EXECUTE_STATEMENT,
> getHandleIdentifier()=5edd24f8-3147-4428-9687- bab20db19773]
>        at
> org.apache.hive.service.cli.operation.OperationManager.getOperation(Op
> erationManager.java:129)
>
>                 Can we perform parallel operation one same statement 
> object in JDBC connection ?
>
> Thanks & Regards
> Surendra
>

Re: HiveServer2 : Can we perform parallel operation one same statement object in JDBC connection ?

Posted by Xuefu Zhang <xz...@cloudera.com>.
Based on my past experience, the answer is "no". You may reuse the
statement object sequentially, but you cannot do so in a concurrent manner.

--Xuefu


On Wed, Apr 2, 2014 at 6:42 AM, surendra lilhore <
surendra.lilhore@huawei.com> wrote:

> Hi all,
>
>                 I am deleting all table using this code in HiveServer2,
> but after deleting all the table hive sever is throwing "Invalid
> OperationHandle" exception.
>
>                 ResultSet resultSet = stmt.executeQuery("show tables");
>        while (resultSet.next()) {
>               stmt.execute("drop table " + resultSet.getString(1));
>        }
>
>                 Same code is working with HiveServer.
>
>                 In checked code.
>
>        HiveServer2 will create new operation handler for "show tables"
>  query,
>       If I execute "drop table" on same statement object then
> HiveStatement.execute() will close old operation handler and then it will
> get new handler,
> but HiveQueryResultSet will contain old handler only, again when
> resultSet.next() fetch new rows from server that time server will throw
> this exception.
>
>
>     2014-04-02 17:58:18,911 WARN  thrift.ThriftCLIService
> (ThriftCLIService.java:FetchResults(394)) - Error getting result set
> metadata:
>    org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle:
> OperationHandle [opType=EXECUTE_STATEMENT,
> getHandleIdentifier()=5edd24f8-3147-4428-9687- bab20db19773]
>        at
> org.apache.hive.service.cli.operation.OperationManager.getOperation(OperationManager.java:129)
>
>                 Can we perform parallel operation one same statement
> object in JDBC connection ?
>
> Thanks & Regards
> Surendra
>