如何在 SnappyData 中对列 table 中的数据进行分区?

How do I partition data in a column table in SnappyData?

我无法弄清楚对 'column' table 进行分区的语法。这是一个对我来说失败的例子以及它的许多变体。

CREATE TABLE SENSOR_DATA_COL_BY_YEAR USING column OPTIONS(PARTITION_BY year_num, buckets '11') AS (SELECT sensor_id,metric,collection_time,value,sensor_time,year AS year_num, month AS month_num from STAGING_1);

还有……错误。

ERROR 38000: (SQLState=38000 Severity=-1) (Server=172.31.8.115[1528],Thread[DRDAConnThread_34,5,gemfirexd.daemons]) The exception 'Invalid input 'C', expected dmlOperation, insert, withIdentifier, select or put (line 1, column 1): CREATE TABLE SENSOR_DATA_COL_BY_YEAR USING column OPTIONS(PARTITION_BY year_num, buckets '11') AS (SELECT sensor_id,metric,collection_time,value,sensor_time,year AS year_num, month AS month_num from STAGING_1) ^;' was thrown while evaluating an expression.

在 PARTITION_BY 子句中指定的列名应该用引号引起来 "year_num"

修改后的查询:

CREATE TABLE SENSOR_DATA_COL_BY_YEAR 使用列 OPTIONS(PARTITION_BY "year_num", buckets '11') AS (SELECT sensor_id,metric ,collection_time,值,sensor_time,年 AS year_num,月 AS month_num 来自 STAGING_1);