You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Stan Campbell <st...@gmail.com> on 2014/03/12 23:39:51 UTC
Database Metadata; getTables; NPE
Doing
val rs = meta.getTables(null, null, "%", null)
results in the following (see below). Looks like the ResultTuple.result
field is null in the return, so it gives a NPE when the REPL tries to print
it out.
Is it expected that database metadata's getTables should behave properly?
2014-03-12 15:36:20 DEBUG RpcClient:1070 - IPC Client (1769005174)
connection to Fenrir/127.0.1.1:60020 from scampbell: got response header
call_id: 10, totalSize: 1758 bytes
java.lang.NullPointerException
at org.apache.phoenix.schema.tuple.ResultTuple.toString(ResultTuple.java:64)
at java.lang.String.valueOf(String.java:2854)
at java.lang.StringBuilder.append(StringBuilder.java:128)
at
org.apache.phoenix.jdbc.PhoenixResultSet.toString(PhoenixResultSet.java:1236)
at
scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:324)
at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:329)
at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:337)
at .<init>(<console>:10)
at .<clinit>(<console>)
at $print(<console>)
Re: Database Metadata; getTables; NPE
Posted by Stan Campbell <st...@gmail.com>.
Thanks, James. I think it's just a side effect of using the REPL.. at
least that's why it surfaced. PheonixResultSet is initialized with
BEFORE_FIRST which is an empty ResultTuple. If we try to toString it,
since result is null, it throws a NPE at
if(this.result.isEmpty())...
I'll file a ticket. I added the check for null and "<<EMPTY>>" result of
toString, and it's happy now.
-- Stan
On Wed, Mar 12, 2014 at 3:48 PM, James Taylor <ja...@apache.org>wrote:
> Hi Stan,
> Definitely a bug. Would you mind filing a JIRA for us? To work around this
> (and assuming you want to get back a list of all tables), use null for all
> the args.
> Thanks,
> James
>
>
> On Wed, Mar 12, 2014 at 3:39 PM, Stan Campbell <st...@gmail.com>wrote:
>
>> Doing
>>
>> val rs = meta.getTables(null, null, "%", null)
>>
>> results in the following (see below). Looks like the ResultTuple.result
>> field is null in the return, so it gives a NPE when the REPL tries to print
>> it out.
>>
>> Is it expected that database metadata's getTables should behave properly?
>>
>> 2014-03-12 15:36:20 DEBUG RpcClient:1070 - IPC Client (1769005174)
>> connection to Fenrir/127.0.1.1:60020 from scampbell: got response header
>> call_id: 10, totalSize: 1758 bytes
>>
>> java.lang.NullPointerException
>>
>> at
>> org.apache.phoenix.schema.tuple.ResultTuple.toString(ResultTuple.java:64)
>>
>> at java.lang.String.valueOf(String.java:2854)
>>
>> at java.lang.StringBuilder.append(StringBuilder.java:128)
>>
>> at
>> org.apache.phoenix.jdbc.PhoenixResultSet.toString(PhoenixResultSet.java:1236)
>>
>> at
>> scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:324)
>>
>> at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:329)
>>
>> at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:337)
>>
>> at .<init>(<console>:10)
>>
>> at .<clinit>(<console>)
>>
>> at $print(<console>)
>>
>>
>>
>>
>
Re: Database Metadata; getTables; NPE
Posted by James Taylor <ja...@apache.org>.
Hi Stan,
Definitely a bug. Would you mind filing a JIRA for us? To work around this
(and assuming you want to get back a list of all tables), use null for all
the args.
Thanks,
James
On Wed, Mar 12, 2014 at 3:39 PM, Stan Campbell <st...@gmail.com>wrote:
> Doing
>
> val rs = meta.getTables(null, null, "%", null)
>
> results in the following (see below). Looks like the ResultTuple.result
> field is null in the return, so it gives a NPE when the REPL tries to print
> it out.
>
> Is it expected that database metadata's getTables should behave properly?
>
> 2014-03-12 15:36:20 DEBUG RpcClient:1070 - IPC Client (1769005174)
> connection to Fenrir/127.0.1.1:60020 from scampbell: got response header
> call_id: 10, totalSize: 1758 bytes
>
> java.lang.NullPointerException
>
> at
> org.apache.phoenix.schema.tuple.ResultTuple.toString(ResultTuple.java:64)
>
> at java.lang.String.valueOf(String.java:2854)
>
> at java.lang.StringBuilder.append(StringBuilder.java:128)
>
> at
> org.apache.phoenix.jdbc.PhoenixResultSet.toString(PhoenixResultSet.java:1236)
>
> at
> scala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:324)
>
> at scala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:329)
>
> at scala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:337)
>
> at .<init>(<console>:10)
>
> at .<clinit>(<console>)
>
> at $print(<console>)
>
>
>
>