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);

还有……错误。

错误 38000: (SQLState=38000 Severity=-1) (Server=172.31.8.115[1528],Thread[DRDAConnThread_34,5,gemfirexd.daemons]) 异常 'Invalid input 'C', 预期 dmlOperation, insert, withIdentifier, select或放置(第 1 行,第 1 列): CREATE TABLE SENSOR_DATA_COL_BY_YEAR USING 列 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) ^; ' 在评估表达式时抛出。

4

1 回答 1

2

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,value,sensor_time,year AS year_num, month AS month_num from STAGING_1);

于 2016-08-04T06:02:47.600 回答