You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Liyifan <li...@huawei.com> on 2012/08/29 03:47:37 UTC

A question about HiveStatement.executeUpdate's exception

Hi, all. I'm new to Hive, I have a question about executeUpdate.

I executed a SQL by invoking HiveStatement.executeUpdate method. I found that it throws an "Method not supported" exception.

And I checked the code in hive-0.9\jdbc\src\java\org\apache\hadoop\hive\jdbc\HiveStatement.java, I found that the "Method not supported" is always threw unless client.execute(sql) throws an exceptioin.



I'm confused about it, why executeUpdate always throws an exeption?



  public int executeUpdate(String sql) throws SQLException {
    try {
      client.execute(sql);
    } catch (Exception ex) {
      throw new SQLException(ex.toString());
    }
    throw new SQLException("Method not supported");
  }

Re: A question about HiveStatement.executeUpdate's exception

Posted by Carl Steinbach <ca...@cloudera.com>.
Hi Ed,

Namit has requested that I add negative testcases for each of the
exceptions thrown by executeUpdate. I added a note to the phabricator
review requesting clarification on this point. I think we should probably
wait until Namit has had a chance to respond.

Thanks.

Carl

On Fri, Aug 31, 2012 at 8:56 AM, Edward Capriolo <ed...@gmail.com>wrote:

> I will commit that one later tonight. Seems like it is no big deal.
>
> On Fri, Aug 31, 2012 at 11:50 AM, Mark Grover <mg...@oanda.com> wrote:
> > Hi Liyifan,
> > This seems like a bug. As a workaround, I would recommend using
> HiveStatement.executeQuery() instead (since they both call execute() on the
> Thrift client).
> >
> > There is a JIRA already for this (
> https://issues.apache.org/jira/browse/HIVE-1450) and seems like a patch
> was uploaded as well (https://reviews.facebook.net/D4293) but nothing has
> been committed just yet.
> >
> > I've asked for the status on the JIRA, let's see what they say:-)
> >
> > Mark
> >
> > ----- Original Message -----
> > From: "Liyifan" <li...@huawei.com>
> > To: user@hive.apache.org
> > Sent: Tuesday, August 28, 2012 9:47:37 PM
> > Subject: A question about HiveStatement.executeUpdate's exception
> >
> >
> >
> >
> > Hi, all. I'm new to Hive, I have a question about executeUpdate.
> >
> > I executed a SQL by invoking HiveStatement.executeUpdate method. I found
> that it throws an "Method not supported" exception.
> >
> > And I checked the code in
> hive-0.9\jdbc\src\java\org\apache\hadoop\hive\jdbc\HiveStatement.java, I
> found that the "Method not supported" is always threw unless
> client.execute(sql) throws an exceptioin.
> >
> >
> >
> > I'm confused about it, why executeUpdate always throws an exeption?
> >
> >
> >
> > public int executeUpdate(String sql) throws SQLException {
> > try {
> > client.execute(sql);
> > } catch (Exception ex) {
> > throw new SQLException(ex.toString());
> > }
> > throw new SQLException("Method not supported");
> > }
>

Re: A question about HiveStatement.executeUpdate's exception

Posted by Edward Capriolo <ed...@gmail.com>.
I will commit that one later tonight. Seems like it is no big deal.

On Fri, Aug 31, 2012 at 11:50 AM, Mark Grover <mg...@oanda.com> wrote:
> Hi Liyifan,
> This seems like a bug. As a workaround, I would recommend using HiveStatement.executeQuery() instead (since they both call execute() on the Thrift client).
>
> There is a JIRA already for this (https://issues.apache.org/jira/browse/HIVE-1450) and seems like a patch was uploaded as well (https://reviews.facebook.net/D4293) but nothing has been committed just yet.
>
> I've asked for the status on the JIRA, let's see what they say:-)
>
> Mark
>
> ----- Original Message -----
> From: "Liyifan" <li...@huawei.com>
> To: user@hive.apache.org
> Sent: Tuesday, August 28, 2012 9:47:37 PM
> Subject: A question about HiveStatement.executeUpdate's exception
>
>
>
>
> Hi, all. I'm new to Hive, I have a question about executeUpdate.
>
> I executed a SQL by invoking HiveStatement.executeUpdate method. I found that it throws an "Method not supported" exception.
>
> And I checked the code in hive-0.9\jdbc\src\java\org\apache\hadoop\hive\jdbc\HiveStatement.java, I found that the "Method not supported" is always threw unless client.execute(sql) throws an exceptioin.
>
>
>
> I'm confused about it, why executeUpdate always throws an exeption?
>
>
>
> public int executeUpdate(String sql) throws SQLException {
> try {
> client.execute(sql);
> } catch (Exception ex) {
> throw new SQLException(ex.toString());
> }
> throw new SQLException("Method not supported");
> }

Re: A question about HiveStatement.executeUpdate's exception

Posted by Mark Grover <mg...@oanda.com>.
Hi Liyifan,
This seems like a bug. As a workaround, I would recommend using HiveStatement.executeQuery() instead (since they both call execute() on the Thrift client).

There is a JIRA already for this (https://issues.apache.org/jira/browse/HIVE-1450) and seems like a patch was uploaded as well (https://reviews.facebook.net/D4293) but nothing has been committed just yet.

I've asked for the status on the JIRA, let's see what they say:-)

Mark

----- Original Message -----
From: "Liyifan" <li...@huawei.com>
To: user@hive.apache.org
Sent: Tuesday, August 28, 2012 9:47:37 PM
Subject: A question about HiveStatement.executeUpdate's exception




Hi, all. I'm new to Hive, I have a question about executeUpdate. 

I executed a SQL by invoking HiveStatement.executeUpdate method. I found that it throws an "Method not supported" exception. 

And I checked the code in hive-0.9\jdbc\src\java\org\apache\hadoop\hive\jdbc\HiveStatement.java, I found that the "Method not supported" is always threw unless client.execute(sql) throws an exceptioin. 



I'm confused about it, why executeUpdate always throws an exeption? 



public int executeUpdate(String sql) throws SQLException { 
try { 
client.execute(sql); 
} catch (Exception ex) { 
throw new SQLException(ex.toString()); 
} 
throw new SQLException("Method not supported"); 
}