diff --git a/src/query/inc/qFilter.h b/src/query/inc/qFilter.h index 3f34173d24954610860bed8f3d92b337d769c7a6..4ed30853e8fe430266de3a7055a4bb5734db231c 100644 --- a/src/query/inc/qFilter.h +++ b/src/query/inc/qFilter.h @@ -22,6 +22,7 @@ extern "C" { #include "texpr.h" #include "hash.h" +#include "tname.h" #define FILTER_DEFAULT_GROUP_SIZE 4 #define FILTER_DEFAULT_UNIT_SIZE 4 @@ -91,14 +92,14 @@ typedef struct SFilterColRange { SFilterRange ra; } SFilterColRange; +typedef bool (*rangeCompFunc) (const void *, const void *, const void *, const void *, __compar_fn_t); + typedef struct SFilterRangeCompare { int64_t s; int64_t e; rangeCompFunc func; } SFilterRangeCompare; -typedef bool (*rangeCompFunc) (const void *, const void *, const void *, const void *, __compar_fn_t); - typedef struct SFilterRangeNode { struct SFilterRangeNode* prev; struct SFilterRangeNode* next; @@ -294,6 +295,7 @@ extern int32_t filterConverNcharColumns(SFilterInfo* pFilterInfo, int32_t rows, extern int32_t filterFreeNcharColumns(SFilterInfo* pFilterInfo); extern void filterFreeInfo(SFilterInfo *info); extern bool filterIsEmptyRes(SFilterInfo *info); +extern bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t numOfCols, int32_t numOfRows); #ifdef __cplusplus } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 7d7dd858149d637a10844f8d40c36ab8dc77071b..34896babe934d5c38d02a476b42c0d4b7b80d4a7 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -2402,7 +2402,7 @@ static FORCE_INLINE bool doFilterByBlockStatistics(SQueryRuntimeEnv* pRuntimeEnv return true; } - return filterRangeExecute(pQueryAttr->pFilters, pDataStatis, numOfRows); + return filterRangeExecute(pQueryAttr->pFilters, pDataStatis, pQueryAttr->numOfCols, numOfRows); } static bool overlapWithTimeWindow(SQueryAttr* pQueryAttr, SDataBlockInfo* pBlockInfo) { diff --git a/src/query/src/qFilter.c b/src/query/src/qFilter.c index a02f284b88301a5c9ed70c79ea45d1e592baa9e4..7ee19e88b3e3f0432736fff68af1e39d09d49153 100644 --- a/src/query/src/qFilter.c +++ b/src/query/src/qFilter.c @@ -57,28 +57,28 @@ filter_desc_compare_func gDescCompare [FLD_TYPE_MAX] = { filterFieldValDescCompare }; -bool filterRangeCompGi (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompGi (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) >= 0; } -bool filterRangeCompGe (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompGe (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) > 0; } -bool filterRangeCompLi (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompLi (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(minv, maxr) <= 0; } -bool filterRangeCompLe (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompLe (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(minv, maxr) < 0; } -bool filterRangeCompii (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompii (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) >= 0 && cfunc(minv, maxr) <= 0; } -bool filterRangeCompee (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompee (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) > 0 && cfunc(minv, maxr) < 0; } -bool filterRangeCompei (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompei (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) > 0 && cfunc(minv, maxr) <= 0; } -bool filterRangeCompie (const char *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { +bool filterRangeCompie (const void *minv, const void *maxv, const void *minr, const void *maxr, __compar_fn_t cfunc) { return cfunc(maxv, minr) >= 0 && cfunc(minv, maxr) < 0; } @@ -1823,6 +1823,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum } SFilterInfo oinfo = *info; + SArray* group = taosArrayInit(FILTER_DEFAULT_GROUP_SIZE, sizeof(SFilterGroup)); SFilterGroupCtx *res = NULL; SFilterColInfo *colInfo = NULL; @@ -1830,6 +1831,10 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum uint16_t uidx = 0; memset(info, 0, sizeof(*info)); + info->colRangeNum = oinfo.colRangeNum; + info->colRange = oinfo.colRange; + oinfo.colRangeNum = 0; + oinfo.colRange = NULL; FILTER_SET_FLAG(info->options, FI_OPTION_NEED_UNIQE); @@ -1993,13 +1998,13 @@ int32_t filterPreprocess(SFilterInfo *info) { return TSDB_CODE_SUCCESS; } - filterRewrite(info, gRes, gResNum); - filterGenerateColRange(info, gRes, gResNum); filterDumpInfoToString(info, "Final", 1); filterPostProcessRange(info); + + filterRewrite(info, gRes, gResNum); return TSDB_CODE_SUCCESS; } @@ -2179,7 +2184,7 @@ bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t num } // not support pre-filter operation on binary/nchar data type - if (!IS_PREFILTER_TYPE(ctx->type)) { + if (FILTER_NO_MERGE_DATA_TYPE(ctx->type)) { return true; } @@ -2200,7 +2205,7 @@ bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t num SDataStatis* pDataBlockst = &pDataStatis[index]; - SFilterRangeNode r = ctx->rs; + SFilterRangeNode *r = ctx->rs; if (ctx->type == TSDB_DATA_TYPE_FLOAT) { float minv = (float)(*(double *)(&pDataBlockst->min)); @@ -2215,10 +2220,13 @@ bool filterRangeExecute(SFilterInfo *info, SDataStatis *pDataStatis, int32_t num while (r) { ret = r->rc.func(minVal, maxVal, &r->rc.s, &r->rc.e, ctx->pCompareFunc); - CHK_RET(!ret, ret); - + if (ret) { + break; + } r = r->next; } + + CHK_RET(!ret, ret); } return ret; diff --git a/tests/script/general/parser/condition.sim b/tests/script/general/parser/condition.sim index a512cf40280c0c97d691d0dd72f8ac36f8bb82a0..e29f154d44c62222cfd6fd7623e1752212e4fbde 100644 --- a/tests/script/general/parser/condition.sim +++ b/tests/script/general/parser/condition.sim @@ -72,2404 +72,40 @@ sql insert into tb2_2 values ('2021-05-05 18:19:13',5,6,7,8,'2021-05-05 18:28:14 sql insert into tb2_2 values ('2021-05-05 18:19:14',8,2,3,4,'2021-05-05 18:28:15') sql insert into tb2_2 values ('2021-05-05 18:19:15',5,6,7,8,'2021-05-05 18:28:16') -sleep 100 - -print "column test" -sql select * from stb1 -if $rows != 29 then - return -1 -endi -sql select * from stb1 where c1 > 0 -if $rows != 28 then - return -1 -endi - -sql_error select * from stb1 where c8 > 0 -sql_error select * from stb1 where c7 in (0,2,3,1); -sql_error select * from stb1 where c8 in (true); -sql_error select * from stb1 where c8 in (1,2); -sql_error select * from stb1 where t2 in (3.0); -sql_error select ts,c1,c7 from stb1 where c7 > false -sql_error select * from stb1 where c1 > NULL; -sql_error select * from stb1 where c1 = NULL; -sql_error select * from stb1 where c1 LIKE '%1'; -sql_error select * from stb1 where c2 LIKE '%1'; -sql_error select * from stb1 where c3 LIKE '%1'; -sql_error select * from stb1 where c4 LIKE '%1'; -sql_error select * from stb1 where c5 LIKE '%1'; -sql_error select * from stb1 where c6 LIKE '%1'; -sql_error select * from stb1 where c7 LIKE '%1'; -sql_error select * from stb1 where c1 = 'NULL'; -sql_error select * from stb1 where c2 > 'NULL'; -sql_error select * from stb1 where c3 <> 'NULL'; -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 c8 < 'nuLl'; -sql_error select * from stb1 where c9 > 'nuLl'; -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; -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 and a.c1 < 60) or (b.c2 > 60)); - -sql select * from stb1 where c2 > 3.0 or c2 < 60; -if $rows != 28 then - return -1 -endi -sql select * from stb1 where c2 > 3.0 or c2 < 60 and c2 > 50; -if $rows != 25 then - return -1 -endi -sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50; -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50 and (c2 != 53 and c2 != 63); -if $rows != 6 then - return -1 -endi - -sql select * from stb1 where (c2 > 3.0 or c2 < 60) and c2 > 50 and (c2 != 53 or c2 != 63); -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where (c3 > 3.0 or c3 < 60) and c3 > 50 and (c3 != 53 or c3 != 63); -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where (c4 > 3.0 or c4 < 60) and c4 > 50 and (c4 != 53 or c4 != 63); -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where (c5 > 3.0 or c5 < 60) and c5 > 50 and (c5 != 53 or c5 != 63); -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where (c6 > 3.0 or c6 < 60) and c6 > 50 and (c6 != 53 or c6 != 63); -if $rows != 8 then - return -1 -endi - -sql select * from stb1 where c8 = '51'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi - -sql select * from stb1 where c8 != '51'; -if $rows != 27 then - return -1 -endi - -#xxx -sql select * from stb1 where c8 = '51' and c8 != '51'; -if $rows != 0 then - return -1 -endi - -#xxx -sql select * from stb1 where c8 = '51' or c8 != '51'; -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where c9 = '51'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi - -sql select * from stb1 where c9 != '51'; -if $rows != 27 then - return -1 -endi - -sql select * from stb1 where c9 = '51' and c9 != '51'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c9 = '51' or c9 != '51'; -if $rows != 28 then - return -1 -endi - -sql select ts,c1,c7 from stb1 where c7 = false -if $rows != 14 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data01 != 3 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data10 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data11 != 4 then - return -1 -endi -if $data12 != 0 then - return -1 -endi -if $data20 != @21-05-05 18:19:06.000@ then - return -1 -endi -if $data21 != 13 then - return -1 -endi -if $data22 != 0 then - return -1 -endi -if $data30 != @21-05-05 18:19:07.000@ then - return -1 -endi -if $data31 != 14 then - return -1 -endi -if $data32 != 0 then - return -1 -endi - - -sql select ts,c1,c7 from stb1 where c7 = true -if $rows != 14 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data10 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data11 != 2 then - return -1 -endi -if $data12 != 1 then - return -1 -endi -if $data20 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data21 != 11 then - return -1 -endi -if $data22 != 1 then - return -1 -endi -if $data30 != @21-05-05 18:19:05.000@ then - return -1 -endi -if $data31 != 12 then - return -1 -endi -if $data32 != 1 then - return -1 -endi - - -sql select * from stb1 where c8 = '51' or c8 = '4' -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data01 != 4 then - return -1 -endi -if $data10 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data11 != 51 then - return -1 -endi - - -sql select * from stb1 where c1 > 50 and c1 > 53 -if $rows != 5 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 and c1 < 52 -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 -if $rows != 28 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 -if $rows != 25 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 and c1 > 51 and c1 > 54 -if $rows != 4 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 and c1 > 51 or c1 > 54 -if $rows != 5 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 and c1 < 51 or c1 > 54 -if $rows != 4 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 and c1 > 54 -if $rows != 5 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 or c1 > 51 and c1 < 54 -if $rows != 7 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 and c1 > 54 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 and c1 > 53 or c1 < 51 or c1 > 54 -if $rows != 25 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 and c1 < 51 or c1 > 54 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 and c1 > 54 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 or c1 > 51 and c1 > 54 -if $rows != 8 then - return -1 -endi -sql select * from stb1 where c1 > 50 or c1 > 53 or c1 < 51 or c1 > 54 -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where (c1 > 50 and c1 > 53) and c1 < 52 -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 52) -if $rows != 0 then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or c1 < 51 -if $rows != 28 then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) -if $rows != 28 then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or c1 < 51 -if $rows != 25 then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) -if $rows != 5 then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and c1 < 51 -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) -if $rows != 8 then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53) and (c1 < 51 and c1 > 54) -if $rows != 0 then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53 and c1 < 51) and c1 > 54 -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51) and c1 > 54 -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51 or c1 > 54) -if $rows != 4 then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) and c1 > 54 -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) and c1 > 54 -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) -if $rows != 25 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 -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 -if $rows != 25 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 -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 -if $rows != 8 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) -if $rows != 28 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 -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) -if $rows != 28 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 -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 -if $rows != 28 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 -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 -if $rows != 28 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 -sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 -if $rows != 6 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data20 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data21 != 4 then - return -1 -endi -if $data30 != @21-05-05 18:19:10.000@ then - return -1 -endi -if $data31 != 23 then - return -1 -endi -if $data40 != @21-05-05 18:19:11.000@ then - return -1 -endi -if $data41 != 24 then - return -1 -endi -if $data50 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data51 != 61 then - return -1 -endi - - -sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data20 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data21 != 4 then - return -1 -endi - -sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61) -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data20 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data21 != 4 then - return -1 -endi -if $data30 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data31 != 53 then - return -1 -endi -if $data40 != @21-05-05 18:19:23.000@ then - return -1 -endi -if $data41 != 54 then - return -1 -endi - -sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data01 != 2 then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data20 != @21-05-05 18:19:03.000@ then - return -1 -endi -if $data21 != 4 then - return -1 -endi -if $data30 != @21-05-05 18:19:22.000@ then - return -1 -endi -if $data31 != 53 then - return -1 -endi - -sql select * from stb1 where c1 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c2 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c3 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c4 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c5 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c6 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c7 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c8 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi - -#xxx -sql select * from stb1 where c8 like '1'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi - -#xxx -sql select * from stb1 where c8 like '1%' and c8 like '%1'; -if $rows != 2 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 - -#xxx -sql select * from stb1 where c8 like '1' and c8 like '2'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c9 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi - -sql select * from stb1 where c1 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c2 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c3 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c4 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c5 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c6 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c7 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c8 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c9 is not null; -if $rows != 28 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 1 then - return -1 -endi -sql select * from stb1 where c1 > 63 or c1 is null; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:27.000@ then - return -1 -endi -if $data01 != 64 then - return -1 -endi -if $data10 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data11 != NULL then - return -1 -endi -sql select * from stb1 where c1 is null and c2 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -sql select * from stb1 where c1 is null and c2 is null and c3 is not null; -if $rows != 0 then - return -1 -endi -sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c1 is null and c1 > 0; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c1 is null or c1 is not null or c1 > 1; -if $rows != 29 then - return -1 -endi - -sql select * from stb1 where (c1 is null or c1 > 40) and c1 < 44; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:16.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:17.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:18.000@ then - return -1 -endi - -sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42); -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi - -sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42'); -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi - -sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:19.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:21.000@ then - return -1 -endi - -sql select * from stb1 where c8 LIKE '%1'; -if $rows != 7 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:08.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:12.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:20.000@ then - return -1 -endi -if $data60 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where c9 LIKE '%1'; -if $rows != 7 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:08.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:12.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:20.000@ then - return -1 -endi -if $data60 != @21-05-05 18:19:24.000@ then - return -1 -endi -sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:12.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:17.000@ then - return -1 -endi - -sql select * from stb1 where c1 in (1,3); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi - -sql select * from stb1 where c3 in (11,22); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi - -sql select * from stb1 where c4 in (3,33); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select * from stb1 where c5 in (3,33) and c8 in ('22','55'); -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c5 in (3,33) and c8 in ('33','54'); -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select * from stb1 where c5 in (3,33) or c8 in ('22','54'); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.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:23.000@ then - return -1 -endi - -sql select * from stb1 where (c9 in ('3','1','2','4','5') or c9 in ('33','11','22','44','55')) and c9 in ('1','3','11','13'); -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:04.000@ then - return -1 -endi - -sql select * from stb2 where (u1 in (1) or u2 in (5,6)) and (u3 in (3,6) or u4 in (7,8)) and ts2 in ('2021-05-05 18:28:02.000','2021-05-05 18:28:15.000','2021-05-05 18:28:01.000'); -if $rows != 2 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 - -sql select * from stb2 where u2 in (2) and u3 in (1,2,3) and u4 in (1,2,4,5) and u1 > 3 and u1 < 6 and u1 != 4; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi - -sql select avg(c1) from tb1 where (c1 > 12 or c2 > 10) and (c3 < 12 or c3 > 13); -if $rows != 1 then - return -1 -endi -if $data00 != 12.500000000 then - return -1 -endi - -sql select count(c1),sum(c3) from tb1 where ((c7 = true and c6 > 2) or (c1 > 10 or c3 < 3)) and ((c8 like '1%') or (c9 like '%2' or c9 like '%3')) interval(5s); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 3 then - return -1 -endi -if $data02 != 14 then - return -1 -endi -if $data10 != @21-05-05 18:19:05.000@ then - return -1 -endi -if $data11 != 3 then - return -1 -endi -if $data12 != 39 then - return -1 -endi - -sql select * from stb1 where c8 = 'null'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c8 = 'NULL'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c9 = 'null'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c9 = 'NULL'; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c2 in (0,1); -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -sql select * from stb1 where c6 in (0,2,3,1); -if $rows != 3 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 -sql select ts,c1 from (select * from stb1 where (c1 > 60 or c1 < 10) and (c7 = true or c5 > 2 and c5 < 63)) where (c3 > 61 or c3 < 3); -if $rows != 3 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:25.000@ then - return -1 -endi - -#sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -sql select a.ts from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:25.000@ then - return -1 -endi - -#sql select a.ts,a.c1,a.c8,a.c9 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 and b.c1 < 60; -sql 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 and b.c1 < 60; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:12.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:06.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:10.000@ then - return -1 -endi - -sql select * from stb1 where c1 is null and c1 is not null; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c1 is null or c1 is not null; -if $rows != 29 then - return -1 -endi -sql select * from stb1 where c1 is null or c1 > 20 or c1 < 25; -if $rows != 29 then - return -1 -endi -sql select * from stb1 where (c1 > 20 or c1 < 25) and c1 is null; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where (c1 > 20 or c1 < 25) and (c1 > 62 or c1 < 3); -if $rows != 4 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:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 11 and c1 != 11 and c1 != 14 and c1 < 14; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:05.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:06.000@ then - return -1 -endi -sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) -if $rows != 14 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:04.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 62 or c1 >= 62; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 62 and c1 >= 62; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 >= 62 and c1 != 62; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 >= 62 or c1 != 62; -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where c1 >= 62 and c1 = 62; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:25.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 62 and c1 != 62; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 62 and c1 = 62; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c1 is not null and c1 is not null; -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where c1 is not null or c1 is not null; -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where c1 is null and c1 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi - -sql select * from stb1 where c1 is null or c1 is null; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:28.000@ then - return -1 -endi - -sql select * from stb1 where c2 > 3 and c2 < 3; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c2 = 3; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi +sql create table stb3 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) + +sql create table tb3_1 using stb3 tags(1,'1',1.0) +sql create table tb3_2 using stb3 tags(2,'2',2.0) + +sql insert into tb3_1 values ('2021-01-05 18:19:00',1,1.0,1,1,1,1.0,true ,'1','1') +sql insert into tb3_1 values ('2021-02-05 18:19:01',2,2.0,2,2,2,2.0,true ,'2','2') +sql insert into tb3_1 values ('2021-03-05 18:19:02',3,3.0,3,3,3,3.0,false,'3','3') +sql insert into tb3_1 values ('2021-04-05 18:19:03',4,4.0,4,4,4,4.0,false,'4','4') +sql insert into tb3_1 values ('2021-05-05 18:19:28',5,NULL,5,NULL,5,NULL,true,NULL,'5') +sql insert into tb3_1 values ('2021-06-05 18:19:28',NULL,6.0,NULL,6,NULL,6.0,NULL,'6',NULL) +sql insert into tb3_1 values ('2021-07-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) + +sql insert into tb3_2 values ('2021-01-06 18:19:00',11,11.0,11,11,11,11.0,true ,'11','11') +sql insert into tb3_2 values ('2021-02-06 18:19:01',12,12.0,12,12,12,12.0,true ,'12','12') +sql insert into tb3_2 values ('2021-03-06 18:19:02',13,13.0,13,13,13,13.0,false,'13','13') +sql insert into tb3_2 values ('2021-04-06 18:19:03',14,14.0,14,14,14,14.0,false,'14','14') +sql insert into tb3_2 values ('2021-05-06 18:19:28',15,NULL,15,NULL,15,NULL,true,NULL,'15') +sql insert into tb3_2 values ('2021-06-06 18:19:28',NULL,16.0,NULL,16,NULL,16.0,NULL,'16',NULL) +sql insert into tb3_2 values ('2021-07-06 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) -sql select * from stb1 where c2 > 3 and c2 <= 3; -if $rows != 0 then - return -1 -endi - -sql select * from stb1 where c2 >= 3 and c2 <= 3; -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi - -sql select * from stb1 where (c2 in (1,2,3,4) or c2 in (11,12,13,14)) and c2 != 11 and c2 >2 and c2 != 14; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:03.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 - -sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) and (c1 != 51 and c1 <= 54 and c1 != 54 and c1 >=1 and c1 != 1) and (c1 >= 11 and c1 <=52 and c1 != 52 and c1 != 11); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:05.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:07.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 1 and c1 is not null and c1 < 5; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:03.000@ then - return -1 -endi - -sql select * from (select * from stb1 where c2 > 10 and c6 < 40) where c9 in ('11','21','31'); -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:12.000@ then - return -1 -endi - -sql select * from stb1 where c1 > 40 and c2 > 50 and c3 > 62 or c1 < 2 and c2 < 3; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:27.000@ then - return -1 -endi - -sql select * from stb1 where (c1 > 3 and c2 > 4) or (c1 < 60 and c2 < 30); -if $rows != 28 then - return -1 -endi - -sql select * from stb1 where (c1 > 3 and c2 > 4) or (c1 < 60 and c2 < 30) or (c1 is null and c2 is null); -if $rows != 29 then - return -1 -endi - -sql select * from stb1 where (c1 > 3 and c2 > 4) or (c1 < 60 and c3 < 30) or (c1 is null and c2 is null); -if $rows != 29 then - return -1 -endi - -sql select * from stb1 where (c1 > 60 and c2 < 63) or (c1 >62 and c3 < 30) or (c1 is null and c2 is null); -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:28.000@ then - return -1 -endi - -print "ts test" -sql_error select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:02.000'; -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; -sql_error select * from stb1 where ts2 like '2021-05-05%'; -sql_error select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:02'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:05.000') and ts > '2021-05-05 18:19:01.000' and ts < '2021-05-05 18:19:27.000'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000') and ts != '2021-05-05 18:19:25.000'; -sql_error select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.000')); -sql_error select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:24.000'; -sql_error select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' and ts < '2021-05-05 18:19:10.000'; -sql_error select * from stb1 where ts is null; -sql_error select * from stb1 where ts is not null and ts is null; -sql select * from stb1 where ts is not null; -if $rows != 29 then - return -1 -endi - -sql select * from stb1 where ts is not null or ts is null; -if $rows != 29 then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:25.000'; -if $rows != 29 then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' and ts < '2021-05-05 18:19:26.000'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:25.000@ then - return -1 -endi -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:28.000'; -if $rows != 29 then - return -1 -endi -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts > '2021-05-05 18:19:27.000'; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:27.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:28.000@ then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000' or ts != '2021-05-05 18:19:25.000'; -if $rows != 29 then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts <> '2021-05-05 18:19:25.000'; -if $rows != 29 then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.999') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.999')); -if $rows != 16 then - return -1 -endi -if $data00 != @21-05-05 18:19:05.000@ then - return -1 -endi - -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:12.000' and ts <= '2021-05-05 18:19:14.000') or (ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:17.000'); -if $rows != 13 then - return -1 -endi -if $data00 != @21-05-05 18:19:05.000@ then - return -1 -endi - -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:01.000' and ts <= '2021-05-05 18:19:08.000'); -if $rows != 10 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi - -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:06.000') or (ts >= '2021-05-05 18:19:03.000' and ts <= '2021-05-05 18:19:12.000')) and (ts >= '2021-05-05 18:19:10.000'); -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:10.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:11.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:12.000@ then - return -1 -endi - -sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:25.000' and ts != '2021-05-05 18:19:18'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:27.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:28.000@ then - return -1 -endi - - -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:25'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:27.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:28.000@ then - return -1 -endi - -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:25'; -if $rows != 3 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 - -sql select * from stb1 where ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:25'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi - -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:25'; -if $rows != 25 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 - -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:25'; -if $rows != 25 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 - -sql select * from stb1 where ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25'; -if $rows != 29 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 - -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:26'); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi - -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' or ts > '2021-05-05 18:19:26'); -if $rows != 5 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:26.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:27.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:28.000@ then - return -1 -endi - - -sql select * from stb2 where ts2 in ('2021-05-05 18:28:03','2021-05-05 18:28:05','2021-05-05 18:28:08'); -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.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:07.000@ then - return -1 -endi - -sql select * from stb2 where t3 in ('2021-05-05 18:38:38','2021-05-05 18:38:28','2021-05-05 18:38:08') and ts2 in ('2021-05-05 18:28:04','2021-05-05 18:28:04','2021-05-05 18:28:03'); -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:03.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.ts < '2021-05-05 18:19:03.000' or a.ts >= '2021-05-05 18:19:13.000') and (b.ts >= '2021-05-05 18:19:01.000' and b.ts <= '2021-05-05 18:19:14.000'); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:13.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select a.ts,c.ts,b.c1,c.u1,c.u2 from (select * from stb1) a, (select * from stb1) b, (select * from stb2) c where a.ts=b.ts and b.ts=c.ts and a.ts <= '2021-05-05 18:19:12.000' and b.ts >= '2021-05-05 18:19:06.000' and c.ts >= '2021-05-05 18:19:08.000' and c.ts <= '2021-05-05 18:19:11.000' and a.ts != '2021-05-05 18:19:10.000'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:11.000@ then - return -1 -endi - -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:06.000' or ts >= '2021-05-05 18:19:13.000') and (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:14.000') and ts != '2021-05-05 18:19:04.000'; -if $rows != 6 then - return -1 -endi -if $data00 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:03.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:13.000@ then - return -1 -endi -if $data50 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:26.000' or ts = '2021-05-05 18:19:26.000') and ts != '2021-05-05 18:19:03.000' and ts != '2021-05-05 18:19:26.000'; -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: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:27.000@ then - return -1 -endi -if $data40 != @21-05-05 18:19:28.000@ then - return -1 -endi - -print "tbname test" -sql_error select * from stb1 where tbname like '%3' and tbname like '%4'; - -sql select * from stb1 where tbname like 'tb%'; -if $rows != 29 then - return -1 -endi - -sql select * from stb1 where tbname like '%2'; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:10.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:11.000@ then - return -1 -endi - -print "tag test" -sql select * from stb1 where t1 in (1,2) and t1 in (2,3); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:10.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:11.000@ then - return -1 -endi - -sql select * from stb2 where t1 in (1,2) and t2 in (2) and t3 in ('2021-05-05 18:58:57.000'); -if $rows != 0 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; -sql select tb1.ts from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.ts < '2021-05-05 18:19:06.000'; -if $rows != 2 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 - - -print "column&ts test" -sql_error select count(*) from stb1 where ts > 0 or c1 > 0; -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:20.000' and (c1 > 23 or c1 < 14) and c7 in (true) and c8 like '%2'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:05.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:17.000@ then - return -1 -endi - -print "column&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0; -sql select * from stb1 where tbname like '%3' and c6 < 34 and c5 != 33 and c4 > 31; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:13.000@ then - return -1 -endi - -print "column&tag test" -sql_error select * from stb1 where t1 > 0 or c1 > 0 -sql_error select * from stb1 where c1 > 0 or t1 > 0 -sql_error select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1 -sql_error select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3) -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1 -sql_error select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.t1=b.t1; - -sql select * from stb1 where c1 < 63 and t1 > 5 -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:25.000@ then - return -1 -endi -sql select * from stb1 where t1 > 3 and t1 < 5 and c1 != 42 and c1 != 44; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:16.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:18.000@ then - return -1 -endi -sql select * from stb1 where t1 > 1 and c1 > 21 and t1 < 3 and c1 < 24 and t1 != 3 and c1 != 23; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:09.000@ then - return -1 -endi -sql select * from stb1 where c1 > 1 and (t1 > 3 or t1 < 2) and (c2 > 2 and c2 < 62 and t1 != 4) and (t1 > 2 and t1 < 6) and c7 = true and c8 like '%2'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:21.000@ then - return -1 -endi - -sql select * from stb1 where c1!=31 and c1 !=32 and c1 <> 63 and c1 <>1 and c1 <> 21 and c1 <> 2 and c7 <> true and c8 <> '3' and c9 <> '4' and c2<>13 and c3 <> 23 and c4 <> 33 and c5 <> 34 and c6 <> 43 and c2 <> 53 and t1 <> 5 and t2 <>4; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:07.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:11.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:27.000@ then - return -1 -endi - - -print "column&join test" -sql_error select tb1.ts,tb1.c1,tb2_1.u1 from tb1, tb2_1 where tb1.ts=tb2_1.ts or tb1.c1 > 0; - - -print "ts&tbname test" -sql_error select count(*) from stb1 where ts > 0 or tbname like 'tb%'; - -print "ts&tag test" -sql_error select count(*) from stb1 where ts > 0 or t1 > 0; - -sql select * from stb2 where t1!=1 and t2=2 and t3 in ('2021-05-05 18:58:58.000') and ts < '2021-05-05 18:19:13.000'; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:11.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:12.000@ then - return -1 -endi - -print "ts&join test" -sql_error select tb1.ts,tb1.c1,tb2_1.u1 from tb1, tb2_1 where tb1.ts=tb2_1.ts or tb1.ts > 0; -sql select tb1.ts,tb1.c1,tb2_1.u1 from tb1, tb2_1 where tb1.ts=tb2_1.ts and (tb1.ts > '2021-05-05 18:19:05.000' or tb1.ts < '2021-05-05 18:19:03.000' or tb1.ts > 0); - - -print "tbname&tag test" -sql select * from stb1 where tbname like 'tb%' and (t1=1 or t2=2 or t3=3) and t1 > 2; -if $rows != 4 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 - -print "tbname&join test" - -print "tag&join test" - - - - - -print "column&ts&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0 or ts > 0; - -print "column&ts&tag test" -sql_error select count(*) from stb1 where t1 > 0 or c1 > 0 or ts > 0; -sql_error select count(*) from stb1 where c1 > 0 or t1 > 0 or ts > 0; - -sql select * from stb1 where (t1 > 0 or t1 > 2 ) and ts > '2021-05-05 18:19:10.000' and (c1 > 1 or c1 > 3) and (c6 > 40 or c6 < 30) and (c8 like '%3' or c8 like '_4') and (c9 like '1%' or c9 like '6%' or (c9 like '%3' and c9 != '23')) and ts > '2021-05-05 18:19:22.000' and ts <= '2021-05-05 18:19:26.000'; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:26.000@ then - return -1 -endi -sql select * from stb1 where ts > '2021-05-05 18:19:00.000' and c1 > 2 and t1 != 1 and c2 >= 23 and t2 >= 3 and c3 < 63 and c7 = false and t3 > 3 and t3 < 6 and c8 like '4%' and ts < '2021-05-05 18:19:19.000' and c2 > 40 and c3 != 42; -if $rows != 1 then - return -1 -endi -if $data00 != @21-05-05 18:19:18.000@ then - return -1 -endi -print "column&ts&join test" - -print "column&tbname&tag test" -sql_error select count(*) from stb1 where c1 > 0 or tbname in ('tb1') or t1 > 0; - -print "column&tbname&join test" -print "column&tag&join test" -print "ts&tbname&tag test" -sql_error select count(*) from stb1 where ts > 0 or tbname in ('tb1') or t1 > 0; - -print "ts&tbname&join test" -print "ts&tag&join test" -print "tbname&tag&join test" - - - - -print "column&ts&tbname&tag test" -sql_error select * from stb1 where (tbname like 'tb%' or ts > '2021-05-05 18:19:01.000') and (t1 > 5 or t1 < 4) and c1 > 0; -sql_error select * from stb1 where (ts > '2021-05-05 18:19:01.000') and (ts > '2021-05-05 18:19:02.000' or t1 > 3) and (t1 > 5 or t1 < 4) and c1 > 0; -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:20.000' and col > 0 and t1 > 0; +sleep 100 +sql connect -print "column&ts&tbname&join test" -print "column&ts&tag&join test" -print "column&tbname&tag&join test" -print "ts&tbname&tag&join test" +run general/parser/condition_query.sim +print ================== restart server to commit data into disk +system sh/exec.sh -n dnode1 -s stop -x SIGINT +sleep 100 +system sh/exec.sh -n dnode1 -s start +print ================== server restart completed +sql connect +sleep 100 -print "column&ts&tbname&tag&join test" +run general/parser/condition_query.sim -#system sh/exec.sh -n dnode1 -s stop -x SIGINT