Bug Description
After Tdengine is upgraded from 3.1.1.0 to 3.3.3.0, an error is reported in the original correct query SQL statement. The SQL syntax is correct,The error message is displayed: Parser internal error
An error is reported in the SQL statement:
select groupId,start_time,end_time,device_id,sum(value) asvaluefrom( select 1297874473749565440 as groupId,_wstart as start_time,_wend as end_time,device_id, sum( CASE WHEN ts>=0 and ts < 12600000 THEN e_value * '2.0000000000' WHEN ts>=12600000 and ts < 41400000 THEN e_value * '3.0000000000' WHEN ts>=41400000 and ts < 57540000 THEN e_value * '4.0000000000' WHEN ts>=57600000 and ts < 68400000 THEN e_value * '1.0000000000' WHEN ts>=68400000 and ts < 86340000 THEN e_value * '2.0000000000' ELSE 0 end) asvalue from taiot.energy_data where (collect_date_time >= 1727712000000 and collect_date_time < 1730390400000 ) and e_value is not null and project_id = '1295391763945324544' and device_id in ('szsb1') partition by device_id interval(1n) ) as t1 group by groupId,start_time,end_time,device_id;
Expected Behavior
Correct query
Environment (please complete the following information):
Bug Description After Tdengine is upgraded from 3.1.1.0 to 3.3.3.0, an error is reported in the original correct query SQL statement. The SQL syntax is correct,The error message is displayed: Parser internal error
To Reproduce
CREATE STABLE
energy_data(
collect_date_timeTIMESTAMP ENCODE 'delta-i' COMPRESS 'lz4' LEVEL 'medium',
collect_valueDOUBLE ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium',
e_valueDOUBLE ENCODE 'delta-d' COMPRESS 'lz4' LEVEL 'medium',
repair_numberSMALLINT ENCODE 'simple8b' COMPRESS 'lz4' LEVEL 'medium',
is_checkBOOL ENCODE 'bit-packing' COMPRESS 'lz4' LEVEL 'medium',
is_supplementBOOL ENCODE 'bit-packing' COMPRESS 'lz4' LEVEL 'medium',
tsBIGINT ENCODE 'simple8b' COMPRESS 'lz4' LEVEL 'medium') TAGS (
device_idNCHAR(36),
project_idNCHAR(36))
select groupId,start_time,end_time,device_id,sum(
value) as
valuefrom( select 1297874473749565440 as groupId,_wstart as start_time,_wend as end_time,device_id, sum( CASE WHEN ts>=0 and ts < 12600000 THEN e_value * '2.0000000000' WHEN ts>=12600000 and ts < 41400000 THEN e_value * '3.0000000000' WHEN ts>=41400000 and ts < 57540000 THEN e_value * '4.0000000000' WHEN ts>=57600000 and ts < 68400000 THEN e_value * '1.0000000000' WHEN ts>=68400000 and ts < 86340000 THEN e_value * '2.0000000000' ELSE 0 end) as
valuefrom taiot.energy_data where (collect_date_time >= 1727712000000 and collect_date_time < 1730390400000 ) and e_value is not null and project_id = '1295391763945324544' and device_id in ('szsb1') partition by device_id interval(1n) ) as t1 group by groupId,start_time,end_time,device_id;
Expected Behavior Correct query
Environment (please complete the following information):