You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Ron van der Vegt <ro...@openindex.io> on 2015/05/15 14:41:07 UTC
Trying to setup unittests to query phoenix test db but getting UnsupportedOperationException
Hello everyone,
I'm currently developing an Rest API which should query a phoenix table,
and return it in JSON. Currently have no issues with building this API,
but it would be really nice if I could write unittests with dummy data
to test our created API calls.
I was getting into the right direction, I hope, by extending the
BaseConnectionlessQueryTest class and setup a test database:
String ddl = "CREATE TABLE test (id VARCHAR not null primary key,
test_value CHAR(16)";
createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);
And it looks like I could also upsert some data:
Properties props = new Properties();
PhoenixConnection conn =
(PhoenixConnection)DriverManager.getConnection("jdbc:phoenix:none;test=true",
props);
PreparedStatement statement = conn.prepareStatement("UPSERT INTO
test(id) VALUES ('meh')");
statement.execute();
But when I want to select data:
PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
ResultSet rs = statement.executeQuery();
while (rs.next()) {
System.out.println(rs.getString("ID"));
}
I am get an UnsupportedOperationException. Could someone please explain
to me what I'm doing wrong, or that my use case is possible somehow?
Thanks in advice!
Ron
Re: Trying to setup unittests to query phoenix test db but getting
UnsupportedOperationException
Posted by Ron van der Vegt <ro...@openindex.io>.
Thanks! I will look into it.
On 05/15/2015 06:24 PM, James Taylor wrote:
> You'll want to derive from BaseHBaseManagedTimeIT. The
> BaseConnectionlessQueryTest class is for compile-time only or negative
> tests as it doesn't spin up any mini cluster.
>
> Thanks,
> James
>
> On Fri, May 15, 2015 at 5:41 AM, Ron van der Vegt
> <ro...@openindex.io> wrote:
>> Hello everyone,
>>
>> I'm currently developing an Rest API which should query a phoenix table, and
>> return it in JSON. Currently have no issues with building this API, but it
>> would be really nice if I could write unittests with dummy data to test our
>> created API calls.
>>
>> I was getting into the right direction, I hope, by extending the
>> BaseConnectionlessQueryTest class and setup a test database:
>>
>> String ddl = "CREATE TABLE test (id VARCHAR not null primary key, test_value
>> CHAR(16)";
>> createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);
>>
>> And it looks like I could also upsert some data:
>>
>> Properties props = new Properties();
>> PhoenixConnection conn =
>> (PhoenixConnection)DriverManager.getConnection("jdbc:phoenix:none;test=true",
>> props);
>> PreparedStatement statement = conn.prepareStatement("UPSERT INTO test(id)
>> VALUES ('meh')");
>> statement.execute();
>>
>> But when I want to select data:
>>
>> PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
>> ResultSet rs = statement.executeQuery();
>> while (rs.next()) {
>> System.out.println(rs.getString("ID"));
>> }
>>
>> I am get an UnsupportedOperationException. Could someone please explain to
>> me what I'm doing wrong, or that my use case is possible somehow?
>>
>> Thanks in advice!
>>
>> Ron
Re: Trying to setup unittests to query phoenix test db but getting UnsupportedOperationException
Posted by James Taylor <ja...@apache.org>.
You'll want to derive from BaseHBaseManagedTimeIT. The
BaseConnectionlessQueryTest class is for compile-time only or negative
tests as it doesn't spin up any mini cluster.
Thanks,
James
On Fri, May 15, 2015 at 5:41 AM, Ron van der Vegt
<ro...@openindex.io> wrote:
> Hello everyone,
>
> I'm currently developing an Rest API which should query a phoenix table, and
> return it in JSON. Currently have no issues with building this API, but it
> would be really nice if I could write unittests with dummy data to test our
> created API calls.
>
> I was getting into the right direction, I hope, by extending the
> BaseConnectionlessQueryTest class and setup a test database:
>
> String ddl = "CREATE TABLE test (id VARCHAR not null primary key, test_value
> CHAR(16)";
> createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);
>
> And it looks like I could also upsert some data:
>
> Properties props = new Properties();
> PhoenixConnection conn =
> (PhoenixConnection)DriverManager.getConnection("jdbc:phoenix:none;test=true",
> props);
> PreparedStatement statement = conn.prepareStatement("UPSERT INTO test(id)
> VALUES ('meh')");
> statement.execute();
>
> But when I want to select data:
>
> PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
> ResultSet rs = statement.executeQuery();
> while (rs.next()) {
> System.out.println(rs.getString("ID"));
> }
>
> I am get an UnsupportedOperationException. Could someone please explain to
> me what I'm doing wrong, or that my use case is possible somehow?
>
> Thanks in advice!
>
> Ron
Re: Trying to setup unittests to query phoenix test db but getting UnsupportedOperationException
Posted by Nick Dimiduk <nd...@gmail.com>.
Please include the full stack trace. Thanks.
On Fri, May 15, 2015 at 5:41 AM, Ron van der Vegt <
ron.van.der.vegt@openindex.io> wrote:
> Hello everyone,
>
> I'm currently developing an Rest API which should query a phoenix table,
> and return it in JSON. Currently have no issues with building this API, but
> it would be really nice if I could write unittests with dummy data to test
> our created API calls.
>
> I was getting into the right direction, I hope, by extending the
> BaseConnectionlessQueryTest class and setup a test database:
>
> String ddl = "CREATE TABLE test (id VARCHAR not null primary key,
> test_value CHAR(16)";
> createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);
>
> And it looks like I could also upsert some data:
>
> Properties props = new Properties();
> PhoenixConnection conn =
> (PhoenixConnection)DriverManager.getConnection("jdbc:phoenix:none;test=true",
> props);
> PreparedStatement statement = conn.prepareStatement("UPSERT INTO test(id)
> VALUES ('meh')");
> statement.execute();
>
> But when I want to select data:
>
> PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
> ResultSet rs = statement.executeQuery();
> while (rs.next()) {
> System.out.println(rs.getString("ID"));
> }
>
> I am get an UnsupportedOperationException. Could someone please explain to
> me what I'm doing wrong, or that my use case is possible somehow?
>
> Thanks in advice!
>
> Ron
>
Re: Trying to setup unittests to query phoenix test db but getting UnsupportedOperationException
Posted by James Taylor <ja...@apache.org>.
Hello,
A query like the following:
select * from <phoenix_table_name> limit 1000;
will apply a limit on the server side for each parallel scan being
done (using a PageFilter) and then also apply a limit on the client
side returning only the first 1000 rows.
Thanks,
James
On Fri, May 15, 2015 at 8:59 AM, Chagarlamudi, Prasanth
<pr...@epsilon.com> wrote:
> Hello,
> I would appreciate if someone could help with my question regarding pheonix's functionality.
>
> Created a phoenix table and inserted 100,000 records(assume these are spread across different regions).
> Now, when I issue a select query with a limit n..something like this
> select * from <phoenix_table_name> limit 1000;
> What would be phoenix's behavior?
> -Does it read the all the data(from all the region servers) on side server side, then apply limit to dataset and send the 1000 records to the client?
> or
> -Does it bring all the data set to the client and then apply the limit?
>
> Thanks in advance
> Prasanth Chagarlamudi
>
>
>
> ________________________________
>
> This e-mail and files transmitted with it are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you are not one of the named recipient(s) or otherwise have reason to believe that you received this message in error, please immediately notify sender by e-mail, and destroy the original message. Thank You.
RE: Trying to setup unittests to query phoenix test db but getting
UnsupportedOperationException
Posted by "Chagarlamudi, Prasanth" <pr...@epsilon.com>.
Hello,
I would appreciate if someone could help with my question regarding pheonix's functionality.
Created a phoenix table and inserted 100,000 records(assume these are spread across different regions).
Now, when I issue a select query with a limit n..something like this
select * from <phoenix_table_name> limit 1000;
What would be phoenix's behavior?
-Does it read the all the data(from all the region servers) on side server side, then apply limit to dataset and send the 1000 records to the client?
or
-Does it bring all the data set to the client and then apply the limit?
Thanks in advance
Prasanth Chagarlamudi
________________________________
This e-mail and files transmitted with it are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you are not one of the named recipient(s) or otherwise have reason to believe that you received this message in error, please immediately notify sender by e-mail, and destroy the original message. Thank You.