版本: 2.0.5 -rc 02
建表语句:
CREATE TABLE IF NOT EXISTS `ads_shipping_plan_offlineshop_is_split_shipping`
(
`current_date_p` DATE DEFAULT NULL ,
`groupOrderCode` VARCHAR(512) DEFAULT NULL ,
`source` VARCHAR(512) DEFAULT NULL ,
`storeName` VARCHAR(512) DEFAULT NULL ,
`buyerName` VARCHAR(512) DEFAULT NULL ,
`consigneeMobile` VARCHAR(512) DEFAULT NULL ,
`deliveryModeCode` VARCHAR(512) DEFAULT NULL ,
`fullAddress` VARCHAR(512) DEFAULT NULL ,
`planDeliveryAt` DATETIMEV2 DEFAULT NULL ,
`predictArriveDay` BIGINT(20) DEFAULT NULL ,
`orderStatus` VARCHAR(512) DEFAULT NULL ,
`channelOrderStatus` VARCHAR(512) DEFAULT NULL ,
`mobileConfirmDesc` VARCHAR(1024) DEFAULT NULL ,
`is_split_shipping` VARCHAR(512) DEFAULT NULL ,
`level3_sku_num` STRING DEFAULT NULL
) ENGINE = OLAP DUPLICATE KEY(`current_date_p`,`groupOrderCode`,`source`,`storeName`,`buyerName` )
COMMENT ""
PARTITION BY RANGE(`current_date_p`)
(
FROM ("2024-07-27") TO ("2025-07-27") INTERVAL 1 DAY
)
DISTRIBUTED BY HASH(`groupOrderCode`) BUCKETS 16
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"in_memory" = "false",
"storage_format" = "V2",
"light_schema_change" = "true"
);
执行插入语句:
INSERT OVERWRITE TABLE ads_shipping_plan_offlineshop_is_split_shipping partition (p20240727)
WITH LABEL `label1`
(
`current_date_p`, `groupOrderCode`, `source`, `storeName`, `buyerName`, `consigneeMobile`, `deliveryModeCode`, `fullAddress`, `planDeliveryAt`, `predictArriveDay`, `orderStatus`, `channelOrderStatus`, `mobileConfirmDesc`, `is_split_shipping`, `level3_sku_num`
)
WITH t1 AS (
SELECT
CURRENT_DATE() as current_date_p,
'1' as `groupOrderCode` ,
'1' as `source` ,
'1' as `storeName` ,
'1' as `buyerName` ,
'1' as `consigneeMobile` ,
'1' as `deliveryModeCode` ,
'1' as `fullAddress` ,
CURRENT_DATE() as `planDeliveryAt` ,
'1' as `predictArriveDay` ,
'1'as `orderStatus` ,
'1'as `channelOrderStatus` ,
'1'as `mobileConfirmDesc` ,
'1'as `is_split_shipping` ,
'1'as `level3_sku_num`
FROM sales
), t2 AS (
SELECT * FROM t1
)
SELECT *
FROM t2;
执行报错:
[HY000][1105] errCode = 2, detailMessage = Syntax error in line 26: ) ^ Encountered: EOF Expected: COMMA
报错时因为,的原因但是我感觉和insert overwrite 这个语句有关
如果注掉insert overwrite 这行表达式的话会正常执行,但是一旦执行写入,就会报错
/*INSERT OVERWRITE TABLE ads_shipping_plan_offlineshop_is_split_shipping partition (p20240727)
WITH LABEL `label1`
(
`current_date_p`, `groupOrderCode`, `source`, `storeName`, `buyerName`, `consigneeMobile`, `deliveryModeCode`, `fullAddress`, `planDeliveryAt`, `predictArriveDay`, `orderStatus`, `channelOrderStatus`, `mobileConfirmDesc`, `is_split_shipping`, `level3_sku_num`
)*/
WITH t1 AS (
SELECT
CURRENT_DATE() as current_date_p,
'1' as `groupOrderCode` ,
'1' as `source` ,
'1' as `storeName` ,
'1' as `buyerName` ,
'1' as `consigneeMobile` ,
'1' as `deliveryModeCode` ,
'1' as `fullAddress` ,
CURRENT_DATE() as `planDeliveryAt` ,
'1' as `predictArriveDay` ,
'1'as `orderStatus` ,
'1'as `channelOrderStatus` ,
'1'as `mobileConfirmDesc` ,
'1'as `is_split_shipping` ,
'1'as `level3_sku_num`
FROM sales
), t2 AS (
SELECT * FROM t1
)
SELECT *
FROM t2;
看文档没有看到insert overwrite CTE 的写法,
请问应该怎么修改才是正确的呢?