You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by javateck javateck <ja...@gmail.com> on 2009/04/01 03:58:03 UTC
Re: how to find jdbc url port settings?
I'm able to start the hive server, and I find some unexpected things
happening:
1. for hive command, it seems wherever you start hive command, it will
create the DB directory under your current directory, and this causes a lot
of confusions, not sure if this is by design or a bug. Maybe I miss
something, but this is the default behavior and I don't think this is a good
one.
2. If I read the document correctly, if jdbc is through a remote call, the
only db name supported is "default". And I tried calling through jdbc, and
get nullpointer exceptions. I can see from the screen that server side
printed out the query, but on client side, it's throwing exceptions.
*Code:*
query = "show tables";
Connection connection = null;
Statement stmt = null;
try {
connection = DriverManager.getConnection(
"jdbc:hive://server1:10000/metastore_db", "", "");
stmt = connection.createStatement();
ResultSet result = stmt.executeQuery(query);
while (result.next()) { *// and it's throwing exception here*
log.info(result.getString(0));
}
} catch (Exception e) {
log.error(e);
} finally {
if (stmt != null) {
try {
stmt.close();
} catch (Exception e) {
//
}
}
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
//
}
}
}
*Exceptions:*
09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
java.lang.NullPointerException
at org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(
DynamicSerDe.java:124)
at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(
JUnit38ClassRunner.java:79)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:196)
09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException: Error
retrieving next row
On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com> wrote:
> You need to specify a port only if you want to connect to a standalone
> server. For instructions on starting the hive server see:
> http://wiki.apache.org/hadoop/Hive/HiveServer
>
> For details on using JDBC in embedded mode or using it on a standalone
> server see:
> http://wiki.apache.org/hadoop/Hive/HiveClient
>
>
> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
>
> > Hi,
> >
> > I'm trying to use jdbc to connect, and default is saying 10000 port in
> > the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see
> 10000
> > port is open when I do netstat, and theTestJdbcDriver is throwing
> connection
> > refuse exception when trying to open the connection. Even though a lot of
> jdbc
> > interfaces are mot implemented on hive side, I just want to see what I
> can get
> > from the sql query execution. And I don't know other easy alternative
> other
> > than jdbc if I'm using java. And I don't see jdbc configurations anywhere
> > either.
> >
> > Can someone shed some light on this?
> >
> > thanks
>
>
Re: how to find jdbc url port settings?
Posted by javateck javateck <ja...@gmail.com>.
It's working for my map reduce query, but not working on "show tables", it's
still throwing null pointer when calling resultSet.next(), this is different
issue than the String.equals, it's just not supported yet from what I can
see. But for now, since map reduce is working, I'm ok so far.
thanks,
On Tue, Mar 31, 2009 at 11:40 PM, Raghu Murthy <rm...@facebook.com> wrote:
> Yeah, there has been a jira filed about it already:
> https://issues.apache.org/jira/browse/HIVE-381 Does your code work once
> this
> bug was fixed?
>
>
> On 3/31/09 11:00 PM, "javateck javateck" <ja...@gmail.com> wrote:
>
> > Actually I find that there is an issue there in side HiveResultSet.java
> class,
> > which is causing failure, seems like a careless mistake?
> >
> > public boolean next() throws SQLException {
> > String row_str;
> > try {
> > row_str = (String)client.fetchOne();
> > if (!row_str.equals("")) {
> > Object o = ds.deserialize(new BytesWritable(row_str.getBytes()));
> > row = (ArrayList<?>)o;
> > }
> > } catch (Exception ex) {
> > throw new SQLException("Error retrieving next row");
> > }
> > // NOTE: fetchOne dosn't throw new SQLException("Method not
> supported").
> > return row_str != ""; // which should
> be !row_str.equals("")
> > }
> >
> >
> > On Tue, Mar 31, 2009 at 6:58 PM, javateck javateck <ja...@gmail.com>
> wrote:
> >> I'm able to start the hive server, and I find some unexpected things
> >> happening:
> >>
> >> 1. for hive command, it seems wherever you start hive command, it will
> create
> >> the DB directory under your current directory, and this causes a lot of
> >> confusions, not sure if this is by design or a bug. Maybe I miss
> something,
> >> but this is the default behavior and I don't think this is a good one.
> >>
> >> 2. If I read the document correctly, if jdbc is through a remote call,
> the
> >> only db name supported is "default". And I tried calling through jdbc,
> and
> >> get
> >> nullpointer exceptions. I can see from the screen that server side
> printed
> >> out
> >> the query, but on client side, it's throwing exceptions.
> >>
> >> Code:
> >> query = "show tables";
> >>
> >> Connection connection = null;
> >>
> >> Statement stmt = null;
> >>
> >> try {
> >>
> >> connection =
> >> DriverManager.getConnection("jdbc:hive://server1:10000/metastore_db",
> "",
> >> "");
> >>
> >> stmt = connection.createStatement();
> >>
> >> ResultSet result = stmt.executeQuery(query);
> >>
> >> while (result.next()) { // and it's throwing exception here
> >>
> >> log.info(result.getString(1));
> >>
> >> }
> >>
> >> } catch (Exception e) {
> >>
> >> log.error(e);
> >>
> >> } finally {
> >>
> >> if (stmt != null) {
> >>
> >> try {
> >>
> >> stmt.close();
> >>
> >> } catch (Exception e) {
> >>
> >> //
> >>
> >> }
> >>
> >> }
> >>
> >> if (connection != null) {
> >>
> >> try {
> >>
> >> connection.close();
> >>
> >> } catch (Exception e) {
> >>
> >> //
> >>
> >> }
> >>
> >> }
> >>
> >> }
> >>
> >>
> >> Exceptions:
> >> 09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
> >> file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
> >>
> >> java.lang.NullPointerException
> >>
> >> at
> >>
>
> org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(DynamicSe>>
> r
> >> De.java:124)
> >>
> >> at
> org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
> >>
> >> at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
> >>
> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>
> >> at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>
> >> at
> >>
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.>>
> j
> >> ava:25)
> >>
> >> at java.lang.reflect.Method.invoke(Method.java:597)
> >>
> >> at junit.framework.TestCase.runTest(TestCase.java:168)
> >>
> >> at junit.framework.TestCase.runBare(TestCase.java:134)
> >>
> >> at junit.framework.TestResult$1.protect(TestResult.java:110)
> >>
> >> at junit.framework.TestResult.runProtected(TestResult.java:128)
> >>
> >> at junit.framework.TestResult.run(TestResult.java:113)
> >>
> >> at junit.framework.TestCase.run(TestCase.java:124)
> >>
> >> at junit.framework.TestSuite.runTest(TestSuite.java:232)
> >>
> >> at junit.framework.TestSuite.run(TestSuite.java:227)
> >>
> >> at
> >>
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRefe>>
> r
> >> ence.java:45)
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38>>
> )
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRun>>
> n
> >> er.java:460)
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRun>>
> n
> >> er.java:673)
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.j>>
> a
> >> va:386)
> >>
> >> at
> >>
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.>>
> j
> >> ava:196)
> >>
> >> 09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException:
> Error
> >> retrieving next row
> >>
> >>
> >> On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com>
> wrote:
> >>> You need to specify a port only if you want to connect to a standalone
> >>> server. For instructions on starting the hive server see:
> >>> http://wiki.apache.org/hadoop/Hive/HiveServer
> >>>
> >>> For details on using JDBC in embedded mode or using it on a standalone
> >>> server see:
> >>> http://wiki.apache.org/hadoop/Hive/HiveClient
> >>>
> >>>
> >>> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
> >>>
> >>>>> Hi,
> >>>>>
> >>>>> I'm trying to use jdbc to connect, and default is saying 10000 port
> in
> >>>>> the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see
> 10000
> >>>>> port is open when I do netstat, and theTestJdbcDriver is throwing
> >>>> connection
> >>>>> refuse exception when trying to open the connection. Even though a
> lot of
> >>>> jdbc
> >>>>> interfaces are mot implemented on hive side, I just want to see what
> I can
> >>>>> >>> get
> >>>>> from the sql query execution. And I don't know other easy alternative
> >>>> other
> >>>>> than jdbc if I'm using java. And I don't see jdbc configurations
> anywhere
> >>>>> either.
> >>>>>
> >>>>> Can someone shed some light on this?
> >>>>>
> >>>>> thanks
> >>>
> >>
> >
>
>
Re: how to find jdbc url port settings?
Posted by Namit Jain <nj...@facebook.com>.
https://issues.apache.org/jira/browse/HIVE-381
Is already filed for that.
On 3/31/09 11:00 PM, "javateck javateck" <ja...@gmail.com> wrote:
Actually I find that there is an issue there in side HiveResultSet.java class, which is causing failure, seems like a careless mistake?
public boolean next() throws SQLException {
String row_str;
try {
row_str = (String)client.fetchOne();
if (!row_str.equals("")) {
Object o = ds.deserialize(new BytesWritable(row_str.getBytes()));
row = (ArrayList<?>)o;
}
} catch (Exception ex) {
throw new SQLException("Error retrieving next row");
}
// NOTE: fetchOne dosn't throw new SQLException("Method not supported").
return row_str != ""; // which should be !row_str.equals("")
}
On Tue, Mar 31, 2009 at 6:58 PM, javateck javateck <ja...@gmail.com> wrote:
I'm able to start the hive server, and I find some unexpected things happening:
1. for hive command, it seems wherever you start hive command, it will create the DB directory under your current directory, and this causes a lot of confusions, not sure if this is by design or a bug. Maybe I miss something, but this is the default behavior and I don't think this is a good one.
2. If I read the document correctly, if jdbc is through a remote call, the only db name supported is "default". And I tried calling through jdbc, and get nullpointer exceptions. I can see from the screen that server side printed out the query, but on client side, it's throwing exceptions.
Code:
query = "show tables";
Connection connection = null;
Statement stmt = null;
try {
connection = DriverManager.getConnection("jdbc:hive://server1:10000/metastore_db", "", "");
stmt = connection.createStatement();
ResultSet result = stmt.executeQuery(query);
while (result.next()) { // and it's throwing exception here
log.info(result.getString(1));
}
} catch (Exception e) {
log.error(e);
} finally {
if (stmt != null) {
try {
stmt.close();
} catch (Exception e) {
//
}
}
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
//
}
}
}
Exceptions:
09/03/31 18:52:05 INFO exec.HiveHistory: Hive history file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
java.lang.NullPointerException
at org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(DynamicSerDe.java:124)
at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException: Error retrieving next row
On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com> wrote:
You need to specify a port only if you want to connect to a standalone
server. For instructions on starting the hive server see:
http://wiki.apache.org/hadoop/Hive/HiveServer
For details on using JDBC in embedded mode or using it on a standalone
server see:
http://wiki.apache.org/hadoop/Hive/HiveClient
On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
> Hi,
>
> I'm trying to use jdbc to connect, and default is saying 10000 port in
> the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see 10000
> port is open when I do netstat, and theTestJdbcDriver is throwing connection
> refuse exception when trying to open the connection. Even though a lot of jdbc
> interfaces are mot implemented on hive side, I just want to see what I can get
> from the sql query execution. And I don't know other easy alternative other
> than jdbc if I'm using java. And I don't see jdbc configurations anywhere
> either.
>
> Can someone shed some light on this?
>
> thanks
Re: how to find jdbc url port settings?
Posted by Raghu Murthy <rm...@facebook.com>.
Yeah, there has been a jira filed about it already:
https://issues.apache.org/jira/browse/HIVE-381 Does your code work once this
bug was fixed?
On 3/31/09 11:00 PM, "javateck javateck" <ja...@gmail.com> wrote:
> Actually I find that there is an issue there in side HiveResultSet.java class,
> which is causing failure, seems like a careless mistake?
>
> public boolean next() throws SQLException {
> String row_str;
> try {
> row_str = (String)client.fetchOne();
> if (!row_str.equals("")) {
> Object o = ds.deserialize(new BytesWritable(row_str.getBytes()));
> row = (ArrayList<?>)o;
> }
> } catch (Exception ex) {
> throw new SQLException("Error retrieving next row");
> }
> // NOTE: fetchOne dosn't throw new SQLException("Method not supported").
> return row_str != ""; // which should be !row_str.equals("")
> }
>
>
> On Tue, Mar 31, 2009 at 6:58 PM, javateck javateck <ja...@gmail.com> wrote:
>> I'm able to start the hive server, and I find some unexpected things
>> happening:
>>
>> 1. for hive command, it seems wherever you start hive command, it will create
>> the DB directory under your current directory, and this causes a lot of
>> confusions, not sure if this is by design or a bug. Maybe I miss something,
>> but this is the default behavior and I don't think this is a good one.
>>
>> 2. If I read the document correctly, if jdbc is through a remote call, the
>> only db name supported is "default". And I tried calling through jdbc, and
>> get
>> nullpointer exceptions. I can see from the screen that server side printed
>> out
>> the query, but on client side, it's throwing exceptions.
>>
>> Code:
>> query = "show tables";
>>
>> Connection connection = null;
>>
>> Statement stmt = null;
>>
>> try {
>>
>> connection =
>> DriverManager.getConnection("jdbc:hive://server1:10000/metastore_db", "",
>> "");
>>
>> stmt = connection.createStatement();
>>
>> ResultSet result = stmt.executeQuery(query);
>>
>> while (result.next()) { // and it's throwing exception here
>>
>> log.info(result.getString(1));
>>
>> }
>>
>> } catch (Exception e) {
>>
>> log.error(e);
>>
>> } finally {
>>
>> if (stmt != null) {
>>
>> try {
>>
>> stmt.close();
>>
>> } catch (Exception e) {
>>
>> //
>>
>> }
>>
>> }
>>
>> if (connection != null) {
>>
>> try {
>>
>> connection.close();
>>
>> } catch (Exception e) {
>>
>> //
>>
>> }
>>
>> }
>>
>> }
>>
>>
>> Exceptions:
>> 09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
>> file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
>>
>> java.lang.NullPointerException
>>
>> at
>>
org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(DynamicSe>>
r
>> De.java:124)
>>
>> at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
>>
>> at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.>>
j
>> ava:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at junit.framework.TestCase.runTest(TestCase.java:168)
>>
>> at junit.framework.TestCase.runBare(TestCase.java:134)
>>
>> at junit.framework.TestResult$1.protect(TestResult.java:110)
>>
>> at junit.framework.TestResult.runProtected(TestResult.java:128)
>>
>> at junit.framework.TestResult.run(TestResult.java:113)
>>
>> at junit.framework.TestCase.run(TestCase.java:124)
>>
>> at junit.framework.TestSuite.runTest(TestSuite.java:232)
>>
>> at junit.framework.TestSuite.run(TestSuite.java:227)
>>
>> at
>> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
>>
>> at
>>
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRefe>>
r
>> ence.java:45)
>>
>> at
>>
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38>>
)
>>
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRun>>
n
>> er.java:460)
>>
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRun>>
n
>> er.java:673)
>>
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.j>>
a
>> va:386)
>>
>> at
>>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.>>
j
>> ava:196)
>>
>> 09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException: Error
>> retrieving next row
>>
>>
>> On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com> wrote:
>>> You need to specify a port only if you want to connect to a standalone
>>> server. For instructions on starting the hive server see:
>>> http://wiki.apache.org/hadoop/Hive/HiveServer
>>>
>>> For details on using JDBC in embedded mode or using it on a standalone
>>> server see:
>>> http://wiki.apache.org/hadoop/Hive/HiveClient
>>>
>>>
>>> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
>>>
>>>>> Hi,
>>>>>
>>>>> I'm trying to use jdbc to connect, and default is saying 10000 port in
>>>>> the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see 10000
>>>>> port is open when I do netstat, and theTestJdbcDriver is throwing
>>>> connection
>>>>> refuse exception when trying to open the connection. Even though a lot of
>>>> jdbc
>>>>> interfaces are mot implemented on hive side, I just want to see what I can
>>>>> >>> get
>>>>> from the sql query execution. And I don't know other easy alternative
>>>> other
>>>>> than jdbc if I'm using java. And I don't see jdbc configurations anywhere
>>>>> either.
>>>>>
>>>>> Can someone shed some light on this?
>>>>>
>>>>> thanks
>>>
>>
>
Re: how to find jdbc url port settings?
Posted by javateck javateck <ja...@gmail.com>.
Actually I find that there is an issue there in side HiveResultSet.java
class, which is causing failure, seems like a careless mistake?
public boolean next() throws SQLException {
String row_str;
try {
row_str = (String)client.fetchOne();
if (!row_str.equals("")) {
Object o = ds.deserialize(new BytesWritable(row_str.getBytes()));
row = (ArrayList<?>)o;
}
} catch (Exception ex) {
throw new SQLException("Error retrieving next row");
}
// NOTE: fetchOne dosn't throw new SQLException("Method not supported").
return row_str != ""; // which should be !row_str.equals("")
}
On Tue, Mar 31, 2009 at 6:58 PM, javateck javateck <ja...@gmail.com>wrote:
> I'm able to start the hive server, and I find some unexpected things
> happening:
> 1. for hive command, it seems wherever you start hive command, it will
> create the DB directory under your current directory, and this causes a lot
> of confusions, not sure if this is by design or a bug. Maybe I miss
> something, but this is the default behavior and I don't think this is a good
> one.
>
> 2. If I read the document correctly, if jdbc is through a remote call, the
> only db name supported is "default". And I tried calling through jdbc, and
> get nullpointer exceptions. I can see from the screen that server side
> printed out the query, but on client side, it's throwing exceptions.
>
> *Code:*
>
> query = "show tables";
>
> Connection connection = null;
>
> Statement stmt = null;
>
> try {
>
> connection = DriverManager.getConnection(
> "jdbc:hive://server1:10000/metastore_db", "", "");
>
> stmt = connection.createStatement();
>
> ResultSet result = stmt.executeQuery(query);
>
> while (result.next()) { *// and it's throwing exception here*
>
> log.info(result.getString(1));
>
> }
>
> } catch (Exception e) {
>
> log.error(e);
>
> } finally {
>
> if (stmt != null) {
>
> try {
>
> stmt.close();
>
> } catch (Exception e) {
>
> //
>
> }
>
> }
>
> if (connection != null) {
>
> try {
>
> connection.close();
>
> } catch (Exception e) {
>
> //
>
> }
>
> }
>
> }
>
> *Exceptions:*
>
> 09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
> file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
>
> java.lang.NullPointerException
>
> at org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(
> DynamicSerDe.java:124)
>
> at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
>
> at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at junit.framework.TestCase.runTest(TestCase.java:168)
>
> at junit.framework.TestCase.runBare(TestCase.java:134)
>
> at junit.framework.TestResult$1.protect(TestResult.java:110)
>
> at junit.framework.TestResult.runProtected(TestResult.java:128)
>
> at junit.framework.TestResult.run(TestResult.java:113)
>
> at junit.framework.TestCase.run(TestCase.java:124)
>
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
>
> at junit.framework.TestSuite.run(TestSuite.java:227)
>
> at org.junit.internal.runners.JUnit38ClassRunner.run(
> JUnit38ClassRunner.java:79)
>
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
> JUnit4TestReference.java:45)
>
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
> TestExecution.java:38)
>
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:460)
>
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
> RemoteTestRunner.java:673)
>
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
> RemoteTestRunner.java:386)
>
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
> RemoteTestRunner.java:196)
>
> 09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException:
> Error retrieving next row
>
> On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com>wrote:
>
>> You need to specify a port only if you want to connect to a standalone
>> server. For instructions on starting the hive server see:
>> http://wiki.apache.org/hadoop/Hive/HiveServer
>>
>> For details on using JDBC in embedded mode or using it on a standalone
>> server see:
>> http://wiki.apache.org/hadoop/Hive/HiveClient
>>
>>
>> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I'm trying to use jdbc to connect, and default is saying 10000 port in
>> > the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see
>> 10000
>> > port is open when I do netstat, and theTestJdbcDriver is throwing
>> connection
>> > refuse exception when trying to open the connection. Even though a lot
>> of jdbc
>> > interfaces are mot implemented on hive side, I just want to see what I
>> can get
>> > from the sql query execution. And I don't know other easy alternative
>> other
>> > than jdbc if I'm using java. And I don't see jdbc configurations
>> anywhere
>> > either.
>> >
>> > Can someone shed some light on this?
>> >
>> > thanks
>>
>>
>
Re: how to find jdbc url port settings?
Posted by javateck javateck <ja...@gmail.com>.
Thanks Edward, good point.
On Tue, Mar 31, 2009 at 8:01 PM, Edward Capriolo <ed...@gmail.com>wrote:
> I notice you are looking for a java API for hive. Take a look in the
> hwi sub directory. There is a test case TestHWISessionManager. You can
> use this as a java driver. HiveServer and JDBC have advantages but if
> your client is Java based using the HWISessionManager works out of the
> box.
>
> On Tue, Mar 31, 2009 at 9:58 PM, javateck javateck <ja...@gmail.com>
> wrote:
> > I'm able to start the hive server, and I find some unexpected things
> > happening:
> > 1. for hive command, it seems wherever you start hive command, it will
> > create the DB directory under your current directory, and this causes a
> lot
> > of confusions, not sure if this is by design or a bug. Maybe I miss
> > something, but this is the default behavior and I don't think this is a
> good
> > one.
> > 2. If I read the document correctly, if jdbc is through a remote call,
> the
> > only db name supported is "default". And I tried calling through jdbc,
> and
> > get nullpointer exceptions. I can see from the screen that server side
> > printed out the query, but on client side, it's throwing exceptions.
> > Code:
> >
> > query = "show tables";
> >
> > Connection connection = null;
> >
> > Statement stmt = null;
> >
> > try {
> >
> > connection =
> > DriverManager.getConnection("jdbc:hive://server1:10000/metastore_db", "",
> > "");
> >
> > stmt = connection.createStatement();
> >
> > ResultSet result = stmt.executeQuery(query);
> >
> > while (result.next()) { // and it's throwing exception here
> >
> > log.info(result.getString(0));
> >
> > }
> >
> > } catch (Exception e) {
> >
> > log.error(e);
> >
> > } finally {
> >
> > if (stmt != null) {
> >
> > try {
> >
> > stmt.close();
> >
> > } catch (Exception e) {
> >
> > //
> >
> > }
> >
> > }
> >
> > if (connection != null) {
> >
> > try {
> >
> > connection.close();
> >
> > } catch (Exception e) {
> >
> > //
> >
> > }
> >
> > }
> >
> > }
> >
> > Exceptions:
> >
> > 09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
> > file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
> >
> > java.lang.NullPointerException
> >
> > at
> >
> org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(DynamicSerDe.java:124)
> >
> > at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
> >
> > at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >
> > at java.lang.reflect.Method.invoke(Method.java:597)
> >
> > at junit.framework.TestCase.runTest(TestCase.java:168)
> >
> > at junit.framework.TestCase.runBare(TestCase.java:134)
> >
> > at junit.framework.TestResult$1.protect(TestResult.java:110)
> >
> > at junit.framework.TestResult.runProtected(TestResult.java:128)
> >
> > at junit.framework.TestResult.run(TestResult.java:113)
> >
> > at junit.framework.TestCase.run(TestCase.java:124)
> >
> > at junit.framework.TestSuite.runTest(TestSuite.java:232)
> >
> > at junit.framework.TestSuite.run(TestSuite.java:227)
> >
> > at
> >
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
> >
> > at
> >
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> >
> > at
> >
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> >
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> >
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> >
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> >
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> >
> > 09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException:
> Error
> > retrieving next row
> >
> > On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com>
> wrote:
> >>
> >> You need to specify a port only if you want to connect to a standalone
> >> server. For instructions on starting the hive server see:
> >> http://wiki.apache.org/hadoop/Hive/HiveServer
> >>
> >> For details on using JDBC in embedded mode or using it on a standalone
> >> server see:
> >> http://wiki.apache.org/hadoop/Hive/HiveClient
> >>
> >>
> >> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
> >>
> >> > Hi,
> >> >
> >> > I'm trying to use jdbc to connect, and default is saying 10000 port
> in
> >> > the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see
> >> > 10000
> >> > port is open when I do netstat, and theTestJdbcDriver is throwing
> >> > connection
> >> > refuse exception when trying to open the connection. Even though a lot
> >> > of jdbc
> >> > interfaces are mot implemented on hive side, I just want to see what I
> >> > can get
> >> > from the sql query execution. And I don't know other easy alternative
> >> > other
> >> > than jdbc if I'm using java. And I don't see jdbc configurations
> >> > anywhere
> >> > either.
> >> >
> >> > Can someone shed some light on this?
> >> >
> >> > thanks
> >>
> >
> >
>
Re: how to find jdbc url port settings?
Posted by Edward Capriolo <ed...@gmail.com>.
I notice you are looking for a java API for hive. Take a look in the
hwi sub directory. There is a test case TestHWISessionManager. You can
use this as a java driver. HiveServer and JDBC have advantages but if
your client is Java based using the HWISessionManager works out of the
box.
On Tue, Mar 31, 2009 at 9:58 PM, javateck javateck <ja...@gmail.com> wrote:
> I'm able to start the hive server, and I find some unexpected things
> happening:
> 1. for hive command, it seems wherever you start hive command, it will
> create the DB directory under your current directory, and this causes a lot
> of confusions, not sure if this is by design or a bug. Maybe I miss
> something, but this is the default behavior and I don't think this is a good
> one.
> 2. If I read the document correctly, if jdbc is through a remote call, the
> only db name supported is "default". And I tried calling through jdbc, and
> get nullpointer exceptions. I can see from the screen that server side
> printed out the query, but on client side, it's throwing exceptions.
> Code:
>
> query = "show tables";
>
> Connection connection = null;
>
> Statement stmt = null;
>
> try {
>
> connection =
> DriverManager.getConnection("jdbc:hive://server1:10000/metastore_db", "",
> "");
>
> stmt = connection.createStatement();
>
> ResultSet result = stmt.executeQuery(query);
>
> while (result.next()) { // and it's throwing exception here
>
> log.info(result.getString(0));
>
> }
>
> } catch (Exception e) {
>
> log.error(e);
>
> } finally {
>
> if (stmt != null) {
>
> try {
>
> stmt.close();
>
> } catch (Exception e) {
>
> //
>
> }
>
> }
>
> if (connection != null) {
>
> try {
>
> connection.close();
>
> } catch (Exception e) {
>
> //
>
> }
>
> }
>
> }
>
> Exceptions:
>
> 09/03/31 18:52:05 INFO exec.HiveHistory: Hive history
> file=/tmp/user1/hive_job_log_opalsoft_200903311852_2050266722.txt
>
> java.lang.NullPointerException
>
> at
> org.apache.hadoop.hive.serde2.dynamic_type.DynamicSerDe.deserialize(DynamicSerDe.java:124)
>
> at org.apache.hadoop.hive.jdbc.HiveResultSet.next(HiveResultSet.java:988)
>
> at com.apple.hive.MailLogQueryTest.testQuery(MailLogQueryTest.java:36)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at junit.framework.TestCase.runTest(TestCase.java:168)
>
> at junit.framework.TestCase.runBare(TestCase.java:134)
>
> at junit.framework.TestResult$1.protect(TestResult.java:110)
>
> at junit.framework.TestResult.runProtected(TestResult.java:128)
>
> at junit.framework.TestResult.run(TestResult.java:113)
>
> at junit.framework.TestCase.run(TestCase.java:124)
>
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
>
> at junit.framework.TestSuite.run(TestSuite.java:227)
>
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
>
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> 09/03/31 18:52:06 ERROR hive.MailLogQueryTest: java.sql.SQLException: Error
> retrieving next row
>
> On Tue, Mar 31, 2009 at 12:07 PM, Raghu Murthy <rm...@facebook.com> wrote:
>>
>> You need to specify a port only if you want to connect to a standalone
>> server. For instructions on starting the hive server see:
>> http://wiki.apache.org/hadoop/Hive/HiveServer
>>
>> For details on using JDBC in embedded mode or using it on a standalone
>> server see:
>> http://wiki.apache.org/hadoop/Hive/HiveClient
>>
>>
>> On 3/31/09 11:42 AM, "javateck javateck" <ja...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I'm trying to use jdbc to connect, and default is saying 10000 port in
>> > the org.apache.hadoop.hive.jdbc.HiveConnection, but I just don't see
>> > 10000
>> > port is open when I do netstat, and theTestJdbcDriver is throwing
>> > connection
>> > refuse exception when trying to open the connection. Even though a lot
>> > of jdbc
>> > interfaces are mot implemented on hive side, I just want to see what I
>> > can get
>> > from the sql query execution. And I don't know other easy alternative
>> > other
>> > than jdbc if I'm using java. And I don't see jdbc configurations
>> > anywhere
>> > either.
>> >
>> > Can someone shed some light on this?
>> >
>> > thanks
>>
>
>