我无法找出对我的'列进行分区的语法。表。这是一个失败的例子以及它的许多变化。
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) (服务器= 172.31.8.115 [1528],线程[DRDAConnThread_34,5,gemfirexd.daemons]) 例外'无效输入' C',预期dmlOperation,插入, withIdentifier,select或put(第1行,第1列):CREATE TABLE SENSOR_DATA_COL_BY_YEAR使用列选项(PARTITION_BY year_num,buckets' 11')AS(选择 sensor_id,metric,collection_time,value,sensor_time,year AS year_num, 月份AS月号来自STAGING_1)^;'在评估时被抛出 表达
答案 0 :(得分:2)
列名应该在引号" 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来自STAGING_1);