Forum: Other

Post: Unable to plan for statement. Error unknown

Unable to plan for statement. Error unknown
hayatoa
Dec 1, 2011
I tried to use a simple join on a helloworld example, but it gives me unknown error.
All the required codes except Client.java are listed in a "Getting Started With VoltDB" manual.
Getting Started
Page 25 - 27

I just added following lines to Client.java. Basically, I tries to join helloworld table with helloworld table. As long as I see from "select rule" in "http://community.voltdb.com/docs/UsingVoltDB/sqlref_select", I should be able to join tables.
Why can I not join tables???
/*
FOLLOWING LINE GIVES ERRORS

Exception in thread "main" org.voltdb.client.ProcCallException: Unable to plan for statement. Error unknown.
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:218)
at Client.main(Client.java:37)
*/
ClientResponse response2 = myApp.callProcedure("@AdHoc", "select * from helloworld as a, helloworld as b limit 10 ");
VoltTable results2[] = response2.getResults();
System.out.println(results2[0].fetchRow(0).getString(0));
Following is Client.java code.
import org.voltdb.client.*;
public class Client {
public static void main(String[] args) throws Exception {
/*
* Instantiate a client and connect to the database.
*/
org.voltdb.client.Client myApp;
myApp = ClientFactory.createClient();
myApp.createConnection("localhost");
/*
* Load the database.
*/
// myApp.callProcedure("Insert", "Hello", "World", "English");
// myApp.callProcedure("Insert", "Bonjour", "Monde", "French");
// myApp.callProcedure("Insert", "Hola", "Mundo", "Spanish");
// myApp.callProcedure("Insert", "Hej", "Verden", "Danish");
// myApp.callProcedure("Insert", "Ciao", "Mondo", "Italian");
/*
* Retrieve the message.
*/
final ClientResponse response = myApp.callProcedure("Select",
"Spanish");
if (response.getStatus() != ClientResponse.SUCCESS){
System.err.println(response.getStatusString());
System.exit(-1);
}
final VoltTable results[] = response.getResults();
if (results.length == 0 || results[0].getRowCount() != 1) {
System.out.printf("I can't say Hello in that language.
");
System.exit(-1);
}
VoltTable resultTable = results[0];
VoltTableRow row = resultTable.fetchRow(0);
System.out.printf("%s, %s!
", row.getString("hello"),
row.getString("world"));

/*
FOLLOWING LINE GIVES ERRORS

Exception in thread "main" org.voltdb.client.ProcCallException: Unable to plan for statement. Error unknown.
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:218)
at Client.main(Client.java:37)
*/
ClientResponse response2 = myApp.callProcedure("@AdHoc",
"select * from helloworld as a, helloworld as b limit 10 ");
VoltTable results2[] = response2.getResults();
System.out.println(results2[0].fetchRow(0).getString(0));
}
}
VoltDB does not support self
rbetts
Dec 1, 2011
VoltDB does not support self joins or joins of two partitioned tables. We have plans to support equi-joins on partitioned tables on partition key columns - that work is in our backlog for prioritization.

Is there a particular problem you are trying to solve? Perhaps we can help formulate a solution or help you to determine the appropriateness of VoltDB to your project.

Ryan.
question about use case
hayatoa
Dec 2, 2011
VoltDB does not support self joins or joins of two partitioned tables. We have plans to support equi-joins on partitioned tables on partition key columns - that work is in our backlog for prioritization.
Ryan.


Thanks Ryan!
> VoltDB does not support self joins or joins of two partitioned tables
Ok. If i need to do self join or joins of two partitioned tables, I guess I need to receives data from each table and perform joins outside of voltdb.

> Is there a particular problem you are trying to solve? Perhaps we can help formulate a solution or help you to determine the appropriateness of VoltDB to your project.

I would like to know if VoltDB is appropriate for our use case.

Our project requires the real-time analysis in which data is small enough to fit in memory.

We consider it would be ideal if data can be hosted in memory and do some processing data (via such as mapreduce or sql).

VoltDB allows us to store data in memory and do processing with sql which I am familiar to. Other database such as membase/redis do not have much processing capability.

Our data consists of item's name, and timestamp in which item is accessed.
Most of current tasks is counting items by specifying timestamp range, and show which item is frequently accessed for particular time, example.

Currently data is partition by item name/id.

In our application, insert is heavy, but read is not heavy. Transaction is not important. We just need rough idea which item is popular on real time.

Transaction seems to be strength in VoltDB but I do not need it.

If I am simply counting item via non-single partition stored procedure, VoltDB may not be right solution to me.

I could call many singled partition stored procedure query but I am not sure if this is right approach.

Say if I have 1000 items and I can perform non-singled partition stored procedure once, or I can run 1000 singled-partition queries.

Having plyaing with VoltDB, in which way should I access to data?

Also, if data is partition by item name, and supposedly data is evenly distributed.

Then non-singled partition stored procedure query should not be slow? since task each thread/cpu needs to perform is approximately same even there would be communication over partitions ?

Hayato.
Your description matches common uses of VoltDB
rbetts
Dec 2, 2011
Thanks Ryan!

Ok. If i need to do self join or joins of two partitioned tables, I guess I need to receives data from each table and perform joins outside of voltdb....
Hayato.


What you describe sounds similar to the kinds of problems people use VoltDB to solve. You should arrange your schema and partitioning such that the inserts are single partition procedures (assuming the inserts happen much more frequently than the reads).

The reads can be multi-partition procedures. If, however, you have too many multi-part reads to scale (usually >2000 / sec, but this varies), we can show you how to execute one read per-partition (this would likely be 10's of reads, not 1000's).

If you haven't already, look at the examples/voter application in the voltdb distribution. That example accumulates votes for contestants and periodically tallies the votes to determine the popular contestant. You can also run that example by loading the "Click Here To Start.html" web page in the top level directory of the distribution.

Good luck - thanks for posting your questions.
Ryan.
Thank you for your reply,
hayatoa
Dec 4, 2011
What you describe sounds similar to the kinds of problems people use VoltDB to solve. You should arrange your schema and partitioning such that the inserts are single partition procedures (assuming the inserts happen much more frequently than the reads).

Good luck - thanks for posting your questions.
Ryan.


Thank you for your reply, Ryan.

I will take a look on example, you mentioned :)