StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.03k stars 1.82k forks source link

自定义变量引起的Not implement toSqlImpl function #46589

Closed Oloong closed 3 weeks ago

Oloong commented 5 months ago

Steps to reproduce the behavior (Required)

CREATE TABLE `dim_mv_wd` (
  `mvname` varchar(65533) NOT NULL COMMENT "mv的名称",
  `tbname` varchar(65533) NULL COMMENT "主表名",
  `colname` varchar(65533) NULL COMMENT "主列名",
  `svalue` varchar(65533) NULL COMMENT "开始值,一次刷新的开始值,如:开始时间,起始时间为上次结束时间+1(秒),DWD MV宽表增量更新,手动批量更新, 为NULL 取1701-01-01 进行全量更新,时间格式统一为标准格式:2023-08-15 22:57:01 ",
  `evalue` varchar(65533) NULL COMMENT "结束值,一次刷新的结束值,如:结束时间,DWD MV宽表增量更新,手动批量更新,为NULL 取NOW() 时间格式统一为标准格式:2023-08-15 22:57:01",
  `vals` array<varchar(65533)> NULL COMMENT "增量队列(适用于统计dws/ads MV):通常指影响统计的日期,去重排序",
  `isok` tinyint(4) NULL DEFAULT "0" COMMENT "当前日期范围是否成功物化0:否,1:成功",
  `gmt_update` datetime NULL COMMENT "更新时间"
) ENGINE=OLAP 
PRIMARY KEY(`mvname`)
COMMENT "物化视图增量窗口"
DISTRIBUTED BY HASH(`mvname`) BUCKETS 1 
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"enable_persistent_index" = "true",
"replicated_storage" = "true",
"compression" = "LZ4"
);
set @v_values=(select concat(ifnull(svalue,''),',',ifnull(evalue,''),',',ifnull(isok,0)) from dim.dim_mv_wd where mvname='dws.dws_tb_a_mv');
 set @v_svalue=if(split(@v_values,',')[1]='',NULL,split(@v_values,',')[1]);
 set @v_evalue=if(split(@v_values,',')[2]='',NULL,split(@v_values,',')[2]);
 set @v_isok=ifnull(split(@v_values,',')[3],0);
select @v_values,@v_svalue,@v_evalue,@v_isok;
insert into dim.dim_mv_wd(mvname,tbname,colname,svalue,evalue,vals,gmt_update)
select 'dws.dws_tb_a_mv','ods.ods_tb_b_rt','create_time',ifnull(min(ss_dt),@v_svalue),ifnull(max(ss_dt),@v_evalue),bitmap_to_array(bitmap_union(to_bitmap(date_format(create_time,'%Y%m%d')))),now() from ods.ods_tb_b_rt where ss_dt > ifnull(@v_evalue,date_sub(now(),interval 1 day));

执行失败,报> 1064 - Not implement toSqlImpl function,从2.5一路升级上来均运行正常,V3.2.7 运行失败! 将自定义变量,替换掉,运行正常。

Expected behavior (Required)

正常运行,不报错

Real behavior (Required)

1064 - Not implement toSqlImpl function

StarRocks version (Required)

V3.2.7

Oloong commented 5 months ago

表MVNAME可用此数据,其它ods表字段ss_dt datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT "SS更新时间戳",均为主键表。

INSERT INTO mvname(mvname, tbname, colname, svalue, evalue, vals, isok, gmt_update) VALUES ('dws.dws_tb_a_mv', 'ods.ods.ods_tb_b_rt', 'create_time', '2024-05-30 20:26:28', '2024-05-30 20:26:28', NULL, 0, '2024-05-30 20:50:10');