Forum: Building VoltDB Applications

Post: Firing Ad-Hoc query using JDBC on partitioned table.

Firing Ad-Hoc query using JDBC on partitioned table.
sanket
Oct 26, 2016
Hi,
I am trying to fire the Ad-Hoc query on partitioned tables through JDBC and I got the following error-

The query is:
statement =con.prepareStatement("SELECT c_discount,c_last,c_credit,w_tax FROM customer,warehouse WHERE w_id=? AND c_w_id=? AND c_d_id=? AND c_id =?");
(where w_id is from warehouse table and all others are from customer table.)

ERROR:
java.sql.SQLException: General Provider Error (GRACEFUL_FAILURE): 'Unexpected Ad Hoc Planning Error: java.lang.RuntimeException: Error compiling query: org.voltdb.planner.PlanningErrorException: This query is not plannable. The planner cannot guarantee that all rows would be in a single partition.'
at org.voltdb.jdbc.SQLError.get(SQLError.java:60)
at org.voltdb.jdbc.JDBC4Statement$VoltSQL.execute(JDBC4Statement.java:143)
at org.voltdb.jdbc.JDBC4Statement.executeQuery(JDBC4Statement.java:458)
at org.voltdb.jdbc.JDBC4PreparedStatement.executeQuery(JDBC4PreparedStatement.java:123)
at voltdb_jdbc.main(voltdb_jdbc.java:52)
Caused by: org.voltdb.client.ProcCallException: Unexpected Ad Hoc Planning Error: java.lang.RuntimeException: Error compiling query: org.voltdb.planner.PlanningErrorException: This query is not plannable. The planner cannot guarantee that all rows would be in a single partition.
at org.voltdb.client.ClientImpl.callProcedure(ClientImpl.java:306)
at org.voltdb.client.ClientImpl.callProcedureWithClientTimeout(ClientImpl.java:260)
at org.voltdb.jdbc.JDBC4ClientConnection.execute(JDBC4ClientConnection.java:286)
at org.voltdb.jdbc.JDBC4Statement$VoltSQL.execute(JDBC4Statement.java:120)
... 3 more
bballard
Oct 26, 2016
In VoltDB you can do a join between a partitioned table and one or more replicated tables, or between two or more partitioned tables as long as you are joining on a common partition key.