From 3835a5b349b6fa854ffd7e849fd3c5a17d830362 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 22 Mar 2024 08:47:07 +0800 Subject: [PATCH] fix: error log and union issue --- include/util/taoserror.h | 1 + source/libs/catalog/src/ctgAsync.c | 2 +- source/libs/command/inc/commandInt.h | 7 +- source/libs/command/src/explain.c | 60 +- source/libs/executor/inc/mergejoin.h | 4 +- .../libs/executor/src/dynqueryctrloperator.c | 8 +- source/libs/executor/src/executil.c | 2 +- source/libs/executor/src/groupcacheoperator.c | 16 +- source/libs/executor/src/hashjoinoperator.c | 6 +- source/libs/executor/src/mergejoin.c | 5 +- source/libs/executor/src/scanoperator.c | 4 +- source/libs/executor/test/joinTests.cpp | 10 +- source/libs/parser/src/parTranslater.c | 60 +- source/libs/planner/src/planOptimizer.c | 2 +- source/libs/planner/src/planSpliter.c | 8 +- source/libs/scheduler/src/schUtil.c | 2 +- source/util/src/terror.c | 1 + tests/script/tsim/join/inner_join.sim | 10 + tests/script/tsim/join/join.sim | 2 + tests/script/tsim/join/join_boundary.sim | 374 ++++++++++- tests/script/tsim/join/join_explain.sim | 598 ++++++++++++++++++ tests/script/tsim/join/left_asof_join.sim | 5 + utils/tsim/inc/simParse.h | 2 +- 23 files changed, 1127 insertions(+), 62 deletions(-) create mode 100644 tests/script/tsim/join/join_explain.sim diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 5cfb920041..5f985fe493 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -767,6 +767,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_INVALID_WJOIN_HAVING_EXPR TAOS_DEF_ERROR_CODE(0, 0x2672) #define TSDB_CODE_PAR_INVALID_WIN_OFFSET_UNIT TAOS_DEF_ERROR_CODE(0, 0x2673) #define TSDB_CODE_PAR_VALID_PRIM_TS_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x2674) +#define TSDB_CODE_PAR_ORDERBY_UNKNOWN_EXPR TAOS_DEF_ERROR_CODE(0, 0x2675) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 8d34505093..65c2149261 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -2821,7 +2821,7 @@ int32_t ctgLaunchJob(SCtgJob* pJob) { CTG_ERR_RET((*gCtgAsyncFps[pTask->type].launchFp)(pTask)); pTask = taosArrayGet(pJob->pTasks, i); - pTask->status = CTG_TASK_LAUNCHED; + atomic_val_compare_exchange_32((int32_t*)&pTask->status, 0, CTG_TASK_LAUNCHED); } if (taskNum <= 0) { diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index f8f932903f..d7bac9416f 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -56,6 +56,7 @@ extern "C" { #define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: " #define EXPLAIN_TIMERANGE_FORMAT "Time Range: [%" PRId64 ", %" PRId64 "]" #define EXPLAIN_OUTPUT_FORMAT "Output: " +#define EXPLAIN_JOIN_PARAM_FORMAT "Join Param: " #define EXPLAIN_TIME_WINDOWS_FORMAT "Time Window: interval=%" PRId64 "%c offset=%" PRId64 "%c sliding=%" PRId64 "%c" #define EXPLAIN_WINDOW_FORMAT "Window: gap=%" PRId64 #define EXPLAIN_RATIO_TIME_FORMAT "Ratio: %f" @@ -93,7 +94,6 @@ extern "C" { #define EXPLAIN_SCAN_MODE_FORMAT "mode=%s" #define EXPLAIN_SCAN_DATA_LOAD_FORMAT "data_load=%s" #define EXPLAIN_GROUPS_FORMAT "groups=%d" -#define EXPLAIN_WIDTH_FORMAT "width=%d" #define EXPLAIN_INTERVAL_VALUE_FORMAT "interval=%" PRId64 "%c" #define EXPLAIN_FUNCTIONS_FORMAT "functions=%d" #define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64 @@ -112,6 +112,11 @@ extern "C" { #define EXPLAIN_SRC_SCAN_FORMAT "src_scan=%d,%d" #define EXPLAIN_PLAN_BLOCKING "blocking=%d" #define EXPLAIN_MERGE_MODE_FORMAT "mode=%s" +#define EXPLAIN_ASOF_OP_FORMAT "asof_op='%s'" +#define EXPLAIN_WIN_OFFSET_FORMAT "window_offset=(%s, %s)" +#define EXPLAIN_JLIMIT_FORMAT "jlimit=%" PRId64 +#define EXPLAIN_SEQ_WIN_GRP_FORMAT "seq_win_grp=%d" +#define EXPLAIN_GRP_JOIN_FORMAT "group_join=%d" #define COMMAND_RESET_LOG "resetLog" #define COMMAND_SCHEDULE_POLICY "schedulePolicy" diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 63856c25c0..51c8bcd605 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -22,6 +22,14 @@ #include "systable.h" #include "functionMgt.h" +char *gJoinTypeStr[JOIN_TYPE_MAX_VALUE][JOIN_STYPE_MAX_VALUE] = { + /* NONE OUTER SEMI ANTI ASOF WINDOW */ +/*INNER*/ {"Inner Join", NULL, NULL, NULL, NULL, NULL}, +/*LEFT*/ {"Left Join", "Left Join", "Left Semi Join", "Left Anti Join", "Left ASOF Join", "Left Window Join"}, +/*RIGHT*/ {"Right Join", "Right Join", "Right Semi Join", "Right Anti Join", "Right ASOF Join", "Right Window Join"}, +/*FULL*/ {"Full Join", "Full Join", NULL, NULL, NULL, NULL}, +}; + int32_t qExplainGenerateResNode(SPhysiNode *pNode, SExplainGroup *group, SExplainResNode **pRes); int32_t qExplainAppendGroupResRows(void *pCtx, int32_t groupId, int32_t level, bool singleChannel); @@ -36,6 +44,24 @@ char *qExplainGetDynQryCtrlType(EDynQueryType type) { return "unknown task"; } +char* qExplainGetAsofOpStr(int32_t opType) { + switch (opType) { + case OP_TYPE_GREATER_THAN: + return ">"; + case OP_TYPE_GREATER_EQUAL: + return ">="; + case OP_TYPE_LOWER_THAN: + return "<"; + case OP_TYPE_LOWER_EQUAL: + return "<="; + case OP_TYPE_EQUAL: + return "="; + default: + return "UNKNOWN"; + } +} + + void qExplainFreeResNode(SExplainResNode *resNode) { if (NULL == resNode) { return; @@ -593,7 +619,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: { SSortMergeJoinPhysiNode *pJoinNode = (SSortMergeJoinPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType)); + EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, gJoinTypeStr[pJoinNode->joinType][pJoinNode->subType]); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); @@ -620,6 +646,36 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i EXPLAIN_ROW_END(); QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + if (IS_ASOF_JOIN(pJoinNode->subType) || IS_WINDOW_JOIN(pJoinNode->subType)) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_JOIN_PARAM_FORMAT); + if (IS_ASOF_JOIN(pJoinNode->subType)) { + EXPLAIN_ROW_APPEND(EXPLAIN_ASOF_OP_FORMAT, qExplainGetAsofOpStr(pJoinNode->asofOpType)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + if (NULL != pJoinNode->pWindowOffset) { + SWindowOffsetNode* pWinOffset = (SWindowOffsetNode*)pJoinNode->pWindowOffset; + SValueNode* pStart = (SValueNode*)pWinOffset->pStartOffset; + SValueNode* pEnd = (SValueNode*)pWinOffset->pEndOffset; + EXPLAIN_ROW_APPEND(EXPLAIN_WIN_OFFSET_FORMAT, pStart->literal, pEnd->literal); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + if (NULL != pJoinNode->pJLimit) { + SLimitNode* pJLimit = (SLimitNode*)pJoinNode->pJLimit; + EXPLAIN_ROW_APPEND(EXPLAIN_JLIMIT_FORMAT, pJLimit->limit); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + if (IS_WINDOW_JOIN(pJoinNode->subType)) { + EXPLAIN_ROW_APPEND(EXPLAIN_SEQ_WIN_GRP_FORMAT, pJoinNode->seqWinGroup); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + + EXPLAIN_ROW_APPEND(EXPLAIN_GRP_JOIN_FORMAT, pJoinNode->grpJoin); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_END(); + + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + if (pJoinNode->node.pConditions) { EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT); QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE, @@ -1580,7 +1636,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN:{ SHashJoinPhysiNode *pJoinNode = (SHashJoinPhysiNode *)pNode; - EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, EXPLAIN_JOIN_STRING(pJoinNode->joinType)); + EXPLAIN_ROW_NEW(level, EXPLAIN_JOIN_FORMAT, gJoinTypeStr[pJoinNode->joinType][pJoinNode->subType]); EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); if (pResNode->pExecInfo) { QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); diff --git a/source/libs/executor/inc/mergejoin.h b/source/libs/executor/inc/mergejoin.h index f2c992670f..04e091e325 100755 --- a/source/libs/executor/inc/mergejoin.h +++ b/source/libs/executor/inc/mergejoin.h @@ -19,8 +19,8 @@ extern "C" { #endif -#if 0 -#define MJOIN_DEFAULT_BLK_ROWS_NUM 2 //4096 +#if 1 +#define MJOIN_DEFAULT_BLK_ROWS_NUM 3 //4096 #define MJOIN_HJOIN_CART_THRESHOLD 10 #define MJOIN_BLK_SIZE_LIMIT 0 //10485760 #define MJOIN_ROW_BITMAP_SIZE (2 * 1048576) diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index 9e56fc48fc..6a4840b188 100755 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -48,7 +48,7 @@ static void destroyStbJoinTableList(SStbJoinTableList* pListHead) { } static void destroyStbJoinDynCtrlInfo(SStbJoinDynCtrlInfo* pStbJoin) { - qError("dynQueryCtrl exec info, prevBlk:%" PRId64 ", prevRows:%" PRId64 ", postBlk:%" PRId64 ", postRows:%" PRId64 ", leftCacheNum:%" PRId64 ", rightCacheNum:%" PRId64, + qDebug("dynQueryCtrl exec info, prevBlk:%" PRId64 ", prevRows:%" PRId64 ", postBlk:%" PRId64 ", postRows:%" PRId64 ", leftCacheNum:%" PRId64 ", rightCacheNum:%" PRId64, pStbJoin->execInfo.prevBlkNum, pStbJoin->execInfo.prevBlkRows, pStbJoin->execInfo.postBlkNum, pStbJoin->execInfo.postBlkRows, pStbJoin->execInfo.leftCacheNum, pStbJoin->execInfo.rightCacheNum); @@ -432,7 +432,7 @@ static int32_t buildSeqStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SS int64_t* rightUid = pPrev->pListHead->pRightUid + rowIdx; int32_t code = TSDB_CODE_SUCCESS; - qError("start %" PRId64 ":%" PRId64 "th stbJoin, left:%d,%" PRIu64 " - right:%d,%" PRIu64, + qDebug("start %" PRId64 ":%" PRId64 "th stbJoin, left:%d,%" PRIu64 " - right:%d,%" PRIu64, rowIdx, pPrev->tableNum, *leftVg, *leftUid, *rightVg, *rightUid); updatePostJoinCurrTableInfo(&pInfo->stbJoin); @@ -524,7 +524,7 @@ static int32_t notifySeqJoinTableCacheEnd(SOperatorInfo* pOperator, SStbJoinPost int32_t vgId = leftTable ? pPost->leftVgId : pPost->rightVgId; int64_t uid = leftTable ? pPost->leftCurrUid : pPost->rightCurrUid; - qError("notify table %" PRIu64 " in vgId %d downstreamId %d cache end", uid, vgId, downstreamId); + qDebug("notify table %" PRIu64 " in vgId %d downstreamId %d cache end", uid, vgId, downstreamId); int32_t code = buildGroupCacheNotifyOperatorParam(&pGcParam, downstreamId, vgId, uid); if (TSDB_CODE_SUCCESS != code) { @@ -758,7 +758,7 @@ static void postProcessStbJoinTableHash(SOperatorInfo* pOperator) { } pStbJoin->execInfo.leftCacheNum = tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache); - qError("more than 1 ref build table num %" PRId64, (int64_t)tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache)); + qDebug("more than 1 ref build table num %" PRId64, (int64_t)tSimpleHashGetSize(pStbJoin->ctx.prev.leftCache)); // debug only iter = 0; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 9a480359ed..e4aa4c38c5 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -1143,7 +1143,7 @@ int32_t getTableList(void* pVnode, SScanPhysiNode* pScanNode, SNode* pTagCond, S if (code != 0 || status == SFLT_NOT_INDEX) { // temporarily disable it for performance sake qDebug("failed to get tableIds from index, suid:%" PRIu64, pScanNode->uid); } else { - qInfo("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); + qDebug("succ to get filter result, table num: %d", (int)taosArrayGetSize(pUidList)); } } } diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c index d20ad1d67c..aee60c02cc 100755 --- a/source/libs/executor/src/groupcacheoperator.c +++ b/source/libs/executor/src/groupcacheoperator.c @@ -348,7 +348,7 @@ static int32_t addBlkToDirtyBufList(SGroupCacheOperatorInfo* pGCache, SGcDownstr taosWLockLatch(&pCache->dirtyLock); pCache->blkCacheSize += pBufInfo->basic.bufSize; - qError("group cache total dirty block num:%d size:%" PRId64 , taosHashGetSize(pCache->pDirtyBlk), pCache->blkCacheSize); + qDebug("group cache total dirty block num:%d size:%" PRId64 , taosHashGetSize(pCache->pDirtyBlk), pCache->blkCacheSize); if (NULL == pCache->pDirtyHead) { pCache->pDirtyHead = pBufInfo; @@ -664,7 +664,7 @@ static FORCE_INLINE int32_t getBlkFromDownstreamOperator(struct SOperatorInfo* p } if (pBlock) { - qError("%s blk retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId); + qDebug("%s blk retrieved from group %" PRIu64, GET_TASKID(pOperator->pTaskInfo), pBlock->info.id.groupId); pGCache->execInfo.pDownstreamBlkNum[downstreamIdx]++; if (NULL == pGCache->pDownstreams[downstreamIdx].pBaseBlock) { @@ -803,7 +803,7 @@ static int32_t addNewGroupData(struct SOperatorInfo* pOperator, SOperatorParam* } initNewGroupData(pCtx, *ppGrp, pParam->downstreamIdx, vgId, pGCache->batchFetch, pGcParam->needCache); - qError("new group %" PRIu64 " initialized, downstreamIdx:%d, vgId:%d, needCache:%d", uid, pParam->downstreamIdx, vgId, pGcParam->needCache); + qDebug("new group %" PRIu64 " initialized, downstreamIdx:%d, vgId:%d, needCache:%d", uid, pParam->downstreamIdx, vgId, pGcParam->needCache); if (pParam->pChildren) { SGcNewGroupInfo newGroup; @@ -832,7 +832,7 @@ static int32_t addBlkToGroupCache(bool batchFetch, SGroupCacheData* pGroup, SGcB *pIdx = taosArrayGetSize(pGroup->blkList.pList) - 1; taosWUnLockLatch(&pGroup->blkList.lock); - qError("block added to group cache, total block num:%" PRId64, *pIdx + 1); + qDebug("block added to group cache, total block num:%" PRId64, *pIdx + 1); return TSDB_CODE_SUCCESS; } @@ -870,7 +870,7 @@ static int32_t handleGroupCacheRetrievedBlk(struct SOperatorInfo* pOperator, SSD } if (pGroup->needCache) { - qError("add block to group cache"); + qDebug("add block to group cache"); SGcBlkBufInfo newBlkBuf; code = addBlkToBufCache(pOperator, pBlock, pCtx, pGroup, &newBlkBuf); @@ -883,7 +883,7 @@ static int32_t handleGroupCacheRetrievedBlk(struct SOperatorInfo* pOperator, SSD return code; } } else { - qError("no need to add block to group cache"); + qDebug("no need to add block to group cache"); pGroup->pBlock = pBlock; } @@ -1176,11 +1176,11 @@ static int32_t getBlkFromGroupCache(struct SOperatorInfo* pOperator, SSDataBlock code = getBlkFromSessionCache(pOperator, pGcParam->sessionId, pSession, ppRes); if (NULL == *ppRes) { - qError("session %" PRId64 " in downstream %d total got %" PRId64 " rows", pGcParam->sessionId, pCtx->id, pSession->resRows); + qDebug("session %" PRId64 " in downstream %d total got %" PRId64 " rows", pGcParam->sessionId, pCtx->id, pSession->resRows); taosHashRemove(pCtx->pSessions, &pGcParam->sessionId, sizeof(pGcParam->sessionId)); } else { pSession->resRows += (*ppRes)->info.rows; - qError("session %" PRId64 " in downstream %d got %" PRId64 " rows in one block", pGcParam->sessionId, pCtx->id, (*ppRes)->info.rows); + qDebug("session %" PRId64 " in downstream %d got %" PRId64 " rows in one block", pGcParam->sessionId, pCtx->id, (*ppRes)->info.rows); } return code; diff --git a/source/libs/executor/src/hashjoinoperator.c b/source/libs/executor/src/hashjoinoperator.c index 1c0ef27ae2..b23c2175ec 100755 --- a/source/libs/executor/src/hashjoinoperator.c +++ b/source/libs/executor/src/hashjoinoperator.c @@ -299,7 +299,7 @@ static void destroyHJoinKeyHash(SSHashObj** ppHash) { static void destroyHashJoinOperator(void* param) { SHJoinOperatorInfo* pJoinOperator = (SHJoinOperatorInfo*)param; - qError("hashJoin exec info, buildBlk:%" PRId64 ", buildRows:%" PRId64 ", probeBlk:%" PRId64 ", probeRows:%" PRId64 ", resRows:%" PRId64, + qDebug("hashJoin exec info, buildBlk:%" PRId64 ", buildRows:%" PRId64 ", probeBlk:%" PRId64 ", probeRows:%" PRId64 ", resRows:%" PRId64, pJoinOperator->execInfo.buildBlkNum, pJoinOperator->execInfo.buildBlkRows, pJoinOperator->execInfo.probeBlkNum, pJoinOperator->execInfo.probeBlkRows, pJoinOperator->execInfo.resRows); @@ -756,7 +756,7 @@ static void setHJoinDone(struct SOperatorInfo* pOperator) { SHJoinOperatorInfo* pInfo = pOperator->info; destroyHJoinKeyHash(&pInfo->pKeyHash); - qError("hash Join done"); + qDebug("hash Join done"); } static SSDataBlock* doHashJoin(struct SOperatorInfo* pOperator) { @@ -916,7 +916,7 @@ SOperatorInfo* createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t n pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, doHashJoin, NULL, destroyHashJoinOperator, optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL); - qError("create hash Join operator done"); + qDebug("create hash Join operator done"); return pOperator; diff --git a/source/libs/executor/src/mergejoin.c b/source/libs/executor/src/mergejoin.c index 40baa1b4b6..099d1fadee 100755 --- a/source/libs/executor/src/mergejoin.c +++ b/source/libs/executor/src/mergejoin.c @@ -2632,12 +2632,13 @@ static FORCE_INLINE void mWinJoinPopFrontGroup(SMJoinWindowCtx* pCtx, SMJoinGrpR static int32_t mWinJoinCloneCacheBlk(SMJoinWindowCtx* pCtx) { SMJoinWinCache* pCache = &pCtx->cache; - int32_t grpNum = taosArrayGetSize(pCache->grps); + SArray* pGrpArray = (NULL != pCache->grps) ? pCache->grps : pCache->grpsQueue; + int32_t grpNum = taosArrayGetSize(pGrpArray); if (grpNum <= 0) { return TSDB_CODE_SUCCESS; } - SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayGetLast(pCache->grps); + SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayGetLast(pGrpArray); if (!pGrp->clonedBlk) { if (0 == pGrp->beginIdx) { pGrp->blk = createOneDataBlock(pGrp->blk, true); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index a6613e589a..899a920328 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -929,7 +929,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) { return TSDB_CODE_INVALID_PARA; } - qError("vgId:%d add total %d dynamic tables to scan, tableSeq:%d, exist num:%" PRId64 ", operator status:%d", + qDebug("vgId:%d add total %d dynamic tables to scan, tableSeq:%d, exist num:%" PRId64 ", operator status:%d", pTaskInfo->id.vgId, num, pParam->tableSeq, (int64_t)taosArrayGetSize(pListInfo->pTableList), pOperator->status); if (pParam->tableSeq) { @@ -963,7 +963,7 @@ static int32_t createTableListInfoFromParam(SOperatorInfo* pOperator) { } tableIdx++; - qError("add dynamic table scan uid:%" PRIu64 ", %s", info.uid, GET_TASKID(pTaskInfo)); + qDebug("add dynamic table scan uid:%" PRIu64 ", %s", info.uid, GET_TASKID(pTaskInfo)); } return code; diff --git a/source/libs/executor/test/joinTests.cpp b/source/libs/executor/test/joinTests.cpp index 5d5c5e9395..cb921aece7 100755 --- a/source/libs/executor/test/joinTests.cpp +++ b/source/libs/executor/test/joinTests.cpp @@ -868,7 +868,8 @@ SSDataBlock* createDummyBlock(int32_t blkId) { p->info.id.blockId = blkId; p->info.type = STREAM_INVALID; - p->info.calWin = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX}; + p->info.calWin.skey = INT64_MIN; + p->info.calWin.ekey = INT64_MAX; p->info.watermark = INT64_MIN; for (int32_t i = 0; i < MAX_SLOT_NUM; ++i) { @@ -2442,15 +2443,18 @@ void joinTestReplaceRetrieveFp() { AddrAny any; std::map result; any.get_func_addr("getNextBlockFromDownstreamRemain", result); + for (const auto &f : result) { + stub.set(f.second, getDummyInputBlock); + } #endif #ifdef LINUX AddrAny any("libexecutor.so"); std::map result; any.get_global_func_addr_dynsym("^getNextBlockFromDownstreamRemain$", result); -#endif for (const auto &f : result) { stub.set(f.second, getDummyInputBlock); } +#endif } } @@ -2858,7 +2862,7 @@ void runSingleTest(char* caseName, SJoinTestParam* param) { bool contLoop = true; SSortMergeJoinPhysiNode* pNode = createDummySortMergeJoinPhysiNode(param); - createDummyBlkList(10, 10, 10, 10, 3); + createDummyBlkList(20, 20, 20, 20, 3); while (contLoop) { rerunBlockedHere(); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index a2fbe8db6e..b55132c644 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -720,6 +720,28 @@ static int32_t initTranslateContext(SParseContext* pParseCxt, SParseMetaCache* p return TSDB_CODE_SUCCESS; } +static int32_t resetHighLevelTranslateNamespace(STranslateContext* pCxt) { + if (NULL != pCxt->pNsLevel) { + size_t size = taosArrayGetSize(pCxt->pNsLevel); + int32_t levelNum = size - pCxt->currLevel; + if (levelNum <= 0) { + return TSDB_CODE_SUCCESS; + } + + for (int32_t i = size - 1; i >= pCxt->currLevel; --i) { + taosArrayDestroy(taosArrayGetP(pCxt->pNsLevel, i)); + } + taosArrayPopTailBatch(pCxt->pNsLevel, levelNum); + + return TSDB_CODE_SUCCESS; + } + pCxt->pNsLevel = taosArrayInit(TARRAY_MIN_SIZE, POINTER_BYTES); + if (NULL == pCxt->pNsLevel) { + return TSDB_CODE_OUT_OF_MEMORY; + } + return TSDB_CODE_SUCCESS; +} + static int32_t resetTranslateNamespace(STranslateContext* pCxt) { if (NULL != pCxt->pNsLevel) { size_t size = taosArrayGetSize(pCxt->pNsLevel); @@ -5384,6 +5406,8 @@ static int32_t appendTsForImplicitTsFunc(STranslateContext* pCxt, SSelectStmt* p typedef struct SReplaceOrderByAliasCxt { STranslateContext* pTranslateCxt; SNodeList* pProjectionList; + bool nameMatch; + bool notFound; } SReplaceOrderByAliasCxt; static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { @@ -5393,8 +5417,8 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { if (QUERY_NODE_COLUMN == nodeType(*pNode)) { FOREACH(pProject, pProjectionList) { SExprNode* pExpr = (SExprNode*)pProject; - if (0 == strcmp(((SColumnRefNode*)*pNode)->colName, pExpr->userAlias) && nodeType(*pNode) == nodeType(pProject)) { - if (QUERY_NODE_COLUMN == nodeType(pProject) && !nodesEqualNode(*pNode, pProject)) { + if (0 == strcmp(((SColumnNode*)*pNode)->colName, pExpr->userAlias)) { + if (!pCxt->nameMatch && (nodeType(*pNode) != nodeType(pProject) || (QUERY_NODE_COLUMN == nodeType(pProject) && !nodesEqualNode(*pNode, pProject)))) { continue; } SNode* pNew = nodesCloneNode(pProject); @@ -5408,6 +5432,8 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } } + + pCxt->notFound = true; } else if (QUERY_NODE_ORDER_BY_EXPR == nodeType(*pNode)) { STranslateContext* pTransCxt = pCxt->pTranslateCxt; SNode* pExpr = ((SOrderByExprNode*)*pNode)->pExpr; @@ -5434,12 +5460,16 @@ static EDealRes replaceOrderByAliasImpl(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } -static int32_t replaceOrderByAlias(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pOrderByList) { +static int32_t replaceOrderByAlias(STranslateContext* pCxt, SNodeList* pProjectionList, SNodeList* pOrderByList, bool checkExists, bool nameMatch) { if (NULL == pOrderByList) { return TSDB_CODE_SUCCESS; } - SReplaceOrderByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pProjectionList}; + SReplaceOrderByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pProjectionList, .nameMatch = nameMatch, .notFound = false}; nodesRewriteExprsPostOrder(pOrderByList, replaceOrderByAliasImpl, &cxt); + if (checkExists && cxt.notFound) { + return TSDB_CODE_PAR_ORDERBY_UNKNOWN_EXPR; + } + return pCxt->errCode; } @@ -5458,7 +5488,7 @@ static void resetResultTimeline(SSelectStmt* pSelect) { } static int32_t replaceOrderByAliasForSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { - int32_t code = replaceOrderByAlias(pCxt, pSelect->pProjectionList, pSelect->pOrderByList); + int32_t code = replaceOrderByAlias(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, false, false); if (TSDB_CODE_SUCCESS == pCxt->errCode) { resetResultTimeline(pSelect); } @@ -5599,10 +5629,16 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS } snprintf(pRightExpr->aliasName, sizeof(pRightExpr->aliasName), "%s", pLeftExpr->aliasName); SNode* pProj = createSetOperProject(pSetOperator->stmtName, pLeft); - if (QUERY_NODE_COLUMN == nodeType(pLeft) && QUERY_NODE_COLUMN == nodeType(pRight) && - ((SColumnNode*)pLeft)->colId == PRIMARYKEY_TIMESTAMP_COL_ID && - ((SColumnNode*)pRight)->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { - ((SColumnNode*)pProj)->colId = PRIMARYKEY_TIMESTAMP_COL_ID; + if (QUERY_NODE_COLUMN == nodeType(pLeft) && QUERY_NODE_COLUMN == nodeType(pRight)) { + SColumnNode* pLCol = (SColumnNode*)pLeft; + SColumnNode* pRCol = (SColumnNode*)pRight; + SColumnNode* pFCol = (SColumnNode*)pProj; + if (pLCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID && pRCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { + pFCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID; + if (pLCol->isPrimTs && pRCol->isPrimTs) { + pFCol->isPrimTs = true; + } + } } if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSetOperator->pProjectionList, pProj)) { return TSDB_CODE_OUT_OF_MEMORY; @@ -5622,6 +5658,7 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS bool other; int32_t code = translateOrderByPosition(pCxt, pSetOperator->pProjectionList, pSetOperator->pOrderByList, &other); +/* if (TSDB_CODE_SUCCESS == code) { if (other) { pCxt->currClause = SQL_CLAUSE_ORDER_BY; @@ -5629,8 +5666,9 @@ static int32_t translateSetOperOrderBy(STranslateContext* pCxt, SSetOperator* pS code = translateExprList(pCxt, pSetOperator->pOrderByList); } } +*/ if (TSDB_CODE_SUCCESS == code) { - code = replaceOrderByAlias(pCxt, pSetOperator->pProjectionList, pSetOperator->pOrderByList); + code = replaceOrderByAlias(pCxt, pSetOperator->pProjectionList, pSetOperator->pOrderByList, true, true); } if (TSDB_CODE_SUCCESS == code) { SNode* pOrder = ((SOrderByExprNode*)nodesListGetNode(pSetOperator->pOrderByList, 0))->pExpr; @@ -5653,7 +5691,7 @@ static int32_t checkSetOperLimit(STranslateContext* pCxt, SLimitNode* pLimit) { static int32_t translateSetOperator(STranslateContext* pCxt, SSetOperator* pSetOperator) { int32_t code = translateQuery(pCxt, pSetOperator->pLeft); if (TSDB_CODE_SUCCESS == code) { - code = resetTranslateNamespace(pCxt); + code = resetHighLevelTranslateNamespace(pCxt); } if (TSDB_CODE_SUCCESS == code) { code = translateQuery(pCxt, pSetOperator->pRight); diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index c15c99e449..8ead27a01c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1334,7 +1334,7 @@ static int32_t pdcDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) { } } - if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pFullOnCond && !IS_WINDOW_JOIN(pJoin->subType)) { + if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pFullOnCond && !IS_WINDOW_JOIN(pJoin->subType) && NULL == pJoin->addPrimEqCond) { code = pdcJoinSplitPrimEqCond(pCxt, pJoin); } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 03c85d5b0b..a6b97c7c04 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1569,7 +1569,13 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl ++(pCxt->groupId); } if (TSDB_CODE_SUCCESS == code) { - nodesDestroyList(pSubplanChildren); + if (NULL != pSubplanChildren) { + if (pSubplanChildren->length > 0) { + nodesListMakeStrictAppendList(&pUnionSubplan->pChildren, pSubplanChildren); + } else { + nodesDestroyList(pSubplanChildren); + } + } NODES_DESTORY_LIST(pSplitNode->pChildren); } return code; diff --git a/source/libs/scheduler/src/schUtil.c b/source/libs/scheduler/src/schUtil.c index 47e6d53b46..82b2e021af 100644 --- a/source/libs/scheduler/src/schUtil.c +++ b/source/libs/scheduler/src/schUtil.c @@ -234,7 +234,7 @@ int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans) { hb = taosHashGet(schMgmt.hbConnections, epId, sizeof(SQueryNodeEpId)); if (NULL == hb) { SCH_UNLOCK(SCH_READ, &schMgmt.hbLock); - qInfo("taosHashGet hb connection not exists, nodeId:%d, fqdn:%s, port:%d", epId->nodeId, epId->ep.fqdn, + qDebug("taosHashGet hb connection not exists, nodeId:%d, fqdn:%s, port:%d", epId->nodeId, epId->ep.fqdn, epId->ep.port); SCH_ERR_RET(TSDB_CODE_APP_ERROR); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 89f9a54129..fdf6fe3526 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -631,6 +631,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WJOIN_HAVING_EXPR, "Invalid window join TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GRP_WINDOW_NOT_ALLOWED, "GROUP BY/PARTITION BY/WINDOW-clause can't be used in WINDOW join") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WIN_OFFSET_UNIT, "Invalid window offset unit") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALID_PRIM_TS_REQUIRED, "Valid primary timestamp required") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ORDERBY_UNKNOWN_EXPR, "Unknown expr in order by clause") //planner TAOS_DEFINE_ERROR(TSDB_CODE_PLAN_INTERNAL_ERROR, "Planner internal error") diff --git a/tests/script/tsim/join/inner_join.sim b/tests/script/tsim/join/inner_join.sim index 8f18c1386a..65a6a3e3ff 100644 --- a/tests/script/tsim/join/inner_join.sim +++ b/tests/script/tsim/join/inner_join.sim @@ -185,3 +185,13 @@ if $data11 != @23-11-17 16:29:04.000@ then return -1 endi +sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; +if $rows != 6 then + return -1 +endi +sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; +if $rows != 144 then + return -1 +endi + + diff --git a/tests/script/tsim/join/join.sim b/tests/script/tsim/join/join.sim index ebb475ef2f..47620f34eb 100644 --- a/tests/script/tsim/join/join.sim +++ b/tests/script/tsim/join/join.sim @@ -73,6 +73,7 @@ run tsim/join/join_scalar.sim run tsim/join/join_timeline.sim run tsim/join/join_nested.sim run tsim/join/join_boundary.sim +run tsim/join/join_explain.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT @@ -95,5 +96,6 @@ run tsim/join/join_scalar.sim run tsim/join/join_timeline.sim run tsim/join/join_nested.sim run tsim/join/join_boundary.sim +run tsim/join/join_explain.sim system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/join/join_boundary.sim b/tests/script/tsim/join/join_boundary.sim index 174ecb75c2..3ada18d663 100644 --- a/tests/script/tsim/join/join_boundary.sim +++ b/tests/script/tsim/join/join_boundary.sim @@ -44,6 +44,18 @@ sql select b.col1 from sta a ,sta b where a.ts=b.ts and a.col1 + 1 = b.col1 orde sql select b.col1 from sta a join sta b join sta c where a.ts=b.ts and b.ts = c.ts order by a.ts; sql select b.col1 from (select ts from sta) a join (select ts, col1 from sta) b join sta c where a.ts=b.ts and b.ts = c.ts order by a.ts; sql_error select b.col1 from sta a join sta b join sta c where a.ts=b.ts and a.ts = b.ts order by a.ts; +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by col1; +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by col1; +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by 1; +sql (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts)) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) d on c.ts = d.ts; +sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; sql select a.ts from test0.sta a ,testb.stb1 b where a.ts=b.ts; #left join @@ -67,6 +79,18 @@ sql select b.col1 from (select ts from sta) a left join (select ts, col1 from st sql_error select b.col1 from (select ts from sta) a left join (select ts, col1 from sta) b left join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; sql_error select b.col1 from sta a left join sta b left join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; sql select a.ts from test0.sta a left join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts)) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; #left semi join sql_error select a.ts from sta a left semi join sta b; @@ -90,6 +114,18 @@ sql select b.col1 from (select ts from sta) a left semi join (select ts, col1 fr sql_error select b.col1 from (select ts from sta) a left semi join (select ts, col1 from sta) b left semi join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; sql_error select b.col1 from sta a left semi join sta b left semi join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; sql select a.ts from test0.sta a left semi join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts)) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; #left anti join sql_error select a.ts from sta a left anti join sta b; @@ -113,6 +149,20 @@ sql select b.col1 from (select ts from sta) a left anti join (select ts, col1 fr sql_error select b.col1 from (select ts from sta) a left anti join (select ts, col1 from sta) b left anti join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; sql_error select b.col1 from sta a left anti join sta b left anti join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; sql select a.ts from test0.sta a left anti join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts)) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + + #left asof join sql select a.ts from sta a left asof join sta b; @@ -121,6 +171,7 @@ sql_error select a.ts from sta a left asof join sta b on a.ts = b.ts and a.ts = sql_error select a.ts from sta a left asof join sta b on a.ts = b.ts or a.col1 = b.col1; sql select a.ts from sta a left asof join sta b on a.ts = b.ts and a.col1 = b.col1; sql select a.ts from sta a left asof join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql select a.col1 from sta a left asof join sta b on a.col1=b.col1 and a.t1 = b.t1; sql select a.ts from sta a left asof join sta b where a.ts = b.ts; sql select a.ts from sta a left asof join sta b where a.ts = b.ts or a.ts = b.ts; sql select a.ts from sta a left asof join sta b on a.col1 = b.col1; @@ -146,6 +197,18 @@ sql_error select b.col1 from (select ts from sta) a left asof join (select ts, c sql_error select b.col1 from (select ts from sta) a left asof join (select ts, col1 from sta) b left asof join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; sql_error select b.col1 from sta a left asof join sta b left asof join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; sql select a.ts from test0.sta a left asof join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts)) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; #left window join sql_error select a.ts from sta a left window join sta b; @@ -233,27 +296,302 @@ sql select diff(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s) sql select csum(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s); sql_error select interp(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s) RANGE(now -1d, now) every(1s) fill(null); sql_error select a.col1, b.col1, count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where count(a.col1) > 0; +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts); +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts); +sql_error (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by a.ts; +sql_error (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by a.ts; +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by col1; +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by col1; +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by 1; +sql (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by 1; +sql_error select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s))) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; +#right join +sql_error select a.ts from sta a right join sta b; +sql_error select a.ts from sta a right join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right join sta b on a.col1 = b.col1; +sql_error select a.ts from sta a right join sta b on a.col1 is not NULL; +sql_error select a.ts from sta a right join sta b on a.ts + 1 = b.col1; +sql_error select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error select a.ts from sta a right join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error select a.ts from sta a right join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error select a.ts from sta a right join sta b where a.ts = b.ts; +sql_error select b.col1 from sta a right join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from sta a right join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from (select ts from sta) a right join (select ts, col1 from sta) b on a.ts = b.ts order by a.ts; +sql_error select b.col1 from (select ts from sta) a right join (select ts, col1 from sta) b right join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error select b.col1 from sta a right join sta b right join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql select a.ts from test0.sta a right join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts)) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right semi join +sql_error select a.ts from sta a right semi join sta b; +sql_error select a.ts from sta a right semi join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right semi join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right semi join sta b on a.col1 = b.col1; +sql_error select a.ts from sta a right semi join sta b on a.col1 like '1'; +sql_error select a.ts from sta a right semi join sta b on a.col1 is null; +sql_error select a.ts from sta a right semi join sta b on a.ts + 1 = b.col1; +sql_error select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error select a.ts from sta a right semi join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error select a.ts from sta a right semi join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error select a.ts from sta a right semi join sta b where a.ts = b.ts; +sql_error select b.col1 from sta a right semi join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from sta a right semi join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from (select ts from sta) a right semi join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error select b.col1 from (select ts from sta) a right semi join (select ts, col1 from sta) b right semi join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error select b.col1 from sta a right semi join sta b right semi join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql select a.ts from test0.sta a right semi join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts)) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right anti join +sql_error select a.ts from sta a right anti join sta b; +sql_error select a.ts from sta a right anti join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right anti join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right anti join sta b on a.col1 = b.col1; +sql_error select a.ts from sta a right anti join sta b on a.col1 / 1; +sql_error select a.ts from sta a right anti join sta b on a.col1 is null; +sql_error select a.ts from sta a right anti join sta b on a.ts + 1 = b.col1; +sql_error select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error select a.ts from sta a right anti join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error select a.ts from sta a right anti join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error select a.ts from sta a right anti join sta b where a.ts = b.ts; +sql_error select b.col1 from sta a right anti join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from sta a right anti join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from (select ts from sta) a right anti join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error select b.col1 from (select ts from sta) a right anti join (select ts, col1 from sta) b right anti join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error select b.col1 from sta a right anti join sta b right anti join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql select a.ts from test0.sta a right anti join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts)) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right asof join +sql select a.ts from sta a right asof join sta b; +sql_error select a.ts from sta a right asof join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right asof join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error select a.ts from sta a right asof join sta b on a.ts = b.ts or a.col1 = b.col1; +sql select a.ts from sta a right asof join sta b on a.ts = b.ts and a.col1 = b.col1; +sql select a.ts from sta a right asof join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql select a.col1 from sta a right asof join sta b on a.col1 = b.col1 and a.t1 = b.t1; +sql select a.ts from sta a right asof join sta b where a.ts = b.ts; +sql select a.ts from sta a right asof join sta b where a.ts = b.ts or a.ts = b.ts; +sql select a.ts from sta a right asof join sta b on a.col1 = b.col1; +sql_error select a.ts from sta a right asof join sta b on a.ts != b.ts; +sql_error select a.ts from sta a right asof join sta b on a.ts is null; +sql_error select a.ts from sta a right asof join sta b on a.ts + 1 = b.col1; +sql select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 0; +sql select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1024; +sql_error select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1025; +sql_error select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit -1; +sql_error select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts; +sql select a.ts from sta a right asof join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql select a.ts from sta a right asof join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql select a.ts from sta a right asof join sta b where a.ts = b.ts; +sql select b.col1 from sta a right asof join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error select b.col1 from sta a right asof join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error select b.col1 from sta a right asof join sta b on a.ts = b.ts and 1 = 2 order by a.ts; +sql_error select b.col1 from (select ts from sta) a right asof join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error select b.col1 from (select ts from sta) a right asof join (select ts, col1 from sta) b right asof join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error select b.col1 from sta a right asof join sta b right asof join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql select a.ts from test0.sta a right asof join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts)) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right window join +sql_error select a.ts from sta a right window join sta b; +sql_error select a.ts from sta a right window join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b on a.ts = b.ts or a.col1 = b.col1; +sql_error select a.ts from sta a right window join sta b on a.ts = b.ts and a.col1 = b.col1; +sql_error select a.ts from sta a right window join sta b on a.ts = b.ts and a.col1 = b.col1 window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b on a.col1 = b.col1 and a.ts = b.ts window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b where a.ts = b.ts; +sql select a.ts from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b where a.ts = b.ts or a.ts = b.ts; +sql select a.ts from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b on a.col1 = b.col1; +sql select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s); +sql select a.ts from sta a right window join sta b on a.t1 = b.t1 window_offset(-1s,1s); +sql select a.ts from sta a right window join sta b on a.t1 = b.t1 and a.col1 = b.col1 window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on a.t1 = b.t1 or a.col1 = b.col1 window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on a.ts != b.ts; +sql_error select a.ts from sta a right window join sta b on a.ts != b.ts window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on a.ts is null; +sql_error select a.ts from sta a right window join sta b on a.ts is null window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on a.ts + 1 = b.col1; +sql_error select a.ts from sta a right window join sta b on a.ts + 1 = b.col1 window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) > b.ts window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts + 1 window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 0; +sql select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1024; +sql_error select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1025; +sql_error select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit -1; +sql select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s, 1s) jlimit 1; +sql_error select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error select a.ts from sta a right window join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1; +sql select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.ts = b.ts; +sql_error select a.ts from sta a right window join sta b where a.ts = b.ts; +sql_error select b.col1 from sta a right window join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error select b.col1 from sta a right window join sta b on a.ts = b.ts window_offset(-1s,1s) order by a.ts; +sql_error select b.col1 from sta a right window join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 window_offset(-1s,1s) order by a.ts; +sql_error select b.col1 from sta a right window join sta b on a.ts = b.ts and 1 = 2 window_offset(-1s,1s) order by a.ts; +sql_error select b.col1 from (select ts from sta) a right window join (select ts, col1 from sta) b window_offset(-1s,1s) order by a.ts; +sql_error select b.col1 from (select ts from sta) a right window join (select ts, col1 from sta) b right window join sta c window_offset(-1s,1s) order by a.ts; +sql_error select b.col1 from sta a right window join sta b right window join sta c window_offset(-1s,1s) order by a.ts; +sql_error select a.ts from test0.sta a right window join testb.stb1 b window_offset(-1s,1s); +sql select a.ts from testb.stb1 a right window join testb.stb1 b window_offset(-1s,1s); +sql_error select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit a.col1; +sql_error select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit 1 + 1; +sql_error select a.ts from sta a right window join sta b window_offset(1s,1s-1s) jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(-1a,1a) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1b,1b) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1b,1s) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1u,1u) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1u,1s) jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(-1h,1m) jlimit 1; +sql select a.ts from sta a right window join sta b window_offset(-1d,1w) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1n,1n) jlimit 1; +sql_error select a.ts from sta a right window join sta b window_offset(-1y,1y) jlimit 1; +sql connect; +sql use testb; +sql_error select a.ts from stb1 a right window join stb1 b window_offset(-1b,1b) jlimit 1; +sql_error select a.ts from stb1 a right window join stb1 b window_offset(-1b,1s) jlimit 1; +sql select a.ts from stb1 a right window join stb1 b window_offset(-1u,1u) jlimit 1; +sql select a.ts from stb1 a right window join stb1 b window_offset(-1s,1s) jlimit 1; +sql connect; +sql use test0; +sql_error select a.col1 from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 group by a.col1; +sql_error select a.col1 from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 partition by a.col1; +sql_error select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 interval(1s); +sql_error select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 session(a.ts, 1s); +sql_error select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 state_window(a.col1); +sql select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(count(a.col1) > 0); +sql_error select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(a.col1 > 0); +sql select a.col1, b.col1, count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 > 0; +sql_error select a.col1, b.col1, count(a.col1) from sta a right window join sta b window_offset(-1s,1s) where a.col1 > 0; +sql_error select diff(a.col1) from sta a right window join sta b window_offset(-1s,1s); +sql_error select csum(a.col1) from sta a right window join sta b window_offset(-1s,1s); +sql select diff(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s); +sql select csum(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s); +sql_error select interp(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s) RANGE(now -1d, now) every(1s) fill(null); +sql_error select a.col1, b.col1, count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where count(a.col1) > 0; +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts); +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts); +sql_error (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by a.ts; +sql_error (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by a.ts; +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by col1; +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by col1; +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by 1; +sql (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by 1; +sql_error select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s))) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; - - - - - - - - - - - - - - - - - - +#full join +sql_error select a.ts from sta a full join sta b; +sql_error select a.ts from sta a full join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a full join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error select a.ts from sta a full join sta b on a.col1 = b.col1; +sql_error select a.ts from sta a full join sta b on a.col1 is not NULL; +sql_error select a.ts from sta a full join sta b on a.ts + 1 = b.col1; +sql_error select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error select a.ts from sta a full join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error select a.ts from sta a full join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error select a.ts from sta a full join sta b where a.ts = b.ts; +sql_error select b.col1 from sta a full join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from sta a full join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql select b.col1 from (select ts from sta) a full join (select ts, col1 from sta) b on a.ts = b.ts order by a.ts; +sql_error select b.col1 from (select ts from sta) a full join (select ts, col1 from sta) b full join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error select b.col1 from sta a full join sta b full join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql select a.ts from test0.sta a full join testb.stb1 b on a.ts = b.ts; +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts order by a.ts); +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts order by a.ts); +sql_error (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by a.ts; +sql_error (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by a.ts; +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by col1; +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by 1; +sql (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by 1; +sql_error select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts)) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; diff --git a/tests/script/tsim/join/join_explain.sim b/tests/script/tsim/join/join_explain.sim new file mode 100644 index 0000000000..f9d2f3eac1 --- /dev/null +++ b/tests/script/tsim/join/join_explain.sim @@ -0,0 +1,598 @@ +sql connect +sql use test0; + +#join type +sql_error explain analyze verbose true select a.ts from sta a outer join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a semi join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a anti join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a asof join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a window join sta b window_offset(-1s, 1s); +sql_error explain analyze verbose true select a.ts from sta a inner outer join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a inner semi join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a inner anti join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a inner asof join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a inner window join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left inner join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right inner join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full inner join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full semi join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full anti join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full asof join sta b on b.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full window join sta b window_offset(-1s, 1s); + +#inner join +sql_error explain analyze verbose true select a.ts from sta a join sta b; +sql_error explain analyze verbose true select a.ts from sta a join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a join sta b on a.col1 is null; +sql_error explain analyze verbose true select a.ts from sta a join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql explain analyze verbose true select a.ts from sta a join sta b on a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts; +sql explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1w); +sql_error explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql_error explain analyze verbose true select a.ts from sta a join sta b on a.col1 = b.col1 where a.col1=b.col1; +sql explain analyze verbose true select a.ts from sta a join sta b on a.col1 = b.col1 where a.ts=b.ts; +sql explain analyze verbose true select a.ts from sta a join sta b where a.ts=b.ts; +sql_error explain analyze verbose true select a.ts from sta a ,sta b on a.ts=b.ts; +sql explain analyze verbose true select a.ts from sta a ,sta b where a.ts=b.ts; +sql explain analyze verbose true select a.ts from sta a ,sta b where a.ts=b.ts and a.col1 + 1 = b.col1; +sql explain analyze verbose true select b.col1 from sta a ,sta b where a.ts=b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a join sta b join sta c where a.ts=b.ts and b.ts = c.ts order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a join (select ts, col1 from sta) b join sta c where a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a join sta b join sta c where a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a ,testb.stb1 b where a.ts=b.ts; +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts order by a.ts); +sql_error analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by a.ts; +sql_error analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union (select a.col1 from sta a join sta b where a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a join sta b where a.ts=b.ts order by a.ts) union all (select a.col1 from sta a join sta b where a.ts=b.ts) order by 1; +sql_error analyze verbose true select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts)) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) d on c.ts = d.ts; +sql_error analyze verbose true select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts)) d on c.ts = d.ts; +sql explain analyze verbose true select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql explain analyze verbose true select c.ts from ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) c join ((select a.ts from sta a join sta b where a.ts=b.ts order by a.ts) union all (select b.ts from sta a join sta b where a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#left join +sql_error explain analyze verbose true select a.ts from sta a left join sta b; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.col1 is not NULL; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a left join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a left join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a left join (select ts, col1 from sta) b on a.ts = b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left join (select ts, col1 from sta) b left join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left join sta b left join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a left join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts)) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) c left join ((select a.ts from sta a left join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#left semi join +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.col1 like '1'; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.col1 is null; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left semi join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a left semi join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a left semi join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a left semi join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left semi join (select ts, col1 from sta) b left semi join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left semi join sta b left semi join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a left semi join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left semi join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts)) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) c left semi join ((select a.ts from sta a left semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#left anti join +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.col1 / 1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.col1 is null; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left anti join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a left anti join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a left anti join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a left anti join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left anti join (select ts, col1 from sta) b left anti join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left anti join sta b left anti join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a left anti join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left anti join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts)) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) c left anti join ((select a.ts from sta a left anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#left asof join +sql explain analyze verbose true select a.ts from sta a left asof join sta b; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts = b.ts or a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts = b.ts and a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql explain analyze verbose true select a.col1 from sta a left asof join sta b on a.col1 = b.col1 and a.t1 = b.t1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a left asof join sta b where a.ts = b.ts or a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts != b.ts; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts is null; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on a.ts + 1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 0; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1024; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1025; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit -1; +sql_error explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left asof join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a left asof join sta b where a.ts = b.ts; +sql explain analyze verbose true select b.col1 from sta a left asof join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left asof join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left asof join sta b on a.ts = b.ts and 1 = 2 order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left asof join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left asof join (select ts, col1 from sta) b left asof join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left asof join sta b left asof join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a left asof join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a left asof join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts)) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) c left asof join ((select a.ts from sta a left asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a left asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#left window join +sql_error explain analyze verbose true select a.ts from sta a left window join sta b; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts = b.ts or a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts = b.ts and a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts = b.ts and a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 and a.ts = b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b where a.ts = b.ts or a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.t1 = b.t1 and a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.t1 = b.t1 or a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts != b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts != b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts is null; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts is null window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.ts + 1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) > b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts + 1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 0; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1024; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1025; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit -1; +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s, 1s) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a left window join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a left window join sta b window_offset(-1s,1s) where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left window join sta b on a.ts = b.ts window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left window join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left window join sta b on a.ts = b.ts and 1 = 2 window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left window join (select ts, col1 from sta) b window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a left window join (select ts, col1 from sta) b left window join sta c window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a left window join sta b left window join sta c window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select a.ts from test0.sta a left window join testb.stb1 b window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from testb.stb1 a left window join testb.stb1 b window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit a.col1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit 1 + 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(1s,1s-1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1a,1a) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1b,1b) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1b,1s) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1u,1u) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1u,1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1h,1m) jlimit 1; +sql explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1d,1w) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1n,1n) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a left window join sta b window_offset(-1y,1y) jlimit 1; +sql connect; +sql use testb; +sql_error explain analyze verbose true select a.ts from stb1 a left window join stb1 b window_offset(-1b,1b) jlimit 1; +sql_error explain analyze verbose true select a.ts from stb1 a left window join stb1 b window_offset(-1b,1s) jlimit 1; +sql explain analyze verbose true select a.ts from stb1 a left window join stb1 b window_offset(-1u,1u) jlimit 1; +sql explain analyze verbose true select a.ts from stb1 a left window join stb1 b window_offset(-1s,1s) jlimit 1; +sql connect; +sql use test0; +sql_error explain analyze verbose true select a.col1 from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 group by a.col1; +sql_error explain analyze verbose true select a.col1 from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 partition by a.col1; +sql_error explain analyze verbose true select count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 interval(1s); +sql_error explain analyze verbose true select count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 session(a.ts, 1s); +sql_error explain analyze verbose true select count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 state_window(a.col1); +sql explain analyze verbose true select count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(count(a.col1) > 0); +sql_error explain analyze verbose true select count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(a.col1 > 0); +sql explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 > 0; +sql_error explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a left window join sta b window_offset(-1s,1s) where a.col1 > 0; +sql_error explain analyze verbose true select diff(a.col1) from sta a left window join sta b window_offset(-1s,1s); +sql_error explain analyze verbose true select csum(a.col1) from sta a left window join sta b window_offset(-1s,1s); +sql explain analyze verbose true select diff(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s); +sql explain analyze verbose true select csum(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s); +sql_error explain analyze verbose true select interp(a.col1) from tba1 a left window join tba1 b window_offset(0s,0s) RANGE(now -1d, now) every(1s) fill(null); +sql_error explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where count(a.col1) > 0; +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by col1; +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by 1; +sql explain analyze verbose true (select b.col1 from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a left window join sta b window_offset(-1s,1s)) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s))) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) c left window join ((select a.ts from sta a left window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a left window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; + + +#right join +sql_error explain analyze verbose true select a.ts from sta a right join sta b; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.col1 is not NULL; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a right join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a right join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a right join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a right join (select ts, col1 from sta) b on a.ts = b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right join (select ts, col1 from sta) b right join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right join sta b right join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a right join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts)) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) c right join ((select a.ts from sta a right join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right semi join +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.col1 like '1'; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.col1 is null; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a right semi join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right semi join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a right semi join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a right semi join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a right semi join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right semi join (select ts, col1 from sta) b right semi join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right semi join sta b right semi join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a right semi join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right semi join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts)) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) c right semi join ((select a.ts from sta a right semi join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right semi join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right anti join +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.col1 / 1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.col1 is null; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a right anti join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right anti join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a right anti join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a right anti join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a right anti join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right anti join (select ts, col1 from sta) b right anti join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right anti join sta b right anti join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a right anti join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right anti join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts)) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) c right anti join ((select a.ts from sta a right anti join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right anti join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right asof join +sql explain analyze verbose true select a.ts from sta a right asof join sta b; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts = b.ts or a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts = b.ts and a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql explain analyze verbose true select a.col1 from sta a right asof join sta b on a.col1 = b.col1 and a.t1 = b.t1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a right asof join sta b where a.ts = b.ts or a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts != b.ts; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts is null; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on a.ts + 1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 0; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1024; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1025; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit -1; +sql_error explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a right asof join sta b on timetruncate(a.ts, 1d) = b.ts; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right asof join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a right asof join sta b where a.ts = b.ts; +sql explain analyze verbose true select b.col1 from sta a right asof join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right asof join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right asof join sta b on a.ts = b.ts and 1 = 2 order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right asof join (select ts, col1 from sta) b on a.ts=b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right asof join (select ts, col1 from sta) b right asof join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right asof join sta b right asof join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a right asof join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a right asof join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts)) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) c right asof join ((select a.ts from sta a right asof join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a right asof join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + +#right window join +sql_error explain analyze verbose true select a.ts from sta a right window join sta b; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts = b.ts and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts = b.ts or a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts = b.ts and a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts = b.ts and a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 and a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 and a.ts = b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b where a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b where a.ts = b.ts or a.ts = b.ts; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.t1 = b.t1 window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.t1 = b.t1 and a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.t1 = b.t1 or a.col1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts != b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts != b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts is null; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts is null window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.ts + 1 = b.col1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) > b.ts window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts + 1 window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 0; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1024; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit 1025; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1s,1s) jlimit -1; +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s, 1s) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1; +sql explain analyze verbose true select a.ts from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a right window join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a right window join sta b window_offset(-1s,1s) where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right window join sta b on a.ts = b.ts window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right window join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right window join sta b on a.ts = b.ts and 1 = 2 window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right window join (select ts, col1 from sta) b window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a right window join (select ts, col1 from sta) b right window join sta c window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a right window join sta b right window join sta c window_offset(-1s,1s) order by a.ts; +sql_error explain analyze verbose true select a.ts from test0.sta a right window join testb.stb1 b window_offset(-1s,1s); +sql explain analyze verbose true select a.ts from testb.stb1 a right window join testb.stb1 b window_offset(-1s,1s); +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit a.col1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit 1 + 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(1s,1s-1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(1s,-1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1a,1a) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1b,1b) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1b,1s) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1u,1u) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1u,1s) jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1h,1m) jlimit 1; +sql explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1d,1w) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1n,1n) jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a right window join sta b window_offset(-1y,1y) jlimit 1; +sql connect; +sql use testb; +sql_error explain analyze verbose true select a.ts from stb1 a right window join stb1 b window_offset(-1b,1b) jlimit 1; +sql_error explain analyze verbose true select a.ts from stb1 a right window join stb1 b window_offset(-1b,1s) jlimit 1; +sql explain analyze verbose true select a.ts from stb1 a right window join stb1 b window_offset(-1u,1u) jlimit 1; +sql explain analyze verbose true select a.ts from stb1 a right window join stb1 b window_offset(-1s,1s) jlimit 1; +sql connect; +sql use test0; +sql_error explain analyze verbose true select a.col1 from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 group by a.col1; +sql_error explain analyze verbose true select a.col1 from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 partition by a.col1; +sql_error explain analyze verbose true select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 interval(1s); +sql_error explain analyze verbose true select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 session(a.ts, 1s); +sql_error explain analyze verbose true select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 = b.col1 state_window(a.col1); +sql explain analyze verbose true select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(count(a.col1) > 0); +sql_error explain analyze verbose true select count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) having(a.col1 > 0); +sql explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where a.col1 > 0; +sql_error explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a right window join sta b window_offset(-1s,1s) where a.col1 > 0; +sql_error explain analyze verbose true select diff(a.col1) from sta a right window join sta b window_offset(-1s,1s); +sql_error explain analyze verbose true select csum(a.col1) from sta a right window join sta b window_offset(-1s,1s); +sql explain analyze verbose true select diff(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s); +sql explain analyze verbose true select csum(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s); +sql_error explain analyze verbose true select interp(a.col1) from tba1 a right window join tba1 b window_offset(0s,0s) RANGE(now -1d, now) every(1s) fill(null); +sql_error explain analyze verbose true select a.col1, b.col1, count(a.col1) from sta a right window join sta b on a.col1 = b.col1 window_offset(-1s,1s) where count(a.col1) > 0; +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by col1; +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by 1; +sql explain analyze verbose true (select b.col1 from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select a.col1 from sta a right window join sta b window_offset(-1s,1s)) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s))) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s))) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) c right window join ((select a.ts from sta a right window join sta b window_offset(-1s,1s) order by a.ts) union all (select b.ts from sta a right window join sta b window_offset(-1s,1s)) order by 1) d on c.ts = d.ts; + + +#full join +sql_error explain analyze verbose true select a.ts from sta a full join sta b; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full join sta b where a.ts = b.ts or a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.col1 is not NULL; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.ts + 1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) > b.ts; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts + 1; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s); +sql explain analyze verbose true select a.ts from sta a full join sta b on timetruncate(a.ts, 1d) = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.col1 = b.col1 where a.col1 = b.col1; +sql_error explain analyze verbose true select a.ts from sta a full join sta b on a.col1 = b.col1 where a.ts = b.ts; +sql_error explain analyze verbose true select a.ts from sta a full join sta b where a.ts = b.ts; +sql_error explain analyze verbose true select b.col1 from sta a full join sta b where a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from sta a full join sta b on a.ts = b.ts and a.col1 + 1 = b.col1 order by a.ts; +sql explain analyze verbose true select b.col1 from (select ts from sta) a full join (select ts, col1 from sta) b on a.ts = b.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from (select ts from sta) a full join (select ts, col1 from sta) b full join sta c on a.ts=b.ts and b.ts = c.ts order by a.ts; +sql_error explain analyze verbose true select b.col1 from sta a full join sta b full join sta c on a.ts=b.ts and a.ts = b.ts order by a.ts; +sql explain analyze verbose true select a.ts from test0.sta a full join testb.stb1 b on a.ts = b.ts; +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts order by a.ts); +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts order by a.ts); +sql_error explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by a.ts; +sql_error explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by a.ts; +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by col1; +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union (select a.col1 from sta a full join sta b on a.ts=b.ts) order by 1; +sql explain analyze verbose true (select b.col1 from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select a.col1 from sta a full join sta b on a.ts=b.ts) order by 1; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts)) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts)) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; +sql_error explain analyze verbose true select c.ts from ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) c full join ((select a.ts from sta a full join sta b on a.ts=b.ts order by a.ts) union all (select b.ts from sta a full join sta b on a.ts=b.ts) order by 1) d on c.ts = d.ts; + + + + + diff --git a/tests/script/tsim/join/left_asof_join.sim b/tests/script/tsim/join/left_asof_join.sim index b304fa1cfe..561a2d6083 100644 --- a/tests/script/tsim/join/left_asof_join.sim +++ b/tests/script/tsim/join/left_asof_join.sim @@ -1086,6 +1086,11 @@ if $data31 != @23-11-17 16:29:03.000@ then return -1 endi +sql select a.col1 from sta a left asof join sta b on a.col1 = b.col1 and a.t1 = b.t1; +if $rows != 8 then + return -1 +endi + sql select a.ts, b.ts from sta a left asof join sta b on a.ts > b.ts order by a.ts desc; if $rows != 8 then return -1 diff --git a/utils/tsim/inc/simParse.h b/utils/tsim/inc/simParse.h index 2a683f9561..237c50fed8 100644 --- a/utils/tsim/inc/simParse.h +++ b/utils/tsim/inc/simParse.h @@ -25,7 +25,7 @@ #define MAX_NUM_JUMP 100 #define MAX_LINE_LEN 3000 #define MAX_CMD_LINES 2048 -#define MAX_OPTION_BUFFER 64000 +#define MAX_OPTION_BUFFER 128000 enum { BLOCK_IF,