Forum: Building VoltDB Applications

Post: Need help for Creating Partition in voltDB

Need help for Creating Partition in voltDB
M_A_K687
Sep 11, 2013
Hi,

i created procedure by using this command

"CREATE PROCEDURE procedures.Users.findAll AS SELECT * FROM users;"

instead of class file now i want to create partition by these type PROCEDURE can anyone please help me to achieve this goal.

let say i am using this command for creating partition

CREATE PROCEDURE procedures.Users.FetchUsers AS
SELECT * FROM USERS WHERE user_id=?;
PARTITION PROCEDURE procedures.Users.FetchUsers
ON TABLE Users COLUMN user_id;

i get following error don't know why

2013-09-11 04:40:26,852 ERROR [main] COMPILER: [null]: VoltDB DDL Error: "Invalid PARTITION statement: "PARTITION PROCEDURE procedures.Users.FetchUsers ON TABLE Users COLUMN user_id", expected syntax: PARTITION PROCEDURE <procedure> ON TABLE <table> COLUMN <column> [PARAMETER <parameter-index-no>]" in statement starting on lineno: 69
2013-09-11 04:40:26,853 ERROR [main] COMPILER: Failed to compile XML
2013-09-11 04:40:26,853 ERROR [main] COMPILER: Catalog compilation failed.
rbetts
Sep 11, 2013
Hi,

i created procedure by using this command

"CREATE PROCEDURE procedures.Users.findAll AS SELECT * FROM users;"

instead of class file now i want to create partition by these type PROCEDURE can anyone please help me to achieve this goal.

let say i am using this command for creating partition

CREATE PROCEDURE procedures.Users.FetchUsers AS
SELECT * FROM USERS WHERE user_id=?;
PARTITION PROCEDURE procedures.Users.FetchUsers
ON TABLE Users COLUMN user_id;

i get following error don't know why

2013-09-11 04:40:26,852 ERROR [main] COMPILER: [null]: VoltDB DDL Error: "Invalid PARTITION statement: "PARTITION PROCEDURE procedures.Users.FetchUsers ON TABLE Users COLUMN user_id", expected syntax: PARTITION PROCEDURE <procedure> ON TABLE <table> COLUMN <column> [PARAMETER <parameter-index-no>]" in statement starting on lineno: 69
2013-09-11 04:40:26,853 ERROR [main] COMPILER: Failed to compile XML
2013-09-11 04:40:26,853 ERROR [main] COMPILER: Catalog compilation failed.



Perhaps our dev-center recipe on partitioning will help you here:
http://voltdb.com/dev-center/cookbook/configuring-partitioning/

That article also links to the Using VoltDB documentation guide to help find the appropriate online docs.
pmartel
Sep 11, 2013
The problem might just be with the embedded "."s in the name. Try:

CREATE PROCEDURE FetchUsers AS
SELECT * FROM USERS WHERE user_id=?;

PARTITION PROCEDURE FetchUsers
ON TABLE Users COLUMN user_id;
vtkstef
Sep 11, 2013
Procedure names on partition statements don't accept package name prefix
so please try the following

CREATE PROCEDURE procedures.Users.FetchUsers AS
SELECT * FROM USERS WHERE user_id=?;
PARTITION PROCEDURE FetchUsers
ON TABLE Users COLUMN user_id;

Ciao
Stefano