Forum: Other

Post: Newbie to VoltDB

Newbie to VoltDB
shanky05
Sep 2, 2014
I have couple of question:

1) how can we pass a dynamic value in the HAVING clause?

select msisdn,URL,sum(a.TOTAL) as totalCount from session_fact a NATURAL JOIN STATUSCODE_DIMENSION b NATURAL JOIN SUBSCRIBER_DIMENSION where b.IS_ERROR='YES' AND since_epoch(SECOND,STARTTIME)<since_epoch(SECOND,NOW) AND since_epoch(SECOND,STARTTIME)>(since_epoch(SECOND,NOW)-10) group by msisdn,url having sum(a.total) > 1

This is working as expected. But when i replace the hardcoded value in HVAING clause to "?" and pass this value at run time it is not working . Please let me know the solution.
ERROR: Unexpected having clause

2) There is one example of VoltDB HELLOWORLD. I ran it it worked perfectly fine. But when i removed the where clause from the select statement keeping rest of the things same it stopped working. Please let me know what am i doing wrong.
xin
Sep 2, 2014
I have couple of question:

1) how can we pass a dynamic value in the HAVING clause?

select msisdn,URL,sum(a.TOTAL) as totalCount from session_fact a NATURAL JOIN STATUSCODE_DIMENSION b NATURAL JOIN SUBSCRIBER_DIMENSION where b.IS_ERROR='YES' AND since_epoch(SECOND,STARTTIME)<since_epoch(SECOND,NOW) AND since_epoch(SECOND,STARTTIME)>(since_epoch(SECOND,NOW)-10) group by msisdn,url having sum(a.total) > 1

This is working as expected. But when i replace the hardcoded value in HVAING clause to "?" and pass this value at run time it is not working . Please let me know the solution.
ERROR: Unexpected having clause

Are you invoking this query in a stored procedure with question mark? For example, replacing the number 1 with question mark ? is expected to work with stored procedure. Which client are you using? SQLCommand, JDBC or something else?

2) There is one example of VoltDB HELLOWORLD. I ran it it worked perfectly fine. But when i removed the where clause from the select statement keeping rest of the things same it stopped working. Please let me know what am i doing wrong.


I am not aware of VoltDB HELLOWORLD example, do you mean Voter example? What kind of query do you have problem, can you put more details?

Again, which Version of VoltDB are you using?

Thanks,
Xin
xin
Sep 2, 2014
For your question 2, I just notice the HELLOWORLD example in the "doc" directory.

Because there is no parameters in your query after removing the where clause, user should not queue the sql with parameters. So you need to remove the query call, like "voltQueueSQL( sql );"

Again, because the stored procedure is partitioned and you remove the partitioning parameters, you may need to remove the partitioning statement in the ddl also. So you can remove remove "PARTITION PROCEDURE Select ON TABLE Helloworld COLUMN Dialect;"

FYI, you could also access our online study video at: http://voltdb.com/resources/voltdb-university/

Please let us know if it works for you.