2016-07-16 31 views
0

我試圖實現cassandra SE和MariaDB的互操作性。在cqlsh中,我可以使用複合鍵創建表格。當我在mariadb中嘗試相同時,出現錯誤ERROR 1070 (42000): Too many key parts specified; max 1 parts allowed。 這是我代碼,我在cqlsh使用:指定的關鍵部件過多; max 1部分允許cassandra引擎和mariadb

cqlsh:mariadbtest> create table test (test1 int, test2 bigint, test3 varchar, primary key (test1, test2)) with compact STORAGE; 

Mariadb

MariaDB [test]> set global cassandra_default_thrift_host='localhost'; 

MariaDB [test]> create table random (test1 int(5), test2 bigint(5), test3 varchar(20), PRIMARY KEY (test1, test2)) engine=cassandra keyspace='historian' thrift_host='localhost' column_family='test'; 
ERROR 1070 (42000): Too many key parts specified; max 1 parts allowed 

當我使用單列作爲我的主鍵,它工作正常,沒有錯誤。請幫助我解決組合鍵問題。 任何幫助,將不勝感激。

回答

0

這在存儲引擎中不受支持。按照docs

注:多列主鍵目前不支持。支持可能會在未來版本中添加,具體取決於是否有需求。

目前還不清楚您是否可以定義組合分區密鑰(即PRIMARY KEY ((test1, test2)))。我也不確定這甚至會滿足你的需求。這聽起來像你應該聲明你的興趣,如果這是你所需要的。

+0

我試過複合分區密鑰,我得到了同樣的錯誤。是的,我需要它用於我的桌子。你能否給我提供一個關於如何在cassandra SE和MySQL上使用組合鍵的例子。 – user2782405