From 0cb0e109a7631508b8c3482464abfd91d3aa0672 Mon Sep 17 00:00:00 2001 From: Pan Wei <72057773+dapan1121@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:50:44 +0800 Subject: [PATCH] enh: add more cases for constant join (#30225) * fix: add more cases and fix issues * enh: add more test cases * enh: add more test cases * fix: memory leak issue * enh: add view cases and fix order by issue * enh: add document description --- docs/en/14-reference/03-taos-sql/31-join.md | 13 +- docs/zh/14-reference/03-taos-sql/31-join.md | 13 +- source/libs/parser/src/parTranslater.c | 20 +- source/libs/planner/src/planLogicCreater.c | 4 +- source/libs/planner/src/planOptimizer.c | 70 +- source/libs/planner/src/planUtil.c | 2 + source/libs/scalar/inc/sclInt.h | 3 + source/libs/scalar/src/scalar.c | 53 + .../army/query/joinConst/full_outer.today.csv | 22 - .../army/query/joinConst/full_outer.today.in | 2 - .../query/joinConst/full_outer.today_.csv | 22 - tests/army/query/joinConst/inner.constts.csv | 20 - tests/army/query/joinConst/inner.constts.in | 4 - tests/army/query/joinConst/inner.constts2.csv | 20 - tests/army/query/joinConst/inner.constts3.csv | 20 - tests/army/query/joinConst/inner.now.csv | 42 +- tests/army/query/joinConst/inner.now.in | 11 +- tests/army/query/joinConst/inner.now_.csv | 42 +- tests/army/query/joinConst/inner.today.csv | 14 +- tests/army/query/joinConst/inner.today.in | 6 +- tests/army/query/joinConst/inner.today_.csv | 14 +- tests/army/query/joinConst/inner.today_ts.csv | 811 --------------- .../query/joinConst/inner.tomorrow_ts.csv | 969 ------------------ .../army/query/joinConst/left_anti.today.csv | 14 - tests/army/query/joinConst/left_anti.today.in | 2 - .../army/query/joinConst/left_anti.today_.csv | 14 - tests/army/query/joinConst/left_outer.now.csv | 44 - tests/army/query/joinConst/left_outer.now.in | 5 - .../army/query/joinConst/left_outer.now_.csv | 44 - .../army/query/joinConst/left_outer.today.csv | 16 - .../army/query/joinConst/left_outer.today.in | 2 - .../query/joinConst/left_outer.today_.csv | 16 - .../army/query/joinConst/left_semi.today.csv | 12 +- tests/army/query/joinConst/left_semi.today.in | 4 +- .../army/query/joinConst/left_semi.today_.csv | 12 +- tests/army/query/joinConst/others.csv | 880 ++++++++++++++++ tests/army/query/joinConst/others.in | 129 +++ .../query/joinConst/right_outer.today.csv | 16 - .../army/query/joinConst/right_outer.today.in | 2 - .../query/joinConst/right_outer.today_.csv | 16 - tests/army/query/test_join_const.py | 69 +- tests/parallel_test/cases.task | 1 + 42 files changed, 1219 insertions(+), 2276 deletions(-) delete mode 100644 tests/army/query/joinConst/inner.today_ts.csv delete mode 100644 tests/army/query/joinConst/inner.tomorrow_ts.csv create mode 100644 tests/army/query/joinConst/others.csv create mode 100644 tests/army/query/joinConst/others.in diff --git a/docs/en/14-reference/03-taos-sql/31-join.md b/docs/en/14-reference/03-taos-sql/31-join.md index caf2436bd5..1d206a954c 100644 --- a/docs/en/14-reference/03-taos-sql/31-join.md +++ b/docs/en/14-reference/03-taos-sql/31-join.md @@ -29,6 +29,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### Main Join Condition As a time-series database, all join queries in TDengine revolve around the primary key timestamp column. Therefore, all join queries (except ASOF/Window Join) must include an equality condition on the primary key column, and the first primary key column equality condition that appears in the join conditions will be considered the main join condition. ASOF Join's main join condition can include non-equality conditions, while Window Join's main join condition is specified through `WINDOW_OFFSET`. +Starting from version 3.3.6.0, TDengine supports constant timestamps in subqueries (including constant functions with return timestamps such as today (), now (), etc., constant timestamps and their addition and subtraction operations) as equivalent primary key columns that can appear in the main join condition. For example: + +```sql +SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` + +The above example SQL will perform join operation between all records in table d1001 today and a certain time record in table d1002. It should be noticed that the constant time string appears in SQL will not be treated as a timestamp by default. For example, "2025-03-19 10:00:00.000" will only be treated as a string instead of a timestamp. Therefore, when it needs to be treated as a constant timestamp, you can specify the constant string as a timestamp type by using the type prefix timestamp. For example: + +```sql +SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` Apart from Window Join, TDengine supports the `timetruncate` function operation in the main join condition, such as `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`, but does not support other functions and scalar operations. @@ -38,7 +49,7 @@ The characteristic ASOF/Window Join of time-series databases supports grouping t ### Primary Key Timeline -As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. The selection of the primary key timeline in Join output results follows these rules: +As a time-series database, TDengine requires each table (subtable) to have a primary key timestamp column, which will serve as the primary key timeline for many time-related operations. The result of a subquery or the result of a Join operation also needs to clearly identify which column will be considered the primary key timeline for subsequent time-related operations. In subqueries, the first appearing ordered primary key column (or its operation) or a pseudocolumn equivalent to the primary key column (`_wstart`/`_wend`) will be considered the primary key timeline of the output table. In addition, starting with version 3.3.6.0, TDengine also supports constant timestamp columns in subquery results as the primary key timeline for the output table. The selection of the primary key timeline in Join output results follows these rules: - In the Left/Right Join series, the primary key column of the driving table (subquery) will be used as the primary key timeline for subsequent queries; additionally, within the Window Join window, since both tables are ordered, any table's primary key column can be used as the primary key timeline, with a preference for the primary key column of the same table. - Inner Join can use the primary key column of any table as the primary key timeline, but when there are grouping conditions similar to tag column equality conditions related by `AND` with the main join condition, it will not produce a primary key timeline. diff --git a/docs/zh/14-reference/03-taos-sql/31-join.md b/docs/zh/14-reference/03-taos-sql/31-join.md index 9b66b6648a..60cf568949 100644 --- a/docs/zh/14-reference/03-taos-sql/31-join.md +++ b/docs/zh/14-reference/03-taos-sql/31-join.md @@ -30,6 +30,17 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### 主连接条件 作为一款时序数据库,TDengine 所有的关联查询都围绕主键时戳列进行,因此要求除 ASOF/Window Join 外的所有关联查询都必须含有主键列的等值连接条件,而按照顺序首次出现在连接条件中的主键列等值连接条件将会被作为主连接条件。ASOF Join 的主连接条件可以包含非等值的连接条件,而 Window Join 的主连接条件则是通过 `WINDOW_OFFSET` 来指定。 +从 3.3.6.0 版本开始,TDengine 支持子查询中的常量(包含返回时戳的常量函数如today()、now()等,常量时戳及其加减运算)作为等价主键列可以出现在主连接条件中。例如: + +```sql +SELECT * from d1001 a JOIN (SELECT today() as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` + +上面的示例语句可以实现表 d1001 今天的所有记录与表 d1002 中某一时刻的某条记录进行关联运算。需要注意的是,SQL 中出现的时间字符串常量默认不会被当作时戳,例如 `'2025-03-19 10:00:00.000'` 只会被当作字符串而不是时戳,因此当需要作为常量时戳处理时,可以通过类型前缀 timestamp 来指定字符串常量为时间戳类型,例如: + +```sql +SELECT * from d1001 a JOIN (SELECT timestamp '2025-03-19 10:00:00.000' as ts1, * from d1002 WHERE ts = '2025-03-19 10:00:00.000') b ON timetruncate(a.ts, 1d) = b.ts1; +``` 除 Window Join 外,TDengine 支持在主连接条件中进行 `timetruncate` 函数操作,例如 `ON timetruncate(a.ts, 1s) = timetruncate(b.ts, 1s)`,除此之外,暂不支持其他函数及标量运算。 @@ -39,7 +50,7 @@ SELECT a.* FROM meters a LEFT ASOF JOIN meters b ON timetruncate(a.ts, 1s) < tim ### 主键时间线 -TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则: +TDengine 作为时序数据库要求每个表(子表)中必须有主键时间戳列,它将作为该表的主键时间线进行很多跟时间相关的运算,而子查询的结果或者 Join 运算的结果中也需要明确哪一列将被视作主键时间线参与后续的时间相关的运算。在子查询中,查询结果中存在的有序的第一个出现的主键列(或其运算)或等同主键列的伪列(`_wstart`/`_wend`)将被视作该输出表的主键时间线。此外,从 3.3.6.0 版本开始,TDengine 也开始支持子查询结果中的常量时戳列作为输出表的主键时间线。Join 输出结果中主键时间线的选择遵从以下规则: - Left/Right Join 系列中驱动表(子查询)的主键列将被作为后续查询的主键时间线;此外,在 Window Join 窗口内,因为左右表同时有序所以在窗口内可以把任意一个表的主键列做作主键时间线,优先选择本表的主键列作为主键时间线。 - Inner Join 可以把任意一个表的主键列做作主键时间线,当存在类似分组条件(Tag 列的等值条件且与主连接条件 `AND` 关系)时将无法产生主键时间线。 - Full Join 因为无法产生任何一个有效的主键时间序列,因此没有主键时间线,这也就意味着 Full Join 中无法进行时间线相关的运算。 diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 319149716f..233f236574 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5387,24 +5387,6 @@ int32_t mergeInnerJoinConds(SNode** ppDst, SNode** ppSrc) { return code; } -bool isColumnExpr(SNode* pNode) { - SExprNode* pExpr = (SExprNode*)pNode; - if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode)) { - return false; - } - if (QUERY_NODE_FUNCTION == nodeType(pNode)) { - SFunctionNode* pFunc = (SFunctionNode*)pNode; - if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType && strcasecmp(((SFunctionNode*)pNode)->functionName, "timetruncate")) { - return false; - } - if (!nodesContainsColumn(nodesListGetNode(pFunc->pParameterList, 0))) { - return false; - } - } - - return true; -} - int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) { if (NULL == *ppSrc) { return TSDB_CODE_SUCCESS; @@ -5417,7 +5399,7 @@ int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) { if (OP_TYPE_EQUAL != pOp->opType) { break; } - if (isColumnExpr(pOp->pLeft) && isColumnExpr(pOp->pRight)) { + if (nodesContainsColumn(pOp->pLeft) && nodesContainsColumn(pOp->pRight)) { TSWAP(*ppSrc, *ppDst); } break; diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 3933e13b7d..a5f32d7159 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -659,11 +659,11 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect pJoin->node.groupAction = GROUP_ACTION_CLEAR; pJoin->hashJoinHint = getHashJoinOptHint(pSelect->pHint); pJoin->batchScanHint = getBatchScanOptionFromHint(pSelect->pHint); - pJoin->node.requireDataOrder = pJoin->hashJoinHint ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL; + pJoin->node.requireDataOrder = (pJoin->hashJoinHint || pJoinTable->leftNoOrderedSubQuery || pJoinTable->rightNoOrderedSubQuery) ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL; pJoin->node.resultDataOrder = DATA_ORDER_LEVEL_NONE; pJoin->isLowLevelJoin = pJoinTable->isLowLevelJoin; pJoin->leftNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery; - pJoin->rightNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery; + pJoin->rightNoOrderedSubQuery = pJoinTable->rightNoOrderedSubQuery; code = nodesCloneNode(pJoinTable->pWindowOffset, &pJoin->pWindowOffset); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index abdf8065cf..4901b916f3 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -869,6 +869,10 @@ static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool con } } + if (constAsPrim && ((pJoin->leftNoOrderedSubQuery && !pJoin->leftConstPrimGot) || (pJoin->rightNoOrderedSubQuery && !pJoin->rightConstPrimGot))) { + res = false; + } + tSimpleHashCleanup(pLeftTables); tSimpleHashCleanup(pRightTables); @@ -926,20 +930,26 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInpu } if (TSDB_CODE_SUCCESS == code) { + nodesDestroyNode(*ppInput); + *ppInput = NULL; + if (NULL != *ppPrimEqCond) { *ppOnCond = pTempOnCond; - nodesDestroyNode(*ppInput); - *ppInput = NULL; return TSDB_CODE_SUCCESS; } + nodesDestroyNode(pTempOnCond); - planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length); - return TSDB_CODE_PLAN_INTERNAL_ERROR; + if (!constAsPrim) { + planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length); + return TSDB_CODE_PLAN_INTERNAL_ERROR; + } } else { nodesDestroyList(pOnConds); nodesDestroyNode(pTempOnCond); return code; } + + return code; } static int32_t pdcJoinSplitPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) { @@ -1417,7 +1427,7 @@ static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNod if (TSDB_CODE_SUCCESS == code) { pJoin->pPrimKeyEqCond = pPrimKeyEqCond; *ppCond = pJoinOnCond; - if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) { + if (pJoin->pPrimKeyEqCond && (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot)) { code = scalarConvertOpValueNodeTs((SOperatorNode*)pJoin->pPrimKeyEqCond); } } else { @@ -1485,7 +1495,8 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin } } - return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL); + return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PAR_NOT_SUPPORT_JOIN, + "Join requires valid time series input and primary timestamp equal condition"); } if (IS_ASOF_JOIN(pJoin->subType)) { @@ -2643,22 +2654,39 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL EOrder targetOrder = 0; SSHashObj* pTables = NULL; - if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && - ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) { - pScan = (SScanLogicNode*)pLeft; - pChild = pRight; - pChildPos = &pJoin->node.pChildren->pTail->pNode; - targetOrder = pScan->node.outputTsOrder; - } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && - ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) { - pScan = (SScanLogicNode*)pRight; - pChild = pLeft; - pChildPos = &pJoin->node.pChildren->pHead->pNode; - targetOrder = pScan->node.outputTsOrder; + if (pJoin->node.inputTsOrder) { + targetOrder = pJoin->node.inputTsOrder; + + if (pRight->outputTsOrder == pJoin->node.inputTsOrder) { + pChild = pLeft; + pChildPos = &pJoin->node.pChildren->pHead->pNode; + } else if (pLeft->outputTsOrder == pJoin->node.inputTsOrder) { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + } else { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pLeft->outputTsOrder; + } } else { - pChild = pRight; - pChildPos = &pJoin->node.pChildren->pTail->pNode; - targetOrder = pLeft->outputTsOrder; + if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pLeft) && + ((SScanLogicNode*)pLeft)->node.outputTsOrder != SCAN_ORDER_BOTH) { + pScan = (SScanLogicNode*)pLeft; + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pScan->node.outputTsOrder; + } else if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pRight) && + ((SScanLogicNode*)pRight)->node.outputTsOrder != SCAN_ORDER_BOTH) { + pScan = (SScanLogicNode*)pRight; + pChild = pLeft; + pChildPos = &pJoin->node.pChildren->pHead->pNode; + targetOrder = pScan->node.outputTsOrder; + } else { + pChild = pRight; + pChildPos = &pJoin->node.pChildren->pTail->pNode; + targetOrder = pLeft->outputTsOrder; + } + pJoin->node.inputTsOrder = targetOrder; } if (QUERY_NODE_OPERATOR != nodeType(pJoin->pPrimKeyEqCond)) { diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c index f306360bb3..1690f96ae5 100644 --- a/source/libs/planner/src/planUtil.c +++ b/source/libs/planner/src/planUtil.c @@ -26,6 +26,8 @@ static char* getUsageErrFormat(int32_t errCode) { return "not support cross join"; case TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND: return "Not supported join conditions"; + case TSDB_CODE_PAR_NOT_SUPPORT_JOIN: + return "Not supported join since '%s'"; case TSDB_CODE_PLAN_SLOT_NOT_FOUND: return "not found slot id by slot key"; case TSDB_CODE_PLAN_INVALID_TABLE_TYPE: diff --git a/source/libs/scalar/inc/sclInt.h b/source/libs/scalar/inc/sclInt.h index 457880c172..bd30c6b664 100644 --- a/source/libs/scalar/inc/sclInt.h +++ b/source/libs/scalar/inc/sclInt.h @@ -43,6 +43,9 @@ typedef struct SScalarCtx { #define SCL_DATA_TYPE_DUMMY_HASH 9000 #define SCL_DEFAULT_OP_NUM 10 +#define SCL_NEED_SRC_TABLE_FUNC(_type) ((_type) == FUNCTION_TYPE_TIMETRUNCATE) +#define SCL_NEED_SRC_TABLE_OP(_type) ((_type) == OP_TYPE_ADD || (_type) == OP_TYPE_SUB) + #define SCL_IS_NOTNULL_CONST_NODE(_node) ((QUERY_NODE_VALUE == (_node)->type) || (QUERY_NODE_NODE_LIST == (_node)->type)) #define SCL_IS_CONST_NODE(_node) \ ((NULL == (_node)) || SCL_IS_NOTNULL_CONST_NODE(_node)) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index d78f8ad44c..82583c7b33 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -1209,6 +1209,40 @@ EDealRes sclRewriteNonConstOperator(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } +void sclGetValueNodeSrcTable(SNode* pNode, char** ppSrcTable, bool* multiTable) { + if (*multiTable) { + return; + } + + if (QUERY_NODE_NODE_LIST == nodeType(pNode)) { + SNodeListNode* pList = (SNodeListNode*)pNode; + SNode* pTmp = NULL; + FOREACH(pTmp, pList->pNodeList) { + sclGetValueNodeSrcTable(pTmp, ppSrcTable, multiTable); + } + + return; + } + + if (QUERY_NODE_VALUE != nodeType(pNode)) { + return; + } + + SValueNode* pValue = (SValueNode*)pNode; + if (pValue->node.srcTable[0]) { + if (*ppSrcTable) { + if (strcmp(*ppSrcTable, pValue->node.srcTable)) { + *multiTable = true; + *ppSrcTable = NULL; + } + + return; + } + + *ppSrcTable = pValue->node.srcTable; + } +} + EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { SFunctionNode *node = (SFunctionNode *)*pNode; SNode *tnode = NULL; @@ -1217,10 +1251,16 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_CONTINUE; } + char* srcTable = NULL; + bool multiTable = false; FOREACH(tnode, node->pParameterList) { if (!SCL_IS_CONST_NODE(tnode)) { return DEAL_RES_CONTINUE; } + + if (SCL_NEED_SRC_TABLE_FUNC(node->funcType)) { + sclGetValueNodeSrcTable(tnode, &srcTable, &multiTable); + } } SScalarParam output = {0}; @@ -1241,6 +1281,9 @@ EDealRes sclRewriteFunction(SNode **pNode, SScalarCtx *ctx) { res->translate = true; + if (srcTable) { + tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN); + } tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN); res->node.resType.type = output.columnData->info.type; res->node.resType.bytes = output.columnData->info.bytes; @@ -1393,8 +1436,18 @@ EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) { return DEAL_RES_ERROR; } + char* srcTable = NULL; + bool multiTable = false; + if (SCL_NEED_SRC_TABLE_OP(node->opType)) { + sclGetValueNodeSrcTable(node->pLeft, &srcTable, &multiTable); + sclGetValueNodeSrcTable(node->pRight, &srcTable, &multiTable); + } + res->translate = true; + if (srcTable) { + tstrncpy(res->node.srcTable, srcTable, TSDB_TABLE_NAME_LEN); + } tstrncpy(res->node.aliasName, node->node.aliasName, TSDB_COL_NAME_LEN); res->node.resType = node->node.resType; if (colDataIsNull_s(output.columnData, 0)) { diff --git a/tests/army/query/joinConst/full_outer.today.csv b/tests/army/query/joinConst/full_outer.today.csv index 74bb393871..2f031d8c1c 100644 --- a/tests/army/query/joinConst/full_outer.today.csv +++ b/tests/army/query/joinConst/full_outer.today.csv @@ -338,17 +338,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full joi __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -357,17 +346,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/full_outer.today.in b/tests/army/query/joinConst/full_outer.today.in index 3a151cbcf2..fc41aade21 100644 --- a/tests/army/query/joinConst/full_outer.today.in +++ b/tests/army/query/joinConst/full_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1 select b.ts from a1 a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta full join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta full join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/full_outer.today_.csv b/tests/army/query/joinConst/full_outer.today_.csv index 35e15f4dbd..2045eae48a 100644 --- a/tests/army/query/joinConst/full_outer.today_.csv +++ b/tests/army/query/joinConst/full_outer.today_.csv @@ -338,17 +338,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full j __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -357,17 +346,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - __tomorrow__ 00:00:00.000 | - __today__ 00:00:01.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/inner.constts.csv b/tests/army/query/joinConst/inner.constts.csv index 717f20b460..7c921fb688 100644 --- a/tests/army/query/joinConst/inner.constts.csv +++ b/tests/army/query/joinConst/inner.constts.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.constts.in b/tests/army/query/joinConst/inner.constts.in index 008630a119..312957bc0d 100644 --- a/tests/army/query/joinConst/inner.constts.in +++ b/tests/army/query/joinConst/inner.constts.in @@ -32,9 +32,7 @@ select b.c from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -107,9 +105,7 @@ select b.c from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from select b.ts from a1 a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select timestamp __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.constts2.csv b/tests/army/query/joinConst/inner.constts2.csv index 36b3fa310e..f88936e871 100644 --- a/tests/army/query/joinConst/inner.constts2.csv +++ b/tests/army/query/joinConst/inner.constts2.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __tomorrow__ 00:00:00.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.constts3.csv b/tests/army/query/joinConst/inner.constts3.csv index 7016d37580..bf8758cf87 100644 --- a/tests/army/query/joinConst/inner.constts3.csv +++ b/tests/army/query/joinConst/inner.constts3.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,11 +241,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -703,11 +693,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,11 +701,6 @@ taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, t __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:01.000 | - taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/inner.now.csv b/tests/army/query/joinConst/inner.now.csv index a682ed51ef..f056685e21 100644 --- a/tests/army/query/joinConst/inner.now.csv +++ b/tests/army/query/joinConst/inner.now.csv @@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b o taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; @@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b whe taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; diff --git a/tests/army/query/joinConst/inner.now.in b/tests/army/query/joinConst/inner.now.in index 6d1f72c4a4..27d3b2538d 100644 --- a/tests/army/query/joinConst/inner.now.in +++ b/tests/army/query/joinConst/inner.now.in @@ -26,11 +26,7 @@ select a.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.c from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -98,10 +94,7 @@ select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where select b.c from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.now_.csv b/tests/army/query/joinConst/inner.now_.csv index b5c3aafdd3..c1901ea90d 100644 --- a/tests/army/query/joinConst/inner.now_.csv +++ b/tests/army/query/joinConst/inner.now_.csv @@ -80,27 +80,7 @@ taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; @@ -267,25 +247,7 @@ taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b w taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; diff --git a/tests/army/query/joinConst/inner.today.csv b/tests/army/query/joinConst/inner.today.csv index b836987997..f88d05d5a1 100644 --- a/tests/army/query/joinConst/inner.today.csv +++ b/tests/army/query/joinConst/inner.today.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (se __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,7 +241,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | @@ -703,11 +698,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (selec __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,7 +706,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | diff --git a/tests/army/query/joinConst/inner.today.in b/tests/army/query/joinConst/inner.today.in index fcd0bee97d..ca6606989b 100644 --- a/tests/army/query/joinConst/inner.today.in +++ b/tests/army/query/joinConst/inner.today.in @@ -32,9 +32,8 @@ select b.c from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b o select b.ts from a1 a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -107,9 +106,8 @@ select b.c from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b wher select b.ts from a1 a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select __today__ as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; diff --git a/tests/army/query/joinConst/inner.today_.csv b/tests/army/query/joinConst/inner.today_.csv index 67f23560c8..a14d0f8631 100644 --- a/tests/army/query/joinConst/inner.today_.csv +++ b/tests/army/query/joinConst/inner.today_.csv @@ -233,11 +233,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a join ( __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -246,7 +241,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | @@ -703,11 +698,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a , (sel __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -716,7 +706,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; +taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; ts | ========================== __today__ 00:00:00.000 | diff --git a/tests/army/query/joinConst/inner.today_ts.csv b/tests/army/query/joinConst/inner.today_ts.csv deleted file mode 100644 index 097e398e17..0000000000 --- a/tests/army/query/joinConst/inner.today_ts.csv +++ /dev/null @@ -1,811 +0,0 @@ - -taos> use test; -Database changed. - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts; -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; -taos> select a.*, b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts | -================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | ts1 | ts | f | g | c | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts1 | ts | f | g | c | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.ts1,a.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts; -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000"; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000"; - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b where a.ts = b.ts1; -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts; -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts; -taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts; -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val; -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ; -taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -==================================================================================================================== - | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | -============================================================== - | 301 | 3011 | a | - | 302 | 3012 | a | - | 303 | 3013 | a | - | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -============================ - | - | - | - | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - ts1 | -============================ - | - | - | - | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -======================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================== - | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ; - diff --git a/tests/army/query/joinConst/inner.tomorrow_ts.csv b/tests/army/query/joinConst/inner.tomorrow_ts.csv deleted file mode 100644 index 8987ed2577..0000000000 --- a/tests/army/query/joinConst/inner.tomorrow_ts.csv +++ /dev/null @@ -1,969 +0,0 @@ - -taos> use test; -Database changed. - -taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts1 | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1; - ts | f | g | ts | -================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 | - -taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | ts1 | ts | f | g | c | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts; - ts1 | ts | f | g | c | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts; - ts1 | ts | -==================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 | - -taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1; - ts1 | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today; - -taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1; - ts | f | g | ts1 | f | g | 'a' | -================================================================================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | ts1 | ts | f | g | 'a' | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 | - 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 | - 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 | - -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ; - -taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1; - ts1 | f | g | 'a' | ts | f | g | -================================================================================================================== - 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | 'a' | -============================================================ - 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts; - ts1 | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - 2025-03-04 00:00:01.000 | 102 | 1012 | - 2025-03-05 00:00:00.000 | 103 | 1013 | - 2025-03-05 00:00:02.000 | 104 | 1014 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | - 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - c | -====== - a | - a | - a | - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - 2025-03-04 00:00:01.000 | - 2025-03-05 00:00:00.000 | - 2025-03-05 00:00:02.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | ts | f | g | -============================================================================================================================================ - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | f | g | -====================================================== - 2025-03-04 00:00:00.000 | 101 | 1011 | - -taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts1 | ts | f | g | 'a' | -====================================================================================== - 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | - -taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - c | -====== - a | - -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - 2025-03-04 00:00:00.000 | - -taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2; - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val; - ts | val | tg2 | ts | val | tg2 | -============================================================================================================ - 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 | - 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 | - -taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ; - diff --git a/tests/army/query/joinConst/left_anti.today.csv b/tests/army/query/joinConst/left_anti.today.csv index 25d63dba19..334758e018 100644 --- a/tests/army/query/joinConst/left_anti.today.csv +++ b/tests/army/query/joinConst/left_anti.today.csv @@ -188,22 +188,8 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left ant taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_anti.today.in b/tests/army/query/joinConst/left_anti.today.in index 5fa57a29db..cdce60a51e 100644 --- a/tests/army/query/joinConst/left_anti.today.in +++ b/tests/army/query/joinConst/left_anti.today.in @@ -32,9 +32,7 @@ select b.c from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left anti join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left anti join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_anti.today_.csv b/tests/army/query/joinConst/left_anti.today_.csv index e8595eeb7f..60dee49163 100644 --- a/tests/army/query/joinConst/left_anti.today_.csv +++ b/tests/army/query/joinConst/left_anti.today_.csv @@ -188,22 +188,8 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left a taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left anti join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left anti join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_outer.now.csv b/tests/army/query/joinConst/left_outer.now.csv index de72e37014..4faf7d137a 100644 --- a/tests/army/query/joinConst/left_outer.now.csv +++ b/tests/army/query/joinConst/left_outer.now.csv @@ -226,38 +226,6 @@ taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join NULL | NULL | -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== @@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb w 403 | 2 | NULL | NULL | NULL | 404 | 2 | NULL | NULL | NULL | -taos> select tb.val,tb.tg2,ta.* from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val; - val | tg2 | ts | val | tg2 | -================================================================================== - 301 | 1 | NULL | NULL | NULL | - 302 | 1 | NULL | NULL | NULL | - 303 | 1 | NULL | NULL | NULL | - 304 | 1 | NULL | NULL | NULL | - 401 | 2 | NULL | NULL | NULL | - 402 | 2 | NULL | NULL | NULL | - 403 | 2 | NULL | NULL | NULL | - 404 | 2 | NULL | NULL | NULL | - taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now; diff --git a/tests/army/query/joinConst/left_outer.now.in b/tests/army/query/joinConst/left_outer.now.in index 38279c0403..2b72f9f1f1 100644 --- a/tests/army/query/joinConst/left_outer.now.in +++ b/tests/army/query/joinConst/left_outer.now.in @@ -27,10 +27,6 @@ select b.* from a1 a left join (select __const__ as ts1, ts, f, g, 'a' from b1) select b.c from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from a1 a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from a1) a left join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; @@ -61,7 +57,6 @@ select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from b1) b left join select tb.val,tb.tg1,ta.* from (select __const__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1; select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2; select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val; -select tb.val,tb.tg2,ta.* from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__const__ where tb.ts=__const__ order by tb.val; select * from (select __const__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__const__ where tb.ts>__const__; diff --git a/tests/army/query/joinConst/left_outer.now_.csv b/tests/army/query/joinConst/left_outer.now_.csv index 2d5115143b..a1217d2815 100644 --- a/tests/army/query/joinConst/left_outer.now_.csv +++ b/tests/army/query/joinConst/left_outer.now_.csv @@ -226,38 +226,6 @@ taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left joi NULL | NULL | -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - -taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - NULL | - NULL | - NULL | - NULL | - taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== @@ -474,17 +442,5 @@ taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb 403 | 2 | NULL | NULL | NULL | 404 | 2 | NULL | NULL | NULL | -taos> select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val; - val | tg2 | ts | val | tg2 | -================================================================================== - 301 | 1 | NULL | NULL | NULL | - 302 | 1 | NULL | NULL | NULL | - 303 | 1 | NULL | NULL | NULL | - 304 | 1 | NULL | NULL | NULL | - 401 | 2 | NULL | NULL | NULL | - 402 | 2 | NULL | NULL | NULL | - 403 | 2 | NULL | NULL | NULL | - 404 | 2 | NULL | NULL | NULL | - taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now(); diff --git a/tests/army/query/joinConst/left_outer.today.csv b/tests/army/query/joinConst/left_outer.today.csv index 998fef2b48..9c7757d9b2 100644 --- a/tests/army/query/joinConst/left_outer.today.csv +++ b/tests/army/query/joinConst/left_outer.today.csv @@ -305,14 +305,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left joi __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -321,14 +313,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_outer.today.in b/tests/army/query/joinConst/left_outer.today.in index 193b976a62..34ccc0a610 100644 --- a/tests/army/query/joinConst/left_outer.today.in +++ b/tests/army/query/joinConst/left_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1 select b.ts from a1 a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_outer.today_.csv b/tests/army/query/joinConst/left_outer.today_.csv index 11319d4ca1..72aaeb3e81 100644 --- a/tests/army/query/joinConst/left_outer.today_.csv +++ b/tests/army/query/joinConst/left_outer.today_.csv @@ -305,14 +305,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left j __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -321,14 +313,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - NULL | - NULL | - NULL | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/left_semi.today.csv b/tests/army/query/joinConst/left_semi.today.csv index d11a8fe4df..3d5c77a694 100644 --- a/tests/army/query/joinConst/left_semi.today.csv +++ b/tests/army/query/joinConst/left_semi.today.csv @@ -194,11 +194,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left sem __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -207,11 +202,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; +taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val; ts | val | tg2 | ts | val | tg2 | ============================================================================================================ __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | diff --git a/tests/army/query/joinConst/left_semi.today.in b/tests/army/query/joinConst/left_semi.today.in index 72a4a7867c..749441d5b5 100644 --- a/tests/army/query/joinConst/left_semi.today.in +++ b/tests/army/query/joinConst/left_semi.today.in @@ -32,14 +32,12 @@ select b.c from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c fr select b.ts from a1 a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.ts, ta.val, tb.val; -select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val; +select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=__today__ where tb.ts=__today__ order by tb.val; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>__today__ where tb.ts>__today__; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left semi join (select __today__ + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/left_semi.today_.csv b/tests/army/query/joinConst/left_semi.today_.csv index 45c9e7c4db..60a91d1b81 100644 --- a/tests/army/query/joinConst/left_semi.today_.csv +++ b/tests/army/query/joinConst/left_semi.today_.csv @@ -194,11 +194,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left s __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -207,11 +202,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left semi join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left semi join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left semi join (select today() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; @@ -224,7 +214,7 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 | -taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val; +taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left semi join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc, val) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val; ts | val | tg2 | ts | val | tg2 | ============================================================================================================ __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 | diff --git a/tests/army/query/joinConst/others.csv b/tests/army/query/joinConst/others.csv new file mode 100644 index 0000000000..89fa11a41f --- /dev/null +++ b/tests/army/query/joinConst/others.csv @@ -0,0 +1,880 @@ + +taos> use test; +Database changed. + +taos> select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | ts | f | g | 'a' | +==================================================================================================== + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d); + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | ts | f | g | 'a' | +==================================================================================================== + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 103 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 301 | 3011 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 302 | 3012 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 303 | 3013 | a | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | 304 | 3014 | a | + +taos> select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc; + ts | f | g | ts | f | g | 'a' | +================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a | + +taos> select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts; + count(*) | +======================== + 4 | + +taos> select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts; + ts | count(*) | +================================================== + NULL | 3 | + __today__ 00:00:00.000 | 4 | + +taos> select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*table+subq*/ +taos> select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*table+const subq*/ +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*subq+subq*/ +taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts | f | g | +============================================================================================================ + __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*subq+const subq*/ +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*const subq+const subq*/ +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> /*functions*/ +taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1; + ts | f | g | ts1 | ts | f | g | +====================================================================================================================================== + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> /*view*/ +taos> select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts | f | g | +====================================================================================================================================== + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null; + +taos> select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + +taos> select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1; + ts1 | ts | f | g | ts1 | ts | f | g | +================================================================================================================================================================ + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | + __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | + diff --git a/tests/army/query/joinConst/others.in b/tests/army/query/joinConst/others.in new file mode 100644 index 0000000000..3c07a8ec8b --- /dev/null +++ b/tests/army/query/joinConst/others.in @@ -0,0 +1,129 @@ +use test; + +select * from a1 a join (select today + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts, 1d); +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1s, 1d); +select * from (select ts + 2s as ts,f from a1) a join (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b on a.ts = b.ts; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts + 1d + 1s; +select * from a1 a join (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b on a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + +select * from a1 a, (select today + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts, 1d); +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1s, 1d); +select * from (select ts + 2s as ts,f from a1) a, (select timestamp '__today__ 00:00:00.000' + 1d + 2s as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select case when 1 > 0 then timestamp '__today__ 00:00:00.000' else timestamp '__tomorrow__ 00:00:00.000' end as ts, f, g, 'a' from b1) b where a.ts = b.ts; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts + 1d + 1s; +select * from a1 a, (select timestamp '__today__ 00:00:00.000' + 1s as ts, f, g, 'a' from b1) b where a.ts = timetruncate(b.ts + 1d + 1s, 1d) + 2s; + +select * from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts order by b.ts, b.f desc; +select count(*) from a1 a, (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts group by b.ts order by b.ts; +select b.ts, count(*) from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts group by b.ts order by b.ts; +select * from (select * from a1 order by ts desc) a join (select today as ts1, * from b1 order by ts1 desc) b on a.ts = b.ts1; + +/*table+subq*/ +select * from a1 a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from a1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +/*table+const subq*/ +select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from a1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from a1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + + +/*subq+subq*/ +select * from (select * from a1 order by ts) a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts desc) a join (select * from b1 order by ts desc) b on a.ts = b.ts; + +/*subq+const subq*/ +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; + +/*const subq+const subq*/ +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + + +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1 and a.ts = b.ts; +select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 and a.ts = b.ts; + +/*functions*/ +select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_timestamp('__today__', 'yyyy-mm-dd') + 1s as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) as ts1, * from b1) b on a.ts = b.ts1; +select * from a1 a join (select to_unixtimestamp('__today__ 00:00:00.000', 1) + 1s as ts1, * from b1) b on a.ts = b.ts1; + +/*view*/ +select * from view1 a join (select * from b1 order by ts) b on a.ts = b.ts; +select * from view1 a join (select * from b1 order by ts desc) b on a.ts = b.ts; +select * from view1 a join (select * from b1 order by ts) b on a.ts1 = b.ts; +select * from view1 a join (select * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts; + +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts) b on a.ts1 = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by ts desc) b on a.ts1 = b.ts1; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1; + +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is null; +select * from view1 a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts1 where a.ts1 is not null; +select * from view1 a, (select today() as ts1, * from b1 order by f) b where a.ts1 = b.ts1; diff --git a/tests/army/query/joinConst/right_outer.today.csv b/tests/army/query/joinConst/right_outer.today.csv index e44401dc75..041ad5bd70 100644 --- a/tests/army/query/joinConst/right_outer.today.csv +++ b/tests/army/query/joinConst/right_outer.today.csv @@ -266,14 +266,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right jo __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -282,14 +274,6 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/joinConst/right_outer.today.in b/tests/army/query/joinConst/right_outer.today.in index 62d2b80e53..dc02ea5a4d 100644 --- a/tests/army/query/joinConst/right_outer.today.in +++ b/tests/army/query/joinConst/right_outer.today.in @@ -32,9 +32,7 @@ select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; -select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta right join (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1; select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta right join (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2; diff --git a/tests/army/query/joinConst/right_outer.today_.csv b/tests/army/query/joinConst/right_outer.today_.csv index 9dbbf595bc..b71ef19aaa 100644 --- a/tests/army/query/joinConst/right_outer.today_.csv +++ b/tests/army/query/joinConst/right_outer.today_.csv @@ -266,14 +266,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts; ts | ========================== @@ -282,14 +274,6 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | -taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; - ts | -========================== - __today__ 00:00:00.000 | - __today__ 00:00:01.000 | - __tomorrow__ 00:00:00.000 | - __tomorrow__ 00:00:02.000 | - taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1; ts | ========================== diff --git a/tests/army/query/test_join_const.py b/tests/army/query/test_join_const.py index 2e0d698cc3..75ab74b7ac 100644 --- a/tests/army/query/test_join_const.py +++ b/tests/army/query/test_join_const.py @@ -63,6 +63,8 @@ class TDTestCase(TBase): tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}', 403, 4013);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}' + 3s, 404, 4014);") + tdSql.execute(f"create view view1 as select today() as ts1, * from a1;") + def replace_string(self, input_file, output_file, old_str, new_str): script_dir = os.path.dirname(os.path.abspath(__file__)) with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w') as f_out: @@ -148,22 +150,68 @@ class TDTestCase(TBase): tdLog.printNoPrefix(f"==========step:nocheck test") tdSql.execute("select * from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") tdSql.execute("select * from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") - tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") - tdSql.execute("select * from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") - tdSql.execute("select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") - tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") - tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") - tdSql.execute("select * from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") - tdSql.execute("select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") - tdSql.execute("select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") - tdSql.execute("select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") + tdSql.execute("select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") + tdSql.execute("select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;") + tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") + tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;") + tdSql.execute("select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") + tdSql.execute("select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;") + tdSql.execute("select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;") + tdSql.execute("select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;") + tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.execute("select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;") + tdSql.execute("select tb.val,tb.tg2,ta.* from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb left join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;") def test_abnormal_case(self): tdLog.printNoPrefix(f"==========step:abnormal case test") tdSql.error(f"select * from a1 a join (select '{self.today_ts}' as ts from b1) b on a.ts = b.ts;") tdSql.error(f"select * from a1 a join (select '{self.today_ts}' + 1s as ts from b1) b on a.ts = b.ts;") + tdSql.error(f"select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.error(f"select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;") + tdSql.error(f"select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;") tdSql.error(f"select * from a1 a left asof join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") tdSql.error(f"select * from a1 a left window join (select now as ts1, ts, f, g, 'a' c from b1) b window_offset(-1s, 1s);") + tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on timetruncate(a.ts + 1s, 1d) = timetruncate(b.ts, 1d);") + tdSql.error(f"select * from a1 a join (select timestamp '{self.today_ts}' + 1d as ts, f, g, 'a' from b1) b on a.ts + 1s = timetruncate(b.ts, 1d);") + tdSql.error(f"select t1.* from sta t1, (select _wstart as ts, count(*) from sta partition by tbname interval(1d)) t2 where t1.ts = t2.ts;") + tdSql.error(f"select * from (select tg1, sum(f) s from sta group by tg1) t1, sta t2 where t1.tg1 = t2.tg1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f) a join (select today as ts1, * from b1 order by f desc) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today as ts1, * from b1 order by f) b on a.ts = b.ts1;") + tdSql.error(f"select * from a1 a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from a1 a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f) a join (select * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts1;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by ts desc) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by f desc) a join (select today() as ts1, * from b1 order by f) b on a.ts = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + tdSql.error(f"select * from (select today() as ts1, * from a1 order by ts desc) a join (select today() as ts1, * from b1 order by f) b on a.ts1 = b.ts;") + + def test_others_case(self, testCase): + tdLog.printNoPrefix(f"==========step:{testCase} test") + self.replace_string(f'{testCase}.in', f'{testCase}.in.tmp1', '__today__', f'{self.today_date}') + self.replace_string(f'{testCase}.in.tmp1', f'{testCase}.in.tmp2', '__tomorrow__', f'{self.tomorrow_date}') + self.replace_string(f'{testCase}.csv', f'{testCase}.csv.tmp1', '__today__', f'{self.today_date}') + self.replace_string2(f'{testCase}.csv.tmp1', f'{testCase}.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}') + # read sql from .sql file and execute + self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.tmp2") + self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.csv.tmp2") + tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) def run(self): tdLog.debug(f"start to excute {__file__}") @@ -182,6 +230,9 @@ class TDTestCase(TBase): self.test_today_case("left_semi") self.test_today_case("left_anti") + self.test_others_case("others") + + self.test_nocheck_case() self.test_abnormal_case() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f0c547c3cf..2ff0e9ab56 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -46,6 +46,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f query/function/concat.py ,,y,army,./pytest.sh python3 ./test.py -f query/function/cast.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_join.py +,,y,army,./pytest.sh python3 ./test.py -f query/test_join_const.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_compare.py ,,y,army,./pytest.sh python3 ./test.py -f query/test_case_when.py ,,y,army,./pytest.sh python3 ./test.py -f insert/test_column_tag_boundary.py