diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index 778e4396714f904a33180f63a2d0026722f3a37f..31b7f92d39452f89cb87e1ee04ca6c832e394ff9 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -2643,10 +2643,12 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SDataStatis *pDataStatis, int32_t SDataStatis* pDataBlockst = &pDataStatis[index]; void *minVal, *maxVal; + float minv = 0; + float maxv = 0; if (cunit->dataType == TSDB_DATA_TYPE_FLOAT) { - float minv = (float)(*(double *)(&pDataBlockst->min)); - float maxv = (float)(*(double *)(&pDataBlockst->max)); + minv = (float)(*(double *)(&pDataBlockst->min)); + maxv = (float)(*(double *)(&pDataBlockst->max)); minVal = &minv; maxVal = &maxv; @@ -3263,10 +3265,12 @@ bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t num SDataStatis* pDataBlockst = &pDataStatis[index]; SFilterRangeNode *r = ctx->rs; + float minv = 0; + float maxv = 0; if (ctx->type == TSDB_DATA_TYPE_FLOAT) { - float minv = (float)(*(double *)(&pDataBlockst->min)); - float maxv = (float)(*(double *)(&pDataBlockst->max)); + minv = (float)(*(double *)(&pDataBlockst->min)); + maxv = (float)(*(double *)(&pDataBlockst->max)); minVal = &minv; maxVal = &maxv; diff --git a/tests/script/general/parser/condition.sim b/tests/script/general/parser/condition.sim index d5e18eaf36b1a3d11ec9f429049a7c4214a22630..96cd1e80bd01ad6ffa197ccbe8c58ce6474f3339 100644 --- a/tests/script/general/parser/condition.sim +++ b/tests/script/general/parser/condition.sim @@ -204,8 +204,6 @@ sleep 100 run general/parser/condition_query.sim run general/parser/condition_query2.sim - - sql drop database if exists cdb diff --git a/tests/script/general/parser/condition_query.sim b/tests/script/general/parser/condition_query.sim index 196530b443a7a0825e0b5a11e51ef0cf435a1857..c4b8de2a4b32ab8c8f152cef52c202683cf4bbe1 100644 --- a/tests/script/general/parser/condition_query.sim +++ b/tests/script/general/parser/condition_query.sim @@ -32,6 +32,15 @@ sql_error select * from stb1 where c4 != 'null'; sql_error select * from stb1 where c5 >= 'null'; sql_error select * from stb1 where c6 <= 'null'; sql_error select * from stb1 where c7 < 'nuLl'; +sql_error select * from stb1 where c1 match '.*'; +sql_error select * from stb1 where c2 match '.*'; +sql_error select * from stb1 where c3 match '.*'; +sql_error select * from stb1 where c4 match '.*'; +sql_error select * from stb1 where c5 match '.*'; +sql_error select * from stb1 where c6 match '.*'; +sql_error select * from stb1 where c7 match '.*'; +sql_error select * from stb1 where c9 match '.*'; +sql_error select * from stb1 where ts match '.*'; sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b; sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60; @@ -2232,3 +2241,77 @@ endi if $data50 != @21-05-05 18:19:28.000@ then return -1 endi + +sql select * from stb1 where c8 match '^1.*'; +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:05.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:06.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:07.000@ then + return -1 +endi + +sql select * from stb1 where c8 match '1.*'; +if $rows != 10 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:05.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:06.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:07.000@ then + return -1 +endi +if $data50 != @21-05-05 18:19:08.000@ then + return -1 +endi +if $data60 != @21-05-05 18:19:12.000@ then + return -1 +endi +if $data70 != @21-05-05 18:19:16.000@ then + return -1 +endi +if $data80 != @21-05-05 18:19:20.000@ then + return -1 +endi +if $data90 != @21-05-05 18:19:24.000@ then + return -1 +endi + +sql select * from stb1 where c8 match '1.+'; +if $rows != 4 then + return -1 +endi +if $data00 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:05.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:06.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:07.000@ then + return -1 +endi + + diff --git a/tests/script/general/parser/condition_query2.sim b/tests/script/general/parser/condition_query2.sim index 77d222022ff1fb35e015c933b6e54be010481a7d..e20c85540e6b0cab3bd0acf82d01068f24d467c6 100644 --- a/tests/script/general/parser/condition_query2.sim +++ b/tests/script/general/parser/condition_query2.sim @@ -589,8 +589,50 @@ if $data70 != @21-05-05 18:19:15.000@ then return -1 endi -print "tag test" +sql select ts,c1,t9,t10,tbname from stb5 where tbname match '^3'; +if $rows != 0 then + return -1 +endi +sql select ts,c1,t9,t10,tbname from stb5 where tbname match 'tb.?_[34]'; +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:12.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:13.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:14.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:15.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:16.000@ then + return -1 +endi +if $data50 != @21-05-05 18:19:17.000@ then + return -1 +endi +if $data60 != @21-05-05 18:19:18.000@ then + return -1 +endi +if $data70 != @21-05-05 18:19:19.000@ then + return -1 +endi + +print "tag test" +sql_error select * from stb5 where t1 match '.*'; +sql_error select * from stb5 where t2 match '.*'; +sql_error select * from stb5 where t3 match '.*'; +sql_error select * from stb5 where t4 match '.*'; +sql_error select * from stb5 where t5 match '.*'; +sql_error select * from stb5 where t6 match '.*'; +sql_error select * from stb5 where t7 match '.*'; +sql_error select * from stb5 where t8 match '.*'; +sql_error select * from stb5 where t10 match '.*'; sql_error select * from tb1 where t1 in (1,2) and t1 in (2,3); sql select * from stb1 where t1 in (1,2) and t1 in (2,3); @@ -1179,6 +1221,61 @@ if $rows != 22 then return -1 endi +sql select ts,c1,t9,t10 from stb5 where t9 match '1.+'; +if $rows != 8 then + return -1 +endi +if $data00 != @21-05-05 18:19:00.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:01.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:02.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:03.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:04.000@ then + return -1 +endi +if $data50 != @21-05-05 18:19:05.000@ then + return -1 +endi +if $data60 != @21-05-05 18:19:06.000@ then + return -1 +endi +if $data70 != @21-05-05 18:19:07.000@ then + return -1 +endi + +sql select ts,c1,t9,t10 from stb5 where t9 match '[3-9]'; +if $rows != 22 then + return -1 +endi + +sql select ts,c1,t9,t10 from stb5 where t9 match '8.*'; +if $rows != 5 then + return -1 +endi +if $data00 != @21-05-05 18:19:34.000@ then + return -1 +endi +if $data10 != @21-05-05 18:19:35.000@ then + return -1 +endi +if $data20 != @21-05-05 18:19:36.000@ then + return -1 +endi +if $data30 != @21-05-05 18:19:37.000@ then + return -1 +endi +if $data40 != @21-05-05 18:19:38.000@ then + return -1 +endi + + print "join test" sql_error select * from tb1, tb2_1 where tb1.ts=tb2_1.ts or tb1.ts =tb2_1.ts; diff --git a/tests/script/general/parser/condition_query3.sim b/tests/script/general/parser/condition_query3.sim index bf025614fb2ecc36da40cdef3767344b64356b68..2993d642e74231d387b85efd70f5488f5c338d98 100644 --- a/tests/script/general/parser/condition_query3.sim +++ b/tests/script/general/parser/condition_query3.sim @@ -42,6 +42,9 @@ if $rows != 4 then return -1 endi +sql select tbname,t1 from stba where t1 is null; +sql select tbname,t1 from stba where t1 is not null; + sql_error select tbname,t1 from stbb where t1 > true; sql select tbname,t1 from stbb where t1 = true; if $rows != 5 then @@ -53,6 +56,10 @@ if $rows != 5 then return -1 endi +sql select tbname,t1 from stbb where t1 is null; +sql select tbname,t1 from stbb where t1 is not null; + + sql select tbname,t1 from stbc; if $rows != 10 then return -1 @@ -93,6 +100,9 @@ if $rows != 4 then return -1 endi +sql select tbname,t1 from stbc where t1 is null; +sql select tbname,t1 from stbc where t1 is not null; + sql select tbname,t1 from stbd where t1 > '2222'; if $rows != 7 then return -1 @@ -128,6 +138,9 @@ if $rows != 4 then return -1 endi +sql select tbname,t1 from stbd where t1 is null; +sql select tbname,t1 from stbd where t1 is not null; + sql select tbname,t1 from stbe where t1 > '2222'; if $rows != 7 then return -1 @@ -163,4 +176,7 @@ if $rows != 4 then return -1 endi +sql select tbname,t1 from stbe where t1 is null; +sql select tbname,t1 from stbe where t1 is not null; + #system sh/exec.sh -n dnode1 -s stop -x SIGINT