Merge pull request #25370 from taosdata/feat/TD-27337

feat: support all kinds of join
This commit is contained in:
dapan1121 2024-04-16 13:33:39 +08:00 committed by GitHub
commit babe16a7d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
100 changed files with 28079 additions and 6234 deletions

View File

@ -37,6 +37,7 @@ typedef struct SBlockOrderInfo {
#define NBIT (3u)
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
#define CharPos(r_) ((r_) >> NBIT)
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
#define colDataIsNull_f(bm_, r_) ((BMCharPos(bm_, r_) & (1u << (7u - BitPos(r_)))) == (1u << (7u - BitPos(r_))))
@ -192,12 +193,14 @@ int32_t getJsonValueLen(const char* data);
int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows, bool trimValue);
void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow, uint32_t numOfRows);
int32_t colDataCopyNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow, const char* pData,
uint32_t numOfRows, bool isNull);
int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, int32_t* capacity,
const SColumnInfoData* pSource, int32_t numOfRow2);
int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* pSource, int32_t numOfRows,
const SDataBlockInfo* pBlockInfo);
int32_t colDataAssignNRows(SColumnInfoData* pDst, int32_t dstIdx, const SColumnInfoData* pSrc, int32_t srcIdx, int32_t numOfRows);
int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock, int32_t tsColumnIndex);
int32_t blockDataUpdatePkRange(SSDataBlock* pDataBlock, int32_t pkColumnIndex, bool asc);
@ -210,6 +213,8 @@ size_t blockDataGetNumOfCols(const SSDataBlock* pBlock);
size_t blockDataGetNumOfRows(const SSDataBlock* pBlock);
int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc);
int32_t blockDataMergeNRows(SSDataBlock* pDest, const SSDataBlock* pSrc, int32_t srcIdx, int32_t numOfRows);
void blockDataShrinkNRows(SSDataBlock* pBlock, int32_t numOfRows);
int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startIndex, int32_t* stopIndex,
int32_t pageSize);
int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock);
@ -234,7 +239,10 @@ int32_t blockDataEnsureCapacity(SSDataBlock* pDataBlock, uint32_t numOfRows);
void colInfoDataCleanup(SColumnInfoData* pColumn, uint32_t numOfRows);
void blockDataCleanup(SSDataBlock* pDataBlock);
void blockDataReset(SSDataBlock* pDataBlock);
void blockDataEmpty(SSDataBlock* pDataBlock);
int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows,
bool clearPayload);
size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize, int32_t extraSize);

View File

@ -245,6 +245,7 @@ typedef enum ENodeType {
QUERY_NODE_EVENT_WINDOW,
QUERY_NODE_HINT,
QUERY_NODE_VIEW,
QUERY_NODE_WINDOW_OFFSET,
QUERY_NODE_COUNT_WINDOW,
// Statement nodes are used in parser and planner module.

View File

@ -79,7 +79,7 @@ int64_t taosTimeGetIntervalEnd(int64_t ts, const SInterval* pInterval);
int32_t taosTimeCountIntervalForFill(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision, int32_t order);
int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* ts, char* unit, int32_t timePrecision);
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision);
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision, bool negativeAllow);
int32_t taosParseTime(const char* timestr, int64_t* pTime, int32_t len, int32_t timePrec, int8_t dayligth);
void deltaToUtcInitOnce();

View File

@ -296,84 +296,93 @@
#define TK_IN 278
#define TK_JOIN 279
#define TK_INNER 280
#define TK_SELECT 281
#define TK_NK_HINT 282
#define TK_DISTINCT 283
#define TK_WHERE 284
#define TK_PARTITION 285
#define TK_BY 286
#define TK_SESSION 287
#define TK_STATE_WINDOW 288
#define TK_EVENT_WINDOW 289
#define TK_COUNT_WINDOW 290
#define TK_SLIDING 291
#define TK_FILL 292
#define TK_VALUE 293
#define TK_VALUE_F 294
#define TK_NONE 295
#define TK_PREV 296
#define TK_NULL_F 297
#define TK_LINEAR 298
#define TK_NEXT 299
#define TK_HAVING 300
#define TK_RANGE 301
#define TK_EVERY 302
#define TK_ORDER 303
#define TK_SLIMIT 304
#define TK_SOFFSET 305
#define TK_LIMIT 306
#define TK_OFFSET 307
#define TK_ASC 308
#define TK_NULLS 309
#define TK_ABORT 310
#define TK_AFTER 311
#define TK_ATTACH 312
#define TK_BEFORE 313
#define TK_BEGIN 314
#define TK_BITAND 315
#define TK_BITNOT 316
#define TK_BITOR 317
#define TK_BLOCKS 318
#define TK_CHANGE 319
#define TK_COMMA 320
#define TK_CONCAT 321
#define TK_CONFLICT 322
#define TK_COPY 323
#define TK_DEFERRED 324
#define TK_DELIMITERS 325
#define TK_DETACH 326
#define TK_DIVIDE 327
#define TK_DOT 328
#define TK_EACH 329
#define TK_FAIL 330
#define TK_FILE 331
#define TK_FOR 332
#define TK_GLOB 333
#define TK_ID 334
#define TK_IMMEDIATE 335
#define TK_IMPORT 336
#define TK_INITIALLY 337
#define TK_INSTEAD 338
#define TK_ISNULL 339
#define TK_MODULES 340
#define TK_NK_BITNOT 341
#define TK_NK_SEMI 342
#define TK_NOTNULL 343
#define TK_OF 344
#define TK_PLUS 345
#define TK_PRIVILEGE 346
#define TK_RAISE 347
#define TK_RESTRICT 348
#define TK_ROW 349
#define TK_SEMI 350
#define TK_STAR 351
#define TK_STATEMENT 352
#define TK_STRICT 353
#define TK_STRING 354
#define TK_TIMES 355
#define TK_VALUES 356
#define TK_VARIABLE 357
#define TK_WAL 358
#define TK_LEFT 281
#define TK_RIGHT 282
#define TK_OUTER 283
#define TK_SEMI 284
#define TK_ANTI 285
#define TK_ASOF 286
#define TK_WINDOW 287
#define TK_WINDOW_OFFSET 288
#define TK_JLIMIT 289
#define TK_SELECT 290
#define TK_NK_HINT 291
#define TK_DISTINCT 292
#define TK_WHERE 293
#define TK_PARTITION 294
#define TK_BY 295
#define TK_SESSION 296
#define TK_STATE_WINDOW 297
#define TK_EVENT_WINDOW 298
#define TK_COUNT_WINDOW 299
#define TK_SLIDING 300
#define TK_FILL 301
#define TK_VALUE 302
#define TK_VALUE_F 303
#define TK_NONE 304
#define TK_PREV 305
#define TK_NULL_F 306
#define TK_LINEAR 307
#define TK_NEXT 308
#define TK_HAVING 309
#define TK_RANGE 310
#define TK_EVERY 311
#define TK_ORDER 312
#define TK_SLIMIT 313
#define TK_SOFFSET 314
#define TK_LIMIT 315
#define TK_OFFSET 316
#define TK_ASC 317
#define TK_NULLS 318
#define TK_ABORT 319
#define TK_AFTER 320
#define TK_ATTACH 321
#define TK_BEFORE 322
#define TK_BEGIN 323
#define TK_BITAND 324
#define TK_BITNOT 325
#define TK_BITOR 326
#define TK_BLOCKS 327
#define TK_CHANGE 328
#define TK_COMMA 329
#define TK_CONCAT 330
#define TK_CONFLICT 331
#define TK_COPY 332
#define TK_DEFERRED 333
#define TK_DELIMITERS 334
#define TK_DETACH 335
#define TK_DIVIDE 336
#define TK_DOT 337
#define TK_EACH 338
#define TK_FAIL 339
#define TK_FILE 340
#define TK_FOR 341
#define TK_GLOB 342
#define TK_ID 343
#define TK_IMMEDIATE 344
#define TK_IMPORT 345
#define TK_INITIALLY 346
#define TK_INSTEAD 347
#define TK_ISNULL 348
#define TK_MODULES 349
#define TK_NK_BITNOT 350
#define TK_NK_SEMI 351
#define TK_NOTNULL 352
#define TK_OF 353
#define TK_PLUS 354
#define TK_PRIVILEGE 355
#define TK_RAISE 356
#define TK_RESTRICT 357
#define TK_ROW 358
#define TK_STAR 359
#define TK_STATEMENT 360
#define TK_STRICT 361
#define TK_STRING 362
#define TK_TIMES 363
#define TK_VALUES 364
#define TK_VARIABLE 365
#define TK_WAL 366
#define TK_NK_SPACE 600
@ -388,6 +397,7 @@
#define TK_PARTITION_FIRST 609
#define TK_PARA_TABLES_SORT 610
#define TK_SMALLDATA_TS_SORT 611
#define TK_HASH_JOIN 612
#define TK_NK_NIL 65535

View File

@ -238,6 +238,7 @@ bool fmIsCumulativeFunc(int32_t funcId);
bool fmIsInterpPseudoColumnFunc(int32_t funcId);
bool fmIsGroupKeyFunc(int32_t funcId);
bool fmIsBlockDistFunc(int32_t funcId);
bool fmIsIgnoreNullFunc(int32_t funcId);
bool fmIsConstantResFunc(SFunctionNode* pFunc);
bool fmIsSkipScanCheckFunc(int32_t funcId);
bool fmIsPrimaryKeyFunc(int32_t funcId);

View File

@ -66,6 +66,7 @@ typedef struct SLogicNode {
EOrder inputTsOrder;
EOrder outputTsOrder;
bool forceCreateNonBlockingOptr; // true if the operator can use non-blocking(pipeline) mode
bool splitDone;
} SLogicNode;
typedef enum EScanType {
@ -128,15 +129,32 @@ typedef struct SScanLogicNode {
typedef struct SJoinLogicNode {
SLogicNode node;
EJoinType joinType;
EJoinSubType subType;
SNode* pWindowOffset;
SNode* pJLimit;
EJoinAlgorithm joinAlgo;
SNode* addPrimEqCond;
SNode* pPrimKeyEqCond;
SNode* pColEqCond;
SNode* pColOnCond;
SNode* pTagEqCond;
SNode* pTagOnCond;
SNode* pOtherOnCond;
SNode* pFullOnCond; // except prim eq cond
SNodeList* pLeftEqNodes;
SNodeList* pRightEqNodes;
bool allEqTags;
bool isSingleTableJoin;
bool hasSubQuery;
bool isLowLevelJoin;
bool seqWinGroup;
bool grpJoin;
bool hashJoinHint;
// FOR HASH JOIN
int32_t timeRangeTarget; //table onCond filter
STimeWindow timeRange; //table onCond filter
SNode* pLeftOnCond; //table onCond filter
SNode* pRightOnCond; //table onCond filter
} SJoinLogicNode;
typedef struct SAggLogicNode {
@ -480,26 +498,52 @@ typedef struct SInterpFuncPhysiNode {
} SInterpFuncPhysiNode;
typedef struct SSortMergeJoinPhysiNode {
SPhysiNode node;
EJoinType joinType;
SNode* pPrimKeyCond;
SNode* pColEqCond;
SNode* pOtherOnCond;
SNodeList* pTargets;
SPhysiNode node;
EJoinType joinType;
EJoinSubType subType;
SNode* pWindowOffset;
SNode* pJLimit;
int32_t asofOpType;
SNode* leftPrimExpr;
SNode* rightPrimExpr;
int32_t leftPrimSlotId;
int32_t rightPrimSlotId;
SNodeList* pEqLeft;
SNodeList* pEqRight;
SNode* pPrimKeyCond; //remove
SNode* pColEqCond; //remove
SNode* pColOnCond;
SNode* pFullOnCond;
SNodeList* pTargets;
SQueryStat inputStat[2];
bool seqWinGroup;
bool grpJoin;
} SSortMergeJoinPhysiNode;
typedef struct SHashJoinPhysiNode {
SPhysiNode node;
EJoinType joinType;
SNodeList* pOnLeft;
SNodeList* pOnRight;
SNode* pFilterConditions;
SNodeList* pTargets;
SQueryStat inputStat[2];
SPhysiNode node;
EJoinType joinType;
EJoinSubType subType;
SNode* pWindowOffset;
SNode* pJLimit;
SNodeList* pOnLeft;
SNodeList* pOnRight;
SNode* leftPrimExpr;
SNode* rightPrimExpr;
int32_t leftPrimSlotId;
int32_t rightPrimSlotId;
int32_t timeRangeTarget; //table onCond filter
STimeWindow timeRange; //table onCond filter
SNode* pLeftOnCond; //table onCond filter
SNode* pRightOnCond; //table onCond filter
SNode* pFullOnCond; //preFilter
SNodeList* pTargets;
SQueryStat inputStat[2];
SNode* pPrimKeyCond;
SNode* pColEqCond;
SNode* pTagEqCond;
// only in planner internal
SNode* pPrimKeyCond;
SNode* pColEqCond;
SNode* pTagEqCond;
} SHashJoinPhysiNode;
typedef struct SGroupCachePhysiNode {

View File

@ -23,6 +23,7 @@ extern "C" {
#include "nodes.h"
#include "tmsg.h"
#include "tvariant.h"
#include "tsimplehash.h"
#define TABLE_TOTAL_COL_NUM(pMeta) ((pMeta)->tableInfo.numOfColumns + (pMeta)->tableInfo.numOfTags)
#define TABLE_META_SIZE(pMeta) \
@ -79,6 +80,7 @@ typedef struct SColumnNode {
uint16_t projIdx; // the idx in project list, start from 1
EColumnType colType; // column or tag
bool hasIndex;
bool isPrimTs;
char dbName[TSDB_DB_NAME_LEN];
char tableName[TSDB_TABLE_NAME_LEN];
char tableAlias[TSDB_TABLE_NAME_LEN];
@ -103,10 +105,16 @@ typedef struct STargetNode {
SNode* pExpr;
} STargetNode;
#define VALUE_FLAG_IS_DURATION (1 << 0)
#define VALUE_FLAG_IS_TIME_OFFSET (1 << 1)
#define IS_DURATION_VAL(_flag) ((_flag) & VALUE_FLAG_IS_DURATION)
#define IS_TIME_OFFSET_VAL(_flag) ((_flag) & VALUE_FLAG_IS_TIME_OFFSET)
typedef struct SValueNode {
SExprNode node; // QUERY_NODE_VALUE
char* literal;
bool isDuration;
int32_t flag;
bool translate;
bool notReserved;
bool isNull;
@ -133,6 +141,7 @@ typedef enum EHintOption {
HINT_PARTITION_FIRST,
HINT_PARA_TABLES_SORT,
HINT_SMALLDATA_TS_SORT,
HINT_HASH_JOIN,
} EHintOption;
typedef struct SHintNode {
@ -206,12 +215,31 @@ typedef struct SViewNode {
int8_t cacheLastMode;
} SViewNode;
#define JOIN_JLIMIT_MAX_VALUE 1024
#define IS_INNER_NONE_JOIN(_type, _stype) ((_type) == JOIN_TYPE_INNER && (_stype) == JOIN_STYPE_NONE)
#define IS_SEMI_JOIN(_stype) ((_stype) == JOIN_STYPE_SEMI)
#define IS_WINDOW_JOIN(_stype) ((_stype) == JOIN_STYPE_WIN)
#define IS_ASOF_JOIN(_stype) ((_stype) == JOIN_STYPE_ASOF)
typedef enum EJoinType {
JOIN_TYPE_INNER = 1,
JOIN_TYPE_INNER = 0,
JOIN_TYPE_LEFT,
JOIN_TYPE_RIGHT,
JOIN_TYPE_FULL,
JOIN_TYPE_MAX_VALUE
} EJoinType;
typedef enum EJoinSubType {
JOIN_STYPE_NONE = 0,
JOIN_STYPE_OUTER,
JOIN_STYPE_SEMI,
JOIN_STYPE_ANTI,
JOIN_STYPE_ASOF,
JOIN_STYPE_WIN,
JOIN_STYPE_MAX_VALUE
} EJoinSubType;
typedef enum EJoinAlgorithm {
JOIN_ALGO_UNKNOWN = 0,
JOIN_ALGO_MERGE,
@ -223,13 +251,18 @@ typedef enum EDynQueryType {
} EDynQueryType;
typedef struct SJoinTableNode {
STableNode table; // QUERY_NODE_JOIN_TABLE
EJoinType joinType;
bool hasSubQuery;
bool isLowLevelJoin;
SNode* pLeft;
SNode* pRight;
SNode* pOnCond;
STableNode table; // QUERY_NODE_JOIN_TABLE
EJoinType joinType;
EJoinSubType subType;
SNode* pWindowOffset;
SNode* pJLimit;
SNode* addPrimCond;
bool hasSubQuery;
bool isLowLevelJoin;
SNode* pParent;
SNode* pLeft;
SNode* pRight;
SNode* pOnCond;
} SJoinTableNode;
typedef enum EGroupingSetType { GP_TYPE_NORMAL = 1 } EGroupingSetType;
@ -305,6 +338,7 @@ typedef enum EFillMode {
typedef enum ETimeLineMode {
TIME_LINE_NONE = 1,
TIME_LINE_BLOCK,
TIME_LINE_MULTI,
TIME_LINE_GLOBAL,
} ETimeLineMode;
@ -338,6 +372,13 @@ typedef struct SCaseWhenNode {
SNodeList* pWhenThenList;
} SCaseWhenNode;
typedef struct SWindowOffsetNode {
ENodeType type; // QUERY_NODE_WINDOW_OFFSET
SNode* pStartOffset; // SValueNode
SNode* pEndOffset; // SValueNode
} SWindowOffsetNode;
typedef struct SSelectStmt {
ENodeType type; // QUERY_NODE_SELECT_STMT
bool isDistinct;
@ -362,6 +403,7 @@ typedef struct SSelectStmt {
uint8_t precision;
int32_t selectFuncNum;
int32_t returnRows; // EFuncReturnRows
ETimeLineMode timeLineCurMode;
ETimeLineMode timeLineResMode;
bool isEmptyResult;
bool isSubquery;
@ -385,6 +427,7 @@ typedef struct SSelectStmt {
bool onlyHasKeepOrderFunc;
bool groupSort;
bool tagScan;
bool joinContains;
} SSelectStmt;
typedef enum ESetOperatorType { SET_OP_TYPE_UNION_ALL = 1, SET_OP_TYPE_UNION } ESetOperatorType;
@ -400,6 +443,7 @@ typedef struct SSetOperator {
char stmtName[TSDB_TABLE_NAME_LEN];
uint8_t precision;
ETimeLineMode timeLineResMode;
bool joinContains;
} SSetOperator;
typedef enum ESqlClause {
@ -537,12 +581,15 @@ typedef struct SQuery {
bool stableQuery;
} SQuery;
void nodesWalkSelectStmtImpl(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext);
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext);
void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewriter rewriter, void* pContext);
typedef enum ECollectColType { COLLECT_COL_TYPE_COL = 1, COLLECT_COL_TYPE_TAG, COLLECT_COL_TYPE_ALL } ECollectColType;
int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char* pTableAlias, ECollectColType type,
SNodeList** pCols);
int32_t nodesCollectColumnsExt(SSelectStmt* pSelect, ESqlClause clause, SSHashObj* pMultiTableAlias, ECollectColType type,
SNodeList** pCols);
int32_t nodesCollectColumnsFromNode(SNode* node, const char* pTableAlias, ECollectColType type, SNodeList** pCols);
typedef bool (*FFuncClassifier)(int32_t funcId);
@ -579,6 +626,12 @@ const char* logicConditionTypeStr(ELogicConditionType type);
bool nodesIsStar(SNode* pNode);
bool nodesIsTableStar(SNode* pNode);
char* getJoinTypeString(EJoinType type);
char* getJoinSTypeString(EJoinSubType type);
char* getFullJoinTypeString(EJoinType type, EJoinSubType stype);
int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc);
#ifdef __cplusplus
}
#endif

View File

@ -158,6 +158,7 @@ int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
SArray* serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap);
SArray* serializeVgroupsDropTableBatch(SHashObj* pVgroupHashmap);
void destoryCatalogReq(SCatalogReq *pCatalogReq);
bool isPrimaryKeyImpl(SNode* pExpr);
#ifdef __cplusplus
}

View File

@ -272,6 +272,7 @@ void initQueryModuleMsgHandle();
const SSchema* tGetTbnameColumnSchema();
bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
int32_t getAsofJoinReverseOp(EOperatorType op);
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp* msg, SCTableMeta* pMeta);
int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta);

View File

@ -31,6 +31,15 @@ enum {
FLT_OPTION_NEED_UNIQE = 4,
};
typedef enum EConditionType {
COND_TYPE_PRIMARY_KEY = 1,
COND_TYPE_TAG_INDEX,
COND_TYPE_TAG,
COND_TYPE_NORMAL
} EConditionType;
#define FILTER_RESULT_ALL_QUALIFIED 0x1
#define FILTER_RESULT_NONE_QUALIFIED 0x2
#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3
@ -54,6 +63,8 @@ extern bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg **pColsAgg,
/* condition split interface */
int32_t filterPartitionCond(SNode **pCondition, SNode **pPrimaryKeyCond, SNode **pTagIndexCond, SNode **pTagCond,
SNode **pOtherCond);
bool filterIsMultiTableColsCond(SNode *pCond);
EConditionType filterClassifyCondition(SNode *pNode);
#ifdef __cplusplus
}

View File

@ -82,6 +82,7 @@ int32_t toUnixtimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
int32_t toJsonFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t toTimestampFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t toCharFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int64_t offsetFromTz(char *timezone, int64_t factor);
int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);

View File

@ -31,7 +31,7 @@ extern "C" {
#define TSWAP(a, b) \
do { \
char *__tmp = alloca(sizeof(a)); \
char *__tmp = (char*)alloca(sizeof(a)); \
memcpy(__tmp, &(a), sizeof(a)); \
memcpy(&(a), &(b), sizeof(a)); \
memcpy(&(b), __tmp, sizeof(a)); \

View File

@ -547,6 +547,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_QWORKER_QUIT TAOS_DEF_ERROR_CODE(0, 0x0730)
#define TSDB_CODE_QRY_GEO_NOT_SUPPORT_ERROR TAOS_DEF_ERROR_CODE(0, 0x0731)
#define TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x0732)
#define TSDB_CODE_QRY_INVALID_JOIN_CONDITION TAOS_DEF_ERROR_CODE(0, 0x0733)
// grant
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800)
@ -762,12 +763,18 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_VIEW_CONFLICT_WITH_TABLE TAOS_DEF_ERROR_CODE(0, 0x266E)
#define TSDB_CODE_PAR_ORDERBY_AMBIGUOUS TAOS_DEF_ERROR_CODE(0, 0x266F)
#define TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT TAOS_DEF_ERROR_CODE(0, 0x2670)
#define TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY TAOS_DEF_ERROR_CODE(0, 0x2671)
#define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2672)
#define TSDB_CODE_PAR_COL_PK_TYPE TAOS_DEF_ERROR_CODE(0, 0x2673)
#define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x2674)
#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x2675)
#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NONE TAOS_DEF_ERROR_CODE(0, 0x2676)
#define TSDB_CODE_PAR_GRP_WINDOW_NOT_ALLOWED TAOS_DEF_ERROR_CODE(0, 0x2671)
#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_NOT_WIN_FUNC TAOS_DEF_ERROR_CODE(0, 0x2676)
#define TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY TAOS_DEF_ERROR_CODE(0, 0x2677)
#define TSDB_CODE_PAR_SECOND_COL_PK TAOS_DEF_ERROR_CODE(0, 0x2678)
#define TSDB_CODE_PAR_COL_PK_TYPE TAOS_DEF_ERROR_CODE(0, 0x2679)
#define TSDB_CODE_PAR_INVALID_PK_OP TAOS_DEF_ERROR_CODE(0, 0x267A)
#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x267B)
#define TSDB_CODE_PAR_PRIMARY_KEY_IS_NONE TAOS_DEF_ERROR_CODE(0, 0x267C)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner

View File

@ -149,7 +149,7 @@ typedef enum EOperatorType {
OP_TYPE_BIT_OR,
// binary comparison operator
OP_TYPE_GREATER_THAN = 40,
OP_TYPE_GREATER_THAN = 40, // MUST KEEP IT FIRST AT COMPARE SECTION
OP_TYPE_GREATER_EQUAL,
OP_TYPE_LOWER_THAN,
OP_TYPE_LOWER_EQUAL,
@ -170,6 +170,7 @@ typedef enum EOperatorType {
OP_TYPE_IS_NOT_TRUE,
OP_TYPE_IS_NOT_FALSE,
OP_TYPE_IS_NOT_UNKNOWN,
OP_TYPE_COMPARE_MAX_VALUE = 149, // MUST KEEP IT LAST AT COMPARE SECTION
// json operator
OP_TYPE_JSON_GET_VALUE = 150,

View File

@ -191,26 +191,29 @@ static int32_t doCopyNItems(struct SColumnInfoData* pColumnInfoData, int32_t cur
}
size_t start = 1;
// the first item
memcpy(pColumnInfoData->pData, pData, itemLen);
int32_t t = 0;
int32_t count = log(numOfRows) / log(2);
uint32_t startOffset = (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) ? pColumnInfoData->varmeta.length : (currentRow * itemLen);
// the first item
memcpy(pColumnInfoData->pData + startOffset, pData, itemLen);
while (t < count) {
int32_t xlen = 1 << t;
memcpy(pColumnInfoData->pData + start * itemLen + pColumnInfoData->varmeta.length, pColumnInfoData->pData,
memcpy(pColumnInfoData->pData + start * itemLen + startOffset,
pColumnInfoData->pData + startOffset,
xlen * itemLen);
t += 1;
start += xlen;
}
// the tail part
if (numOfRows > start) {
memcpy(pColumnInfoData->pData + start * itemLen + currentRow * itemLen, pColumnInfoData->pData,
memcpy(pColumnInfoData->pData + start * itemLen + startOffset,
pColumnInfoData->pData + startOffset,
(numOfRows - start) * itemLen);
}
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
for (int32_t i = 0; i < numOfRows; ++i) {
pColumnInfoData->varmeta.offset[i + currentRow] = pColumnInfoData->varmeta.length + i * itemLen;
@ -226,9 +229,13 @@ int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
bool trimValue) {
int32_t len = pColumnInfoData->info.bytes;
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
len = varDataTLen(pData);
if (pColumnInfoData->varmeta.allocLen < (numOfRows + currentRow) * len) {
int32_t code = colDataReserve(pColumnInfoData, (numOfRows + currentRow) * len);
if (pColumnInfoData->info.type == TSDB_DATA_TYPE_JSON) {
len = getJsonValueLen(pData);
} else {
len = varDataTLen(pData);
}
if (pColumnInfoData->varmeta.allocLen < (numOfRows * len + pColumnInfoData->varmeta.length)) {
int32_t code = colDataReserve(pColumnInfoData, (numOfRows * len + pColumnInfoData->varmeta.length));
if (code != TSDB_CODE_SUCCESS) {
return code;
}
@ -239,10 +246,12 @@ int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
}
void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow, uint32_t numOfRows) {
pColumnInfoData->hasNull = true;
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
memset(&pColumnInfoData->varmeta.offset[currentRow], -1, sizeof(int32_t) * numOfRows);
} else {
if (numOfRows < sizeof(char) * 2) {
if (numOfRows < 16) {
for (int32_t i = 0; i < numOfRows; ++i) {
colDataSetNull_f(pColumnInfoData->nullbitmap, currentRow + i);
}
@ -256,9 +265,10 @@ void colDataSetNItemsNull(SColumnInfoData* pColumnInfoData, uint32_t currentRow,
}
}
memset(&BMCharPos(pColumnInfoData->nullbitmap, currentRow + i), 0xFF, (numOfRows - i) / sizeof(char));
i += (numOfRows - i) / sizeof(char) * sizeof(char);
int32_t bytes = (numOfRows - i) / 8;
memset(&BMCharPos(pColumnInfoData->nullbitmap, currentRow + i), 0xFF, bytes);
i += bytes * 8;
for (; i < numOfRows; ++i) {
colDataSetNull_f(pColumnInfoData->nullbitmap, currentRow + i);
}
@ -481,6 +491,111 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
return 0;
}
int32_t colDataAssignNRows(SColumnInfoData* pDst, int32_t dstIdx, const SColumnInfoData* pSrc, int32_t srcIdx, int32_t numOfRows) {
if (pDst->info.type != pSrc->info.type || pDst->info.bytes != pSrc->info.bytes || pSrc->reassigned) {
return TSDB_CODE_FAILED;
}
if (numOfRows <= 0) {
return numOfRows;
}
if (IS_VAR_DATA_TYPE(pDst->info.type)) {
int32_t allLen = 0;
void* srcAddr = NULL;
if (pSrc->hasNull) {
for (int32_t i = 0; i < numOfRows; ++i) {
if (colDataIsNull_var(pSrc, srcIdx + i)) {
pDst->varmeta.offset[dstIdx + i] = -1;
pDst->hasNull = true;
continue;
}
char* pData = colDataGetVarData(pSrc, srcIdx + i);
if (NULL == srcAddr) {
srcAddr = pData;
}
int32_t dataLen = 0;
if (pSrc->info.type == TSDB_DATA_TYPE_JSON) {
dataLen = getJsonValueLen(pData);
} else {
dataLen = varDataTLen(pData);
}
pDst->varmeta.offset[dstIdx + i] = pDst->varmeta.length + allLen;
allLen += dataLen;
}
} else {
for (int32_t i = 0; i < numOfRows; ++i) {
char* pData = colDataGetVarData(pSrc, srcIdx + i);
int32_t dataLen = 0;
if (pSrc->info.type == TSDB_DATA_TYPE_JSON) {
dataLen = getJsonValueLen(pData);
} else {
dataLen = varDataTLen(pData);
}
pDst->varmeta.offset[dstIdx + i] = pDst->varmeta.length + allLen;
allLen += dataLen;
}
}
if (allLen > 0) {
// copy data
if (pDst->varmeta.allocLen < pDst->varmeta.length + allLen) {
char* tmp = taosMemoryRealloc(pDst->pData, pDst->varmeta.length + allLen);
if (tmp == NULL) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pDst->pData = tmp;
pDst->varmeta.allocLen = pDst->varmeta.length + allLen;
}
if (pSrc->hasNull) {
memcpy(pDst->pData + pDst->varmeta.length, srcAddr, allLen);
} else {
memcpy(pDst->pData + pDst->varmeta.length, colDataGetVarData(pSrc, srcIdx), allLen);
}
pDst->varmeta.length = pDst->varmeta.length + allLen;
}
} else {
if (pSrc->hasNull) {
if (BitPos(dstIdx) == BitPos(srcIdx)) {
for (int32_t i = 0; i < numOfRows; ++i) {
if (0 == BitPos(dstIdx) && (i + (1 << NBIT) <= numOfRows)) {
BMCharPos(pDst->nullbitmap, dstIdx + i) = BMCharPos(pSrc->nullbitmap, srcIdx + i);
if (BMCharPos(pDst->nullbitmap, dstIdx + i)) {
pDst->hasNull = true;
}
i += (1 << NBIT) - 1;
} else {
if (colDataIsNull_f(pSrc->nullbitmap, srcIdx + i)) {
colDataSetNull_f(pDst->nullbitmap, dstIdx + i);
pDst->hasNull = true;
} else {
colDataClearNull_f(pDst->nullbitmap, dstIdx + i);
}
}
}
} else {
for (int32_t i = 0; i < numOfRows; ++i) {
if (colDataIsNull_f(pSrc->nullbitmap, srcIdx + i)) {
colDataSetNull_f(pDst->nullbitmap, dstIdx + i);
pDst->hasNull = true;
} else {
colDataClearNull_f(pDst->nullbitmap, dstIdx + i);
}
}
}
}
if (pSrc->pData != NULL) {
memcpy(pDst->pData + pDst->info.bytes * dstIdx, pSrc->pData + pSrc->info.bytes * srcIdx, pDst->info.bytes * numOfRows);
}
}
return 0;
}
size_t blockDataGetNumOfCols(const SSDataBlock* pBlock) { return taosArrayGetSize(pBlock->pDataBlock); }
size_t blockDataGetNumOfRows(const SSDataBlock* pBlock) { return pBlock->info.rows; }
@ -574,6 +689,60 @@ int32_t blockDataMerge(SSDataBlock* pDest, const SSDataBlock* pSrc) {
return TSDB_CODE_SUCCESS;
}
int32_t blockDataMergeNRows(SSDataBlock* pDest, const SSDataBlock* pSrc, int32_t srcIdx, int32_t numOfRows) {
if (pDest->info.rows + numOfRows > pDest->info.capacity) {
ASSERT(0);
return TSDB_CODE_FAILED;
}
size_t numOfCols = taosArrayGetSize(pDest->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pCol2 = taosArrayGet(pDest->pDataBlock, i);
SColumnInfoData* pCol1 = taosArrayGet(pSrc->pDataBlock, i);
colDataAssignNRows(pCol2, pDest->info.rows, pCol1, srcIdx, numOfRows);
}
pDest->info.rows += numOfRows;
return TSDB_CODE_SUCCESS;
}
void blockDataShrinkNRows(SSDataBlock* pBlock, int32_t numOfRows) {
if (numOfRows >= pBlock->info.rows) {
blockDataCleanup(pBlock);
return;
}
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, i);
if (IS_VAR_DATA_TYPE(pCol->info.type)) {
pCol->varmeta.length = pCol->varmeta.offset[pBlock->info.rows - numOfRows];
memset(pCol->varmeta.offset + pBlock->info.rows - numOfRows, 0, sizeof(*pCol->varmeta.offset) * numOfRows);
} else {
int32_t i = pBlock->info.rows - numOfRows;
for (; i < pBlock->info.rows; ++i) {
if (BitPos(i)) {
colDataClearNull_f(pCol->nullbitmap, i);
} else {
break;
}
}
int32_t bytes = (pBlock->info.rows - i) / 8;
memset(&BMCharPos(pCol->nullbitmap, i), 0, bytes);
i += bytes * 8;
for (; i < pBlock->info.rows; ++i) {
colDataClearNull_f(pCol->nullbitmap, i);
}
}
}
pBlock->info.rows -= numOfRows;
}
size_t blockDataGetSize(const SSDataBlock* pBlock) {
size_t total = 0;
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
@ -661,6 +830,17 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
blockDataEnsureCapacity(pDst, rowCount);
/* may have disorder varchar data, TODO
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
SColumnInfoData* pDstCol = taosArrayGet(pDst->pDataBlock, i);
colDataAssignNRows(pDstCol, 0, pColData, startIndex, rowCount);
}
*/
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pColData = taosArrayGet(pBlock->pDataBlock, i);
@ -1196,18 +1376,43 @@ void blockDataEmpty(SSDataBlock* pDataBlock) {
pInfo->window.skey = 0;
}
void blockDataReset(SSDataBlock* pDataBlock) {
SDataBlockInfo* pInfo = &pDataBlock->info;
if (pInfo->capacity == 0) {
return;
}
size_t numOfCols = taosArrayGetSize(pDataBlock->pDataBlock);
for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* p = taosArrayGet(pDataBlock->pDataBlock, i);
p->hasNull = false;
p->reassigned = false;
if (IS_VAR_DATA_TYPE(p->info.type)) {
p->varmeta.length = 0;
}
}
pInfo->rows = 0;
pInfo->dataLoad = 0;
pInfo->window.ekey = 0;
pInfo->window.skey = 0;
pInfo->id.uid = 0;
pInfo->id.groupId = 0;
}
/*
* NOTE: the type of the input column may be TSDB_DATA_TYPE_NULL, which is used to denote
* the all NULL value in this column. It is an internal representation of all NULL value column, and no visible to
* any users. The length of TSDB_DATA_TYPE_NULL is 0, and it is an special case.
*/
static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows,
int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo* pBlockInfo, uint32_t numOfRows,
bool clearPayload) {
if (numOfRows <= 0 || numOfRows <= pBlockInfo->capacity) {
if (numOfRows <= 0 || pBlockInfo && numOfRows <= pBlockInfo->capacity) {
return TSDB_CODE_SUCCESS;
}
int32_t existedRows = pBlockInfo->rows;
int32_t existedRows = pBlockInfo ? pBlockInfo->rows : 0;
if (IS_VAR_DATA_TYPE(pColumn->info.type)) {
char* tmp = taosMemoryRealloc(pColumn->varmeta.offset, sizeof(int32_t) * numOfRows);
@ -2495,6 +2700,8 @@ void trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList
int32_t numOfRows = 0;
if (IS_VAR_DATA_TYPE(pDst->info.type)) {
pDst->varmeta.length = 0;
} else {
memset(pDst->nullbitmap, 0, bmLen);
}
}
return;

View File

@ -663,12 +663,12 @@ int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* dura
return getDuration(timestamp, *unit, duration, timePrecision);
}
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision) {
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision, bool negativeAllow) {
errno = 0;
/* get the basic numeric value */
*duration = taosStr2Int64(token, NULL, 10);
if (*duration < 0 || errno != 0) {
if ((*duration < 0 && !negativeAllow) || errno != 0) {
return -1;
}

View File

@ -2526,7 +2526,8 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
SCtgViewsCtx* pCtx = (SCtgViewsCtx*)pTask->taskCtx;
SCtgJob* pJob = pTask->pJob;
bool tbMetaDone = false;
/*
ctgIsTaskDone(pJob, CTG_TASK_GET_TB_META_BATCH, &tbMetaDone);
if (tbMetaDone) {
CTG_ERR_RET(ctgBuildViewNullRes(pTask, pCtx));
@ -2535,6 +2536,7 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0));
return TSDB_CODE_SUCCESS;
}
*/
int32_t dbNum = taosArrayGetSize(pCtx->pNames);
int32_t fetchIdx = 0;
@ -2821,7 +2823,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) {

View File

@ -53,9 +53,12 @@ extern "C" {
#define EXPLAIN_FILTER_FORMAT "Filter: "
#define EXPLAIN_MERGEBLOCKS_FORMAT "Merge ResBlocks: %s"
#define EXPLAIN_FILL_VALUE_FORMAT "Fill Values: "
#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Cond: "
#define EXPLAIN_PRIM_CONDITIONS_FORMAT "Join Prim Cond: "
#define EXPLAIN_ON_CONDITIONS_FORMAT "Join Full Cond: "
#define EXPLAIN_COL_ON_CONDITIONS_FORMAT "Join Col 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"
@ -71,8 +74,11 @@ extern "C" {
#define EXPLAIN_DYN_QRY_CTRL_FORMAT "Dynamic Query Control for %s"
#define EXPLAIN_COUNT_FORMAT "Count"
#define EXPLAIN_COUNT_INFO_FORMAT "Window Count Info"
#define EXPLAIN_JOIN_EQ_LEFT_FORMAT "Left Equal Cond: "
#define EXPLAIN_JOIN_EQ_RIGHT_FORMAT "Right Equal Cond: "
#define EXPLAIN_COUNT_NUM_FORMAT "Window Count=%" PRId64
#define EXPLAIN_COUNT_SLIDING_FORMAT "Window Sliding=%" PRId64
#define EXPLAIN_TABLE_TIMERANGE_FORMAT "%s Table Time Range: [%" PRId64 ", %" PRId64 "]"
#define EXPLAIN_PLANNING_TIME_FORMAT "Planning Time: %.3f ms"
#define EXPLAIN_EXEC_TIME_FORMAT "Execution Time: %.3f ms"
@ -93,7 +99,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 +117,12 @@ 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 EXPLAIN_JOIN_ALGO "algo=%s"
#define COMMAND_RESET_LOG "resetLog"
#define COMMAND_SCHEDULE_POLICY "schedulePolicy"

View File

@ -757,6 +757,7 @@ static int32_t setCreateViewResultIntoDataBlock(SSDataBlock* pBlock, SShowCreate
}
SViewMeta* pMeta = pStmt->pViewMeta;
ASSERT(pMeta);
snprintf(varDataVal(buf2), SHOW_CREATE_VIEW_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, "CREATE VIEW `%s`.`%s` AS %s", pStmt->dbName, pStmt->viewName, pMeta->querySql);
int32_t len = strlen(varDataVal(buf2));
varDataLen(buf2) = (len > 65535) ? 65535 : len;

View File

@ -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,33 @@ 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";
}
}
char* qExplainGetTimerangeTargetStr(int32_t target) {
static char* targetName[] = {"", "Left", "Right", "Left/Right"};
if (target <= 0 || target > 3) {
return "Unknown";
}
return targetName[target];
}
void qExplainFreeResNode(SExplainResNode *resNode) {
if (NULL == resNode) {
return;
@ -375,6 +410,14 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
}
if (pTagScanNode->scan.node.pConditions) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT);
QRY_ERR_RET(nodesNodeToSQL(pTagScanNode->scan.node.pConditions, tbuf + VARSTR_HEADER_SIZE,
TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
}
break;
}
@ -593,7 +636,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));
@ -605,6 +648,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_INPUT_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pJoinNode->node.inputTsOrder));
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_JOIN_ALGO, "Merge");
EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT);
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
@ -620,6 +664,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,
@ -628,16 +702,48 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT);
QRY_ERR_RET(
nodesNodeToSQL(pJoinNode->pPrimKeyCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
if (pJoinNode->pOtherOnCond) {
EXPLAIN_ROW_APPEND(" AND ");
QRY_ERR_RET(
nodesNodeToSQL(pJoinNode->pOtherOnCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
if (NULL != pJoinNode->pPrimKeyCond) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_PRIM_CONDITIONS_FORMAT);
QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pPrimKeyCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
if (NULL != pJoinNode->pEqLeft && pJoinNode->pEqLeft->length > 0) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_JOIN_EQ_LEFT_FORMAT);
SNode* pCol = NULL;
FOREACH(pCol, pJoinNode->pEqLeft) {
EXPLAIN_ROW_APPEND("`%s`.`%s` ", ((SColumnNode*)pCol)->tableAlias, ((SColumnNode*)pCol)->colName);
}
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
if (NULL != pJoinNode->pEqRight && pJoinNode->pEqRight->length > 0) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_JOIN_EQ_RIGHT_FORMAT);
SNode* pCol = NULL;
FOREACH(pCol, pJoinNode->pEqRight) {
EXPLAIN_ROW_APPEND("`%s`.`%s` ", ((SColumnNode*)pCol)->tableAlias, ((SColumnNode*)pCol)->colName);
}
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
if (NULL != pJoinNode->pFullOnCond) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_ON_CONDITIONS_FORMAT);
QRY_ERR_RET(
nodesNodeToSQL(pJoinNode->pFullOnCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
if (NULL != pJoinNode->pColOnCond) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_COL_ON_CONDITIONS_FORMAT);
QRY_ERR_RET(
nodesNodeToSQL(pJoinNode->pColOnCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
break;
}
@ -1575,7 +1681,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));
@ -1587,6 +1693,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_INPUT_ORDER_FORMAT, EXPLAIN_ORDER_STRING(pJoinNode->node.inputTsOrder));
EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT);
EXPLAIN_ROW_APPEND(EXPLAIN_JOIN_ALGO, "Hash");
EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT);
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level));
@ -1602,19 +1709,11 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
if (pJoinNode->node.pConditions || pJoinNode->pFilterConditions) {
if (pJoinNode->node.pConditions) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_FILTER_FORMAT);
if (pJoinNode->node.pConditions) {
QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE,
TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
}
if (pJoinNode->pFilterConditions) {
if (pJoinNode->node.pConditions) {
EXPLAIN_ROW_APPEND(" AND ");
}
QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pFilterConditions, tbuf + VARSTR_HEADER_SIZE,
TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
}
QRY_ERR_RET(nodesNodeToSQL(pJoinNode->node.pConditions, tbuf + VARSTR_HEADER_SIZE,
TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
@ -1642,8 +1741,21 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
nodesNodeToSQL(pJoinNode->pTagEqCond, tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
conditionsGot = true;
}
if (pJoinNode->pFullOnCond) {
if (conditionsGot) {
EXPLAIN_ROW_APPEND(" AND ");
}
QRY_ERR_RET(nodesNodeToSQL(pJoinNode->pFullOnCond, tbuf + VARSTR_HEADER_SIZE,
TSDB_EXPLAIN_RESULT_ROW_SIZE, &tlen));
}
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
if (pJoinNode->timeRangeTarget) {
EXPLAIN_ROW_NEW(level + 1, EXPLAIN_TABLE_TIMERANGE_FORMAT, qExplainGetTimerangeTargetStr(pJoinNode->timeRangeTarget), pJoinNode->timeRange.skey, pJoinNode->timeRange.ekey);
EXPLAIN_ROW_END();
QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1));
}
}
break;
}

View File

@ -836,6 +836,7 @@ int32_t getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, uint32_t* de
extern void doDestroyExchangeOperatorInfo(void* param);
int32_t doFilterImpl(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo, SColumnInfoData** pResCol);
int32_t doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo);
int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock,
int32_t rows, SExecTaskInfo* pTask, STableMetaCacheInfo* pCache);
@ -974,6 +975,9 @@ void doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArr
int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo,
TSKEY* primaryKeys, int32_t prevPosition, int32_t order);
void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, int32_t status);
#ifdef __cplusplus
}

View File

@ -65,6 +65,7 @@ typedef struct SGcDownstreamCtx {
SHashObj* pSessions;
SHashObj* pWaitSessions;
SGcFileCacheCtx fileCtx;
bool fetchDone;
} SGcDownstreamCtx;
typedef struct SGcVgroupCtx {

View File

@ -20,6 +20,13 @@ extern "C" {
#endif
#define HASH_JOIN_DEFAULT_PAGE_SIZE 10485760
#define HJOIN_DEFAULT_BLK_ROWS_NUM 4096
#define HJOIN_BLK_SIZE_LIMIT 10485760
#define HJOIN_ROW_BITMAP_SIZE (2 * 1048576)
#define HJOIN_BLK_THRESHOLD_RATIO 0.9
typedef int32_t (*hJoinImplFp)(SOperatorInfo*);
#pragma pack(push, 1)
typedef struct SBufRowInfo {
@ -29,27 +36,36 @@ typedef struct SBufRowInfo {
} SBufRowInfo;
#pragma pack(pop)
typedef enum EHJoinPhase {
E_JOIN_PHASE_PRE = 1,
E_JOIN_PHASE_CUR,
E_JOIN_PHASE_POST
} EHJoinPhase;
typedef struct SHJoinCtx {
bool rowRemains;
bool midRemains;
int64_t limit;
SBufRowInfo* pBuildRow;
SSDataBlock* pProbeData;
int32_t probeIdx;
EHJoinPhase probePhase;
int32_t probePreIdx;
int32_t probeStartIdx;
int32_t probeEndIdx;
int32_t probePostIdx;
bool readMatch;
} SHJoinCtx;
typedef struct SRowLocation {
SSDataBlock* pDataBlock;
int32_t pos;
} SRowLocation;
typedef struct SHJoinColInfo {
int32_t srcSlot;
int32_t dstSlot;
bool keyCol;
bool vardata;
int32_t* offset;
int32_t bytes;
char* data;
char* bitMap;
int32_t srcSlot;
int32_t dstSlot;
bool keyCol;
bool vardata;
int32_t* offset;
int32_t bytes;
char* data;
char* bitMap;
SColumnInfoData* colData;
} SHJoinColInfo;
typedef struct SBufPageInfo {
@ -63,11 +79,31 @@ typedef struct SGroupData {
SBufRowInfo* rows;
} SGroupData;
typedef struct SHJoinTableInfo {
typedef struct SHJoinColMap {
int32_t srcSlot;
int32_t dstSlot;
bool vardata;
int32_t bytes;
} SHJoinColMap;
// for now timetruncate only
typedef struct SHJoinPrimExprCtx {
int64_t truncateUnit;
int64_t timezoneUnit;
int32_t targetSlotId;
} SHJoinPrimExprCtx;
typedef struct SHJoinTableCtx {
int32_t downStreamIdx;
SOperatorInfo* downStream;
int32_t blkId;
SQueryStat inputStat;
bool hasTimeRange;
SHJoinColMap* primCol;
SNode* primExpr;
SHJoinPrimExprCtx primCtx;
int32_t keyNum;
SHJoinColInfo* keyCols;
@ -81,7 +117,7 @@ typedef struct SHJoinTableInfo {
int32_t valBufSize;
SArray* valVarCols;
bool valColExist;
} SHJoinTableInfo;
} SHJoinTableCtx;
typedef struct SHJoinExecInfo {
int64_t buildBlkNum;
@ -94,21 +130,57 @@ typedef struct SHJoinExecInfo {
typedef struct SHJoinOperatorInfo {
int32_t joinType;
SHJoinTableInfo tbs[2];
SHJoinTableInfo* pBuild;
SHJoinTableInfo* pProbe;
SSDataBlock* pRes;
EJoinType joinType;
EJoinSubType subType;
SHJoinTableCtx tbs[2];
SHJoinTableCtx* pBuild;
SHJoinTableCtx* pProbe;
SFilterInfo* pPreFilter;
SFilterInfo* pFinFilter;
SSDataBlock* finBlk;
SSDataBlock* midBlk;
STimeWindow tblTimeRange;
int32_t pResColNum;
int8_t* pResColMap;
SArray* pRowBufs;
SNode* pCond;
SSHashObj* pKeyHash;
bool keyHashBuilt;
SHJoinCtx ctx;
SHJoinExecInfo execInfo;
int32_t blkThreshold;
hJoinImplFp joinFp;
} SHJoinOperatorInfo;
#define HJ_ERR_RET(c) \
do { \
int32_t _code = (c); \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define HJ_ERR_JRET(c) \
do { \
code = (c); \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
int32_t hInnerJoinDo(struct SOperatorInfo* pOperator);
int32_t hLeftJoinDo(struct SOperatorInfo* pOperator);
void hJoinSetDone(struct SOperatorInfo* pOperator);
void hJoinAppendResToBlock(struct SOperatorInfo* pOperator, SSDataBlock* pRes, bool* allFetched);
bool hJoinCopyKeyColsDataToBuf(SHJoinTableCtx* pTable, int32_t rowIdx, size_t *pBufLen);
int32_t hJoinCopyMergeMidBlk(SHJoinCtx* pCtx, SSDataBlock** ppMid, SSDataBlock** ppFin);
int32_t hJoinHandleMidRemains(SHJoinOperatorInfo* pJoin, SHJoinCtx* pCtx);
bool hJoinBlkReachThreshold(SHJoinOperatorInfo* pInfo, int64_t blkRows);
int32_t hJoinCopyNMatchRowsToBlock(SHJoinOperatorInfo* pJoin, SSDataBlock* pRes, int32_t startIdx, int32_t rows);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,482 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_MERGEJOIN_H
#define TDENGINE_MERGEJOIN_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
#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)
#else
#define MJOIN_DEFAULT_BLK_ROWS_NUM 4096
#define MJOIN_HJOIN_CART_THRESHOLD 16
#define MJOIN_BLK_SIZE_LIMIT 10485760
#define MJOIN_ROW_BITMAP_SIZE (2 * 1048576)
#endif
#define MJOIN_SEMI_ANTI_BLK_ROWS_NUM 64
#define MJOIN_BLK_THRESHOLD_RATIO 0.9
struct SMJoinOperatorInfo;
typedef enum EJoinTableType {
E_JOIN_TB_BUILD = 1,
E_JOIN_TB_PROBE
} EJoinTableType;
#define MJOIN_TBTYPE(_type) (E_JOIN_TB_BUILD == (_type) ? "BUILD" : "PROBE")
#define IS_FULL_OUTER_JOIN(_jtype, _stype) ((_jtype) == JOIN_TYPE_FULL && (_stype) == JOIN_STYPE_OUTER)
typedef struct SMJoinRowPos {
SSDataBlock* pBlk;
int32_t pos;
} SMJoinRowPos;
typedef struct SMJoinColMap {
int32_t srcSlot;
int32_t dstSlot;
bool vardata;
int32_t bytes;
} SMJoinColMap;
typedef struct SMJoinColInfo {
int32_t srcSlot;
int32_t dstSlot;
bool jsonData;
bool vardata;
int32_t* offset;
int32_t bytes;
char* data;
char* bitMap;
SColumnInfoData* colData;
} SMJoinColInfo;
typedef struct SMJoinHashGrpRows {
int32_t rowBitmapOffset;
int32_t rowMatchNum;
bool allRowsMatch;
bool allRowsNMatch;
SArray* pRows;
} SMJoinHashGrpRows;
typedef struct SMJoinNMatchCtx {
void* pGrp;
int32_t iter;
int32_t bitIdx;
int32_t rowIdx;
int32_t grpIdx;
} SMJoinNMatchCtx;
// for now timetruncate only
typedef struct SMJoinPrimExprCtx {
int64_t truncateUnit;
int64_t timezoneUnit;
int32_t targetSlotId;
} SMJoinPrimExprCtx;
typedef struct SMJoinTableCtx {
EJoinTableType type;
int32_t downStreamIdx;
SOperatorInfo* downStream;
bool dsInitDone;
bool dsFetchDone;
SNode* primExpr;
SMJoinPrimExprCtx primCtx;
int32_t blkId;
SQueryStat inputStat;
uint64_t lastInGid;
SSDataBlock* remainInBlk;
SMJoinColMap* primCol;
char* primData;
int32_t finNum;
SMJoinColMap* finCols;
int32_t keyNum;
int32_t keyNullSize;
SMJoinColInfo* keyCols;
char* keyBuf;
char* keyData;
bool newBlk;
SSDataBlock* blk;
int32_t blkRowIdx;
// merge join
int64_t grpTotalRows;
int32_t grpIdx;
bool noKeepEqGrpRows;
bool multiEqGrpRows;
int64_t eqRowLimit;
int64_t eqRowNum;
SArray* eqGrps;
SArray* createdBlks;
// hash join
int32_t grpArrayIdx;
SArray* pGrpArrays;
bool multiRowsGrp;
int32_t grpRowIdx;
SArray* pHashCurGrp;
SMJoinHashGrpRows* pHashGrpRows;
SSHashObj* pGrpHash;
int64_t rowBitmapSize;
int64_t rowBitmapOffset;
char* pRowBitmap;
SMJoinNMatchCtx nMatchCtx;
} SMJoinTableCtx;
typedef struct SMJoinMatchInfo {
int32_t rowBitmapOffset;
int32_t rowMatchNum;
bool allRowsNMatch;
bool allRowsMatch;
} SMJoinMatchInfo;
typedef struct SMJoinGrpRows {
SSDataBlock* blk;
int32_t beginIdx;
int32_t endIdx;
int32_t readIdx;
int32_t rowBitmapOffset;
int32_t rowMatchNum;
bool allRowsNMatch;
bool allRowsMatch;
bool readMatch;
bool clonedBlk;
} SMJoinGrpRows;
#define MJOIN_COMMON_CTX \
struct SMJoinOperatorInfo* pJoin; \
bool ascTs; \
bool grpRemains; \
SSDataBlock* finBlk; \
bool lastEqGrp; \
bool lastProbeGrp; \
bool seqWinGrp; \
bool groupJoin; \
int32_t blkThreshold; \
int64_t limit; \
int64_t jLimit
typedef struct SMJoinCommonCtx {
MJOIN_COMMON_CTX;
} SMJoinCommonCtx;
typedef int32_t (*joinCartFp)(void*);
typedef struct SMJoinMergeCtx {
// KEEP IT FIRST
struct SMJoinOperatorInfo* pJoin;
bool ascTs;
bool grpRemains;
SSDataBlock* finBlk;
bool lastEqGrp;
bool lastProbeGrp;
bool seqWinGrp;
bool groupJoin;
int32_t blkThreshold;
int64_t limit;
int64_t jLimit;
// KEEP IT FIRST
bool hashCan;
bool midRemains;
bool nmatchRemains;
SSDataBlock* midBlk;
int64_t lastEqTs;
SMJoinGrpRows probeNEqGrp;
SMJoinGrpRows buildNEqGrp;
bool hashJoin;
joinCartFp hashCartFp;
joinCartFp mergeCartFp;
} SMJoinMergeCtx;
typedef enum {
E_CACHE_NONE = 0,
E_CACHE_OUTBLK,
E_CACHE_INBLK
} SMJoinCacheMode;
typedef struct SMJoinWinCache {
int32_t pageLimit;
int32_t outRowIdx;
int32_t colNum;
int32_t rowNum;
int8_t grpIdx;
SArray* grps;
SArray* grpsQueue;
SSDataBlock* outBlk;
} SMJoinWinCache;
typedef int32_t (*joinMoveWin)(void*);
typedef struct SMJoinWindowCtx {
// KEEP IT FIRST
struct SMJoinOperatorInfo* pJoin;
bool ascTs;
bool grpRemains;
SSDataBlock* finBlk;
bool lastEqGrp;
bool lastProbeGrp;
bool seqWinGrp;
bool groupJoin;
int32_t blkThreshold;
int64_t limit;
int64_t jLimit;
// KEEP IT FIRST
int32_t asofOpType;
int64_t winBeginOffset;
int64_t winEndOffset;
bool lowerRowsAcq;
bool eqRowsAcq;
bool greaterRowsAcq;
bool forwardRowsAcq;
int64_t winBeginTs;
int64_t winEndTs;
joinMoveWin moveWinBeginFp;
joinMoveWin moveWinEndFp;
bool eqPostDone;
int64_t lastTs;
SMJoinGrpRows probeGrp;
SMJoinGrpRows buildGrp;
SMJoinWinCache cache;
} SMJoinWindowCtx;
typedef struct SMJoinFlowFlags {
bool mergeJoin;
bool windowJoin;
bool preFilter;
bool retrieveAfterBuildDone;
} SMJoinFlowFlags;
typedef struct SMJoinCtx {
SMJoinFlowFlags* pFlags;
bool mergeCtxInUse;
union {
SMJoinMergeCtx mergeCtx;
SMJoinWindowCtx windowCtx;
};
} SMJoinCtx;
typedef struct SMJoinExecInfo {
int64_t buildBlkNum;
int64_t buildBlkRows;
int64_t probeBlkNum;
int64_t probeBlkRows;
int64_t resRows;
int64_t expectRows;
} SMJoinExecInfo;
typedef SSDataBlock* (*joinImplFp)(SOperatorInfo*);
typedef SSDataBlock* (*joinRetrieveFp)(struct SMJoinOperatorInfo*, SMJoinTableCtx*);
typedef void (*joinResetFp)(struct SMJoinOperatorInfo*);
typedef struct SMJoinOperatorInfo {
SOperatorInfo* pOperator;
int32_t joinType;
int32_t subType;
int32_t inputTsOrder;
int32_t errCode;
int64_t outGrpId;
uint64_t outBlkId;
SMJoinTableCtx tbs[2];
SMJoinTableCtx* build;
SMJoinTableCtx* probe;
SFilterInfo* pFPreFilter;
SFilterInfo* pPreFilter;
SFilterInfo* pFinFilter;
joinImplFp joinFp;
joinRetrieveFp retrieveFp;
joinResetFp grpResetFp;
SMJoinCtx ctx;
SMJoinExecInfo execInfo;
} SMJoinOperatorInfo;
#define MJOIN_DS_REQ_INIT(_pOp) ((_pOp)->pOperatorGetParam && ((SSortMergeJoinOperatorParam*)(_pOp)->pOperatorGetParam->value)->initDownstream)
#define MJOIN_DS_NEED_INIT(_pOp, _tbctx) (MJOIN_DS_REQ_INIT(_pOp) && (!(_tbctx)->dsInitDone))
#define MJOIN_TB_LOW_BLK(_tbctx) ((_tbctx)->blkNum <= 0 || ((_tbctx)->blkNum == 1 && (_tbctx)->pHeadBlk->cloned))
#define REACH_HJOIN_THRESHOLD(_prb, _bld) ((_bld)->grpTotalRows >= MJOIN_HJOIN_CART_THRESHOLD)
#define SET_SAME_TS_GRP_HJOIN(_pair, _octx) ((_pair)->hashJoin = (_octx)->hashCan && REACH_HJOIN_THRESHOLD(_pair))
#define PROBE_TS_NMATCH(_asc, _pts, _bts) (((_asc) && (_pts) < (_bts)) || (!(_asc) && (_pts) > (_bts)))
#define PROBE_TS_NREACH(_asc, _pts, _bts) (((_asc) && (_pts) > (_bts)) || (!(_asc) && (_pts) < (_bts)))
#define MJOIN_BUILD_BLK_OOR(_asc, _pts, _pidx, _bts, _bnum) (((_asc) && (*((int64_t*)(_pts) + (_pidx)) > *((int64_t*)(_bts) + (_bnum) - 1))) || ((!(_asc)) && (*((int64_t*)(_pts) + (_pidx)) < *((int64_t*)(_bts) + (_bnum) - 1))))
#define GRP_REMAIN_ROWS(_grp) ((_grp)->endIdx - (_grp)->readIdx + 1)
#define GRP_DONE(_grp) ((_grp)->readIdx > (_grp)->endIdx)
#define MJOIN_PROBE_TB_ROWS_DONE(_tb) ((_tb)->blkRowIdx >= (_tb)->blk->info.rows)
#define FJOIN_PROBE_TB_ROWS_DONE(_tb) ((NULL == (_tb)->blk) || ((_tb)->blkRowIdx >= (_tb)->blk->info.rows))
#define MJOIN_BUILD_TB_ROWS_DONE(_tb) ((NULL == (_tb)->blk) || ((_tb)->blkRowIdx >= (_tb)->blk->info.rows))
#define MJOIN_TB_GRP_ROWS_DONE(_tb, _grpJoin) ((_tb)->dsFetchDone || ((_grpJoin) && NULL == (_tb)->blk && NULL != (_tb)->remainInBlk))
#define BLK_IS_FULL(_blk) ((_blk)->info.rows == (_blk)->info.capacity)
#define MJOIN_ROW_BITMAP_SET(_b, _base, _idx) (!colDataIsNull_f((_b + _base), _idx))
#define MJOIN_SET_ROW_BITMAP(_b, _base, _idx) colDataClearNull_f((_b + _base), _idx)
#define ASOF_EQ_ROW_INCLUDED(_op) (OP_TYPE_GREATER_EQUAL == (_op) || OP_TYPE_LOWER_EQUAL == (_op) || OP_TYPE_EQUAL == (_op))
#define ASOF_LOWER_ROW_INCLUDED(_op) (OP_TYPE_GREATER_EQUAL == (_op) || OP_TYPE_GREATER_THAN == (_op))
#define ASOF_GREATER_ROW_INCLUDED(_op) (OP_TYPE_LOWER_EQUAL == (_op) || OP_TYPE_LOWER_THAN == (_op))
#define WIN_ONLY_EQ_ROW_INCLUDED(_soff, _eoff) (0 == ((SValueNode*)(_soff))->datum.i && 0 == ((SValueNode*)(_eoff))->datum.i)
#define MJOIN_PUSH_BLK_TO_CACHE(_cache, _blk) \
do { \
ASSERT(taosArrayGetSize((_cache)->grps) <= 1); \
SMJoinGrpRows* pGrp = (SMJoinGrpRows*)taosArrayReserve((_cache)->grps, 1); \
(_cache)->rowNum += (_blk)->info.rows; \
pGrp->blk = (_blk); \
pGrp->beginIdx = 0; \
pGrp->endIdx = (_blk)->info.rows - 1; \
} while (0)
#define MJOIN_RESTORE_TB_BLK(_cache, _tb) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
if (NULL != pGrp) { \
(_tb)->blk = pGrp->blk; \
(_tb)->blkRowIdx = pGrp->beginIdx; \
} else { \
(_tb)->blk = NULL; \
(_tb)->blkRowIdx = 0; \
} \
} while (0)
#define MJOIN_SAVE_TB_BLK(_cache, _tb) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
if (NULL != pGrp) { \
ASSERT(pGrp->blk == (_tb)->blk); \
pGrp->beginIdx = (_tb)->blkRowIdx; \
pGrp->readIdx = pGrp->beginIdx; \
} \
} while (0)
#define MJOIN_POP_TB_BLK(_cache) \
do { \
SMJoinGrpRows* pGrp = taosArrayGet((_cache)->grps, 0); \
if (NULL != pGrp) { \
if (pGrp->blk == (_cache)->outBlk) { \
blockDataCleanup(pGrp->blk); \
} \
taosArrayPopFrontBatch((_cache)->grps, 1); \
} \
} while (0)
#define MJOIN_GET_TB_COL_TS(_col, _ts, _tb) \
do { \
if (NULL != (_tb)->blk && (_tb)->blkRowIdx < (_tb)->blk->info.rows) { \
(_col) = taosArrayGet((_tb)->blk->pDataBlock, (_tb)->primCtx.targetSlotId); \
(_ts) = *((int64_t*)(_col)->pData + (_tb)->blkRowIdx); \
} else { \
(_ts) = INT64_MAX; \
} \
} while (0)
#define MJOIN_GET_TB_CUR_TS(_col, _ts, _tb) \
do { \
(_ts) = *((int64_t*)(_col)->pData + (_tb)->blkRowIdx); \
} while (0)
#define MJ_ERR_RET(c) \
do { \
int32_t _code = (c); \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define MJ_ERR_JRET(c) \
do { \
code = (c); \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
void mJoinDestroyMergeCtx(SMJoinOperatorInfo* pJoin);
void mJoinDestroyWindowCtx(SMJoinOperatorInfo* pJoin);
int32_t mJoinInitWindowCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJoinNode);
int32_t mJoinInitMergeCtx(SMJoinOperatorInfo* pJoin, SSortMergeJoinPhysiNode* pJoinNode);
void mWinJoinResetWindowCache(SMJoinWindowCtx* pCtx, SMJoinWinCache* pCache);
SSDataBlock* mInnerJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mLeftJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mFullJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mSemiJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mAntiJoinDo(struct SOperatorInfo* pOperator);
SSDataBlock* mWinJoinDo(struct SOperatorInfo* pOperator);
void mJoinResetGroupTableCtx(SMJoinTableCtx* pCtx);
void mJoinResetTableCtx(SMJoinTableCtx* pCtx);
void mLeftJoinGroupReset(SMJoinOperatorInfo* pJoin);
void mWinJoinGroupReset(SMJoinOperatorInfo* pJoin);
bool mJoinRetrieveBlk(SMJoinOperatorInfo* pJoin, int32_t* pIdx, SSDataBlock** ppBlk, SMJoinTableCtx* pTb);
void mJoinSetDone(SOperatorInfo* pOperator);
bool mJoinIsDone(SOperatorInfo* pOperator);
bool mJoinCopyKeyColsDataToBuf(SMJoinTableCtx* pTable, int32_t rowIdx, size_t *pBufLen);
int32_t mJoinBuildEqGroups(SMJoinTableCtx* pTable, int64_t timestamp, bool* wholeBlk, bool restart);
int32_t mJoinRetrieveEqGrpRows(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable, int64_t timestamp);
int32_t mJoinCreateFullBuildTbHash(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable);
int32_t mJoinCreateBuildTbHash(SMJoinOperatorInfo* pJoin, SMJoinTableCtx* pTable);
int32_t mJoinSetKeyColsData(SSDataBlock* pBlock, SMJoinTableCtx* pTable);
int32_t mJoinProcessEqualGrp(SMJoinMergeCtx* pCtx, int64_t timestamp, bool lastBuildGrp);
bool mJoinHashGrpCart(SSDataBlock* pBlk, SMJoinGrpRows* probeGrp, bool append, SMJoinTableCtx* probe, SMJoinTableCtx* build);
int32_t mJoinMergeGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool append, SMJoinGrpRows* pFirst, SMJoinGrpRows* pSecond);
int32_t mJoinHandleMidRemains(SMJoinMergeCtx* pCtx);
int32_t mJoinNonEqGrpCart(SMJoinOperatorInfo* pJoin, SSDataBlock* pRes, bool append, SMJoinGrpRows* pGrp, bool probeGrp);
int32_t mJoinNonEqCart(SMJoinCommonCtx* pCtx, SMJoinGrpRows* pGrp, bool probeGrp, bool singleProbeRow);
int32_t mJoinCopyMergeMidBlk(SMJoinMergeCtx* pCtx, SSDataBlock** ppMid, SSDataBlock** ppFin);
int32_t mJoinFilterAndMarkRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SMJoinTableCtx* build, int32_t startGrpIdx, int32_t startRowIdx);
int32_t mJoinFilterAndMarkHashRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SMJoinTableCtx* build, int32_t startRowIdx);
int32_t mJoinGetRowBitmapOffset(SMJoinTableCtx* pTable, int32_t rowNum, int32_t *rowBitmapOffset);
int32_t mJoinProcessLowerGrp(SMJoinMergeCtx* pCtx, SMJoinTableCtx* pTb, SColumnInfoData* pCol, int64_t* probeTs, int64_t* buildTs);
int32_t mJoinProcessGreaterGrp(SMJoinMergeCtx* pCtx, SMJoinTableCtx* pTb, SColumnInfoData* pCol, int64_t* probeTs, int64_t* buildTs);
int32_t mJoinFilterAndKeepSingleRow(SSDataBlock* pBlock, SFilterInfo* pFilterInfo);
int32_t mJoinFilterAndNoKeepRows(SSDataBlock* pBlock, SFilterInfo* pFilterInfo);
int32_t mJoinBuildEqGrp(SMJoinTableCtx* pTable, int64_t timestamp, bool* wholeBlk, SMJoinGrpRows* pGrp);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_MERGEJOIN_H

View File

@ -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);
@ -457,7 +457,7 @@ static int32_t buildSeqStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SS
}
}
bool initParam = pSrcParam0 ? true : false;
bool initParam = pSrcParam0 ? true : false;
if (TSDB_CODE_SUCCESS == code) {
code = buildGroupCacheOperatorParam(&pGcParam0, 0, *leftVg, *leftUid, pPost->leftNeedCache, pSrcParam0);
pSrcParam0 = NULL;
@ -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;

View File

@ -77,7 +77,6 @@ static void setBlockSMAInfo(SqlFunctionCtx* pCtx, SExprInfo* pExpr, SSDataBlock*
static void initCtxOutputBuffer(SqlFunctionCtx* pCtx, int32_t size);
static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_t order, int32_t scanFlag);
static void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, int32_t status);
static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t order, int32_t scanFlag,
bool createDummyCol);
static int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprSupp* pSup, SDiskbasedBuf* pBuf,

View File

@ -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;
@ -821,6 +821,7 @@ static int32_t addNewGroupData(struct SOperatorInfo* pOperator, SOperatorParam*
taosArrayDestroy(pParam->pChildren);
pParam->pChildren = NULL;
pCtx->fetchDone = false;
}
return TSDB_CODE_SUCCESS;
@ -832,7 +833,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 +871,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 +884,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;
}
@ -910,6 +911,7 @@ static int32_t handleDownstreamFetchDone(struct SOperatorInfo* pOperator, SGcSes
while (NULL != (pGroup = taosHashIterate(pGrpHash, pGroup))) {
handleGroupFetchDone(pGroup);
}
pCtx->fetchDone = true;
} else {
int32_t uidNum = 0;
SGcVgroupCtx* pVgCtx = NULL;
@ -979,33 +981,41 @@ static int32_t getBlkFromSessionCacheImpl(struct SOperatorInfo* pOperator, int64
SGroupCacheOperatorInfo* pGCache = pOperator->info;
*got = true;
if (pSession->pGroupData->needCache) {
SGcBlkList* pBlkList = &pSession->pGroupData->blkList;
taosRLockLatch(&pBlkList->lock);
int64_t blkNum = taosArrayGetSize(pBlkList->pList);
if (pSession->lastBlkId < 0) {
if (blkNum > 0) {
SGcBlkBufBasic* pBasic = taosArrayGet(pBlkList->pList, 0);
if (NULL != pSession->pGroupData) {
if (pSession->pGroupData->needCache) {
SGcBlkList* pBlkList = &pSession->pGroupData->blkList;
taosRLockLatch(&pBlkList->lock);
int64_t blkNum = taosArrayGetSize(pBlkList->pList);
if (pSession->lastBlkId < 0) {
if (blkNum > 0) {
SGcBlkBufBasic* pBasic = taosArrayGet(pBlkList->pList, 0);
taosRUnLockLatch(&pBlkList->lock);
code = retrieveBlkFromBufCache(pGCache, pSession->pGroupData, sessionId, pBasic, ppRes);
pSession->lastBlkId = 0;
return code;
}
} else if ((pSession->lastBlkId + 1) < blkNum) {
SGcBlkBufBasic* pBasic = taosArrayGet(pBlkList->pList, pSession->lastBlkId + 1);
taosRUnLockLatch(&pBlkList->lock);
code = retrieveBlkFromBufCache(pGCache, pSession->pGroupData, sessionId, pBasic, ppRes);
pSession->lastBlkId = 0;
pSession->lastBlkId++;
return code;
}
} else if ((pSession->lastBlkId + 1) < blkNum) {
SGcBlkBufBasic* pBasic = taosArrayGet(pBlkList->pList, pSession->lastBlkId + 1);
taosRUnLockLatch(&pBlkList->lock);
code = retrieveBlkFromBufCache(pGCache, pSession->pGroupData, sessionId, pBasic, ppRes);
pSession->lastBlkId++;
} else if (pSession->pGroupData->pBlock) {
*ppRes = pSession->pGroupData->pBlock;
pSession->pGroupData->pBlock = NULL;
return TSDB_CODE_SUCCESS;
}
if (atomic_load_8((int8_t*)&pSession->pGroupData->fetchDone)) {
*ppRes = NULL;
qDebug("sessionId: %" PRIu64 " fetch done", sessionId);
return code;
}
taosRUnLockLatch(&pBlkList->lock);
} else if (pSession->pGroupData->pBlock) {
*ppRes = pSession->pGroupData->pBlock;
pSession->pGroupData->pBlock = NULL;
}
if (atomic_load_8((int8_t*)&pSession->pGroupData->fetchDone)) {
} else {
*ppRes = NULL;
qDebug("sessionId: %" PRIu64 " fetch done since downstream fetch done", sessionId);
return code;
}
@ -1136,13 +1146,17 @@ static int32_t initGroupCacheSession(struct SOperatorInfo* pOperator, SOperatorP
SHashObj* pGrpHash = pGCache->globalGrp ? pGCache->pGrpHash : pCtx->pGrpHash;
SGroupCacheData* pGroup = taosHashGet(pGrpHash, &pGcParam->tbUid, sizeof(pGcParam->tbUid));
if (NULL == pGroup) {
if (NULL == pGroup && (NULL != pParam->pChildren || !pCtx->fetchDone)) {
code = addNewGroupData(pOperator, pParam, &pGroup, pGCache->batchFetch ? GROUP_CACHE_DEFAULT_VGID : pGcParam->vgId, pGcParam->tbUid);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
}
if (NULL == pGroup) {
return TSDB_CODE_SUCCESS;
}
initGroupCacheSessionCtx(&ctx, pGcParam, pGroup);
code = taosHashPut(pCtx->pSessions, &pGcParam->sessionId, sizeof(pGcParam->sessionId), &ctx, sizeof(ctx));
@ -1166,6 +1180,10 @@ static int32_t getBlkFromGroupCache(struct SOperatorInfo* pOperator, SSDataBlock
if (TSDB_CODE_SUCCESS != code) {
return code;
}
if (NULL == pSession) {
qDebug("session %" PRId64 " in downstream %d total got 0 rows since downtream fetch done", pGcParam->sessionId, pCtx->id);
return TSDB_CODE_SUCCESS;
}
} else if (pSession->pGroupData->needCache) {
SSDataBlock** ppBlock = taosHashGet(pGCache->blkCache.pReadBlk, &pGcParam->sessionId, sizeof(pGcParam->sessionId));
if (ppBlock) {
@ -1176,11 +1194,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;

View File

@ -0,0 +1,349 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "executorInt.h"
#include "filter.h"
#include "function.h"
#include "operator.h"
#include "os.h"
#include "querynodes.h"
#include "querytask.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "thash.h"
#include "tmsg.h"
#include "ttypes.h"
#include "hashjoin.h"
int32_t hInnerJoinDo(struct SOperatorInfo* pOperator) {
SHJoinOperatorInfo* pJoin = pOperator->info;
SHJoinTableCtx* pProbe = pJoin->pProbe;
SHJoinCtx* pCtx = &pJoin->ctx;
SSDataBlock* pRes = pJoin->finBlk;
size_t bufLen = 0;
int32_t code = 0;
bool allFetched = false;
if (pJoin->ctx.pBuildRow) {
hJoinAppendResToBlock(pOperator, pRes, &allFetched);
if (pRes->info.rows >= pRes->info.capacity) {
if (allFetched) {
++pCtx->probeStartIdx;
}
return code;
} else {
++pCtx->probeStartIdx;
}
}
for (; pCtx->probeStartIdx <= pCtx->probeEndIdx; ++pCtx->probeStartIdx) {
if (hJoinCopyKeyColsDataToBuf(pProbe, pCtx->probeStartIdx, &bufLen)) {
continue;
}
SGroupData* pGroup = tSimpleHashGet(pJoin->pKeyHash, pProbe->keyData, bufLen);
/*
size_t keySize = 0;
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
pJoin->execInfo.expectRows += rows;
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
*/
if (pGroup) {
pCtx->pBuildRow = pGroup->rows;
hJoinAppendResToBlock(pOperator, pRes, &allFetched);
if (pRes->info.rows >= pRes->info.capacity) {
if (allFetched) {
++pCtx->probeStartIdx;
}
return code;
}
}
}
pCtx->rowRemains = false;
return code;
}
int32_t hLeftJoinHandleSeqRowRemains(struct SOperatorInfo* pOperator, SHJoinOperatorInfo* pJoin, bool* loopCont) {
bool allFetched = false;
SHJoinCtx* pCtx = &pJoin->ctx;
while (!allFetched) {
hJoinAppendResToBlock(pOperator, pJoin->midBlk, &allFetched);
if (pJoin->midBlk->info.rows > 0) {
doFilter(pJoin->midBlk, pJoin->pPreFilter, NULL);
if (pJoin->midBlk->info.rows > 0) {
pCtx->readMatch = true;
HJ_ERR_RET(hJoinCopyMergeMidBlk(pCtx, &pJoin->midBlk, &pJoin->finBlk));
if (pCtx->midRemains) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
}
}
if (allFetched && !pCtx->readMatch) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pCtx->probeStartIdx, 1));
}
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
}
++pCtx->probeStartIdx;
*loopCont = true;
return TSDB_CODE_SUCCESS;
}
int32_t hLeftJoinHandleSeqProbeRows(struct SOperatorInfo* pOperator, SHJoinOperatorInfo* pJoin, bool* loopCont) {
SHJoinTableCtx* pProbe = pJoin->pProbe;
SHJoinCtx* pCtx = &pJoin->ctx;
size_t bufLen = 0;
bool allFetched = false;
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
return TSDB_CODE_SUCCESS;
}
for (; pCtx->probeStartIdx <= pCtx->probeEndIdx; ++pCtx->probeStartIdx) {
if (hJoinCopyKeyColsDataToBuf(pProbe, pCtx->probeStartIdx, &bufLen)) {
continue;
}
SGroupData* pGroup = tSimpleHashGet(pJoin->pKeyHash, pProbe->keyData, bufLen);
/*
size_t keySize = 0;
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
pJoin->execInfo.expectRows += rows;
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
*/
if (NULL == pGroup) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pCtx->probeStartIdx, 1));
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
++pCtx->probeStartIdx;
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
continue;
}
pCtx->readMatch = false;
pCtx->pBuildRow = pGroup->rows;
allFetched = false;
while (!allFetched) {
hJoinAppendResToBlock(pOperator, pJoin->midBlk, &allFetched);
if (pJoin->midBlk->info.rows > 0) {
doFilter(pJoin->midBlk, pJoin->pPreFilter, NULL);
if (pJoin->midBlk->info.rows > 0) {
pCtx->readMatch = true;
HJ_ERR_RET(hJoinCopyMergeMidBlk(pCtx, &pJoin->midBlk, &pJoin->finBlk));
if (pCtx->midRemains) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
}
}
if (allFetched && !pCtx->readMatch) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pCtx->probeStartIdx, 1));
}
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
}
}
pCtx->probePhase = E_JOIN_PHASE_POST;
*loopCont = true;
return TSDB_CODE_SUCCESS;
}
int32_t hLeftJoinHandleRowRemains(struct SOperatorInfo* pOperator, SHJoinOperatorInfo* pJoin, bool* loopCont) {
bool allFetched = false;
SHJoinCtx* pCtx = &pJoin->ctx;
hJoinAppendResToBlock(pOperator, pJoin->finBlk, &allFetched);
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
} else {
++pCtx->probeStartIdx;
}
*loopCont = true;
return TSDB_CODE_SUCCESS;
}
int32_t hLeftJoinHandleProbeRows(struct SOperatorInfo* pOperator, SHJoinOperatorInfo* pJoin, bool* loopCont) {
SHJoinTableCtx* pProbe = pJoin->pProbe;
SHJoinCtx* pCtx = &pJoin->ctx;
size_t bufLen = 0;
bool allFetched = false;
for (; pCtx->probeStartIdx <= pCtx->probeEndIdx; ++pCtx->probeStartIdx) {
if (hJoinCopyKeyColsDataToBuf(pProbe, pCtx->probeStartIdx, &bufLen)) {
continue;
}
SGroupData* pGroup = tSimpleHashGet(pJoin->pKeyHash, pProbe->keyData, bufLen);
/*
size_t keySize = 0;
int32_t* pKey = tSimpleHashGetKey(pGroup, &keySize);
ASSERT(keySize == bufLen && 0 == memcmp(pKey, pProbe->keyData, bufLen));
int64_t rows = getSingleKeyRowsNum(pGroup->rows);
pJoin->execInfo.expectRows += rows;
qTrace("hash_key:%d, rows:%" PRId64, *pKey, rows);
*/
if (NULL == pGroup) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pCtx->probeStartIdx, 1));
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
++pCtx->probeStartIdx;
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
continue;
}
pCtx->pBuildRow = pGroup->rows;
hJoinAppendResToBlock(pOperator, pJoin->finBlk, &allFetched);
if (hJoinBlkReachThreshold(pJoin, pJoin->finBlk->info.rows)) {
if (allFetched) {
++pCtx->probeStartIdx;
}
*loopCont = false;
return TSDB_CODE_SUCCESS;
}
}
pCtx->probePhase = E_JOIN_PHASE_POST;
*loopCont = true;
return TSDB_CODE_SUCCESS;
}
int32_t hLeftJoinDo(struct SOperatorInfo* pOperator) {
SHJoinOperatorInfo* pJoin = pOperator->info;
SHJoinCtx* pCtx = &pJoin->ctx;
while (pCtx->rowRemains) {
switch (pCtx->probePhase) {
case E_JOIN_PHASE_PRE: {
int32_t rows = pCtx->probeStartIdx - pCtx->probePreIdx;
int32_t rowsLeft = pJoin->finBlk->info.capacity - pJoin->finBlk->info.rows;
if (rows <= rowsLeft) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, 0, rows));
pCtx->probePhase = E_JOIN_PHASE_CUR;
} else {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, 0, rowsLeft));
pJoin->ctx.probePreIdx += rowsLeft;
return TSDB_CODE_SUCCESS;
}
break;
}
case E_JOIN_PHASE_CUR: {
bool loopCont = false;
if (NULL == pJoin->ctx.pBuildRow) {
HJ_ERR_RET(pJoin->pPreFilter ? hLeftJoinHandleSeqProbeRows(pOperator, pJoin, &loopCont) : hLeftJoinHandleProbeRows(pOperator, pJoin, &loopCont));
} else {
HJ_ERR_RET(pJoin->pPreFilter ? hLeftJoinHandleSeqRowRemains(pOperator, pJoin, &loopCont) : hLeftJoinHandleRowRemains(pOperator, pJoin, &loopCont));
}
if (!loopCont) {
return TSDB_CODE_SUCCESS;
}
break;
}
case E_JOIN_PHASE_POST: {
if (pCtx->probeEndIdx < (pCtx->pProbeData->info.rows - 1) && pCtx->probePostIdx <= (pCtx->pProbeData->info.rows - 1)) {
int32_t rowsLeft = pJoin->finBlk->info.capacity - pJoin->finBlk->info.rows;
int32_t rows = pCtx->pProbeData->info.rows - pCtx->probePostIdx;
if (rows <= rowsLeft) {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pJoin->ctx.probePostIdx, rows));
pCtx->rowRemains = false;
} else {
HJ_ERR_RET(hJoinCopyNMatchRowsToBlock(pJoin, pJoin->finBlk, pJoin->ctx.probePostIdx, rowsLeft));
pCtx->probePostIdx += rowsLeft;
return TSDB_CODE_SUCCESS;
}
} else {
pJoin->ctx.rowRemains = false;
}
break;
}
default:
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
}
return TSDB_CODE_SUCCESS;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -352,7 +352,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// continue merge data, ignore the group id
blockDataMerge(pFinalRes, pRes);
if (pFinalRes->info.rows + pRes->info.rows <= pOperator->resultInfo.threshold) {
if (pFinalRes->info.rows + pRes->info.rows <= pOperator->resultInfo.threshold && (pOperator->status != OP_EXEC_DONE)) {
continue;
}
}

View File

@ -928,7 +928,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) {
@ -962,7 +962,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;
@ -4056,7 +4056,7 @@ static int32_t stopSubTablesTableMergeScan(STableMergeScanInfo* pInfo) {
taosMemoryFree(pSubTblsInfo);
pInfo->pSubTablesMergeInfo = NULL;
taosMemoryTrim(0);
//taosMemoryTrim(0);
}
return TSDB_CODE_SUCCESS;
}
@ -4074,6 +4074,8 @@ SSDataBlock* doTableMergeScanParaSubTables(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
int64_t st = taosGetTimestampUs();
size_t tableListSize = tableListGetSize(pInfo->base.pTableListInfo);
if (!pInfo->hasGroupId) {
pInfo->hasGroupId = true;
@ -4102,7 +4104,7 @@ SSDataBlock* doTableMergeScanParaSubTables(SOperatorInfo* pOperator) {
pBlock->info.id.groupId = pInfo->groupId;
pOperator->resultInfo.totalRows += pBlock->info.rows;
pInfo->bGroupProcessed = true;
return pBlock;
break;
} else {
// Data of this group are all dumped, let's try the next group
stopSubTablesTableMergeScan(pInfo);
@ -4118,6 +4120,8 @@ SSDataBlock* doTableMergeScanParaSubTables(SOperatorInfo* pOperator) {
}
}
pOperator->cost.totalCost += (taosGetTimestampUs() - st) / 1000.0;;
return pBlock;
}
@ -4480,6 +4484,8 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
T_LONG_JMP(pTaskInfo->env, code);
}
int64_t st = taosGetTimestampUs();
size_t tableListSize = tableListGetSize(pInfo->base.pTableListInfo);
if (!pInfo->hasGroupId) {
pInfo->hasGroupId = true;
@ -4509,7 +4515,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
pBlock->info.id.groupId = pInfo->groupId;
pOperator->resultInfo.totalRows += pBlock->info.rows;
pInfo->bGroupProcessed = true;
return pBlock;
break;
} else {
if (pInfo->bNewFilesetEvent) {
stopDurationForGroupTableMergeScan(pOperator);
@ -4533,6 +4539,8 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
}
}
pOperator->cost.totalCost += (taosGetTimestampUs() - st) / 1000.0;;
return pBlock;
}

View File

@ -1,35 +1,35 @@
MESSAGE(STATUS "build parser unit test")
IF(NOT TD_DARWIN)
# GoogleTest requires at least C++11
SET(CMAKE_CXX_STANDARD 11)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
# IF(NOT TD_DARWIN)
# # GoogleTest requires at least C++11
# SET(CMAKE_CXX_STANDARD 11)
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
#
# ADD_EXECUTABLE(executorTest ${SOURCE_LIST})
# TARGET_LINK_LIBRARIES(
# executorTest
# PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode
# )
#
# TARGET_INCLUDE_DIRECTORIES(
# executorTest
# PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/"
# PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc"
# )
# ENDIF ()
ADD_EXECUTABLE(executorTest ${SOURCE_LIST})
TARGET_LINK_LIBRARIES(
executorTest
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes vnode
)
SET(CMAKE_CXX_STANDARD 11)
AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
TARGET_INCLUDE_DIRECTORIES(
executorTest
PUBLIC "${TD_SOURCE_DIR}/include/libs/executor/"
PRIVATE "${TD_SOURCE_DIR}/source/libs/executor/inc"
)
ENDIF ()
ADD_EXECUTABLE(joinTests joinTests.cpp)
TARGET_LINK_LIBRARIES(
joinTests
PRIVATE os util common executor gtest_main qcom function planner scalar nodes vnode
)
# SET(CMAKE_CXX_STANDARD 11)
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
# ADD_EXECUTABLE(tSimpleHashTest tSimpleHashTests.cpp)
# TARGET_LINK_LIBRARIES(
# tSimpleHashTest
# PRIVATE os util common executor gtest_main
# )
# TARGET_INCLUDE_DIRECTORIES(
# tSimpleHashTest
# PUBLIC "${TD_SOURCE_DIR}/include/common"
# PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
# )
TARGET_INCLUDE_DIRECTORIES(
joinTests
PUBLIC "${TD_SOURCE_DIR}/include/common"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
)

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,8 @@ extern "C" {
#define FUNC_MGT_GEOMETRY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(24)
#define FUNC_MGT_FORBID_SYSTABLE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(25)
#define FUNC_MGT_SKIP_SCAN_CHECK_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(26)
#define FUNC_MGT_PRIMARY_KEY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(27)
#define FUNC_MGT_IGNORE_NULL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(27)
#define FUNC_MGT_PRIMARY_KEY_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(28)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)

View File

@ -46,7 +46,7 @@ static int32_t invaildFuncParaValueErrMsg(char* pErrBuf, int32_t len, const char
#define TIME_UNIT_TOO_SMALL 2
static int32_t validateTimeUnitParam(uint8_t dbPrec, const SValueNode* pVal) {
if (!pVal->isDuration) {
if (!IS_DURATION_VAL(pVal->flag)) {
return TIME_UNIT_INVALID;
}
@ -225,7 +225,6 @@ static int32_t addTimezoneParam(SNodeList* pList) {
}
pVal->literal = strndup(buf, len);
pVal->isDuration = false;
pVal->translate = true;
pVal->node.resType.type = TSDB_DATA_TYPE_BINARY;
pVal->node.resType.bytes = len + VARSTR_HEADER_SIZE;
@ -245,7 +244,6 @@ static int32_t addDbPrecisonParam(SNodeList** pList, uint8_t precision) {
}
pVal->literal = NULL;
pVal->isDuration = false;
pVal->translate = true;
pVal->notReserved = true;
pVal->node.resType.type = TSDB_DATA_TYPE_TINYINT;
@ -547,6 +545,9 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
for (int32_t i = 1; i < numOfParams; ++i) {
SValueNode* pValue = (SValueNode*)nodesListGetNode(pFunc->pParameterList, i);
if (QUERY_NODE_VALUE != nodeType(pValue)) {
return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName);
}
pValue->notReserved = true;
uint8_t paraType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, i))->type;
@ -2399,7 +2400,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "count",
.type = FUNCTION_TYPE_COUNT,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateCount,
.dataRequiredFunc = countDataRequired,
.getEnvFunc = getCountFuncEnv,
@ -2417,7 +2418,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "sum",
.type = FUNCTION_TYPE_SUM,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateSum,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getSumFuncEnv,
@ -2435,7 +2436,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "min",
.type = FUNCTION_TYPE_MIN,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateInOutNum,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getMinmaxFuncEnv,
@ -2450,7 +2451,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "max",
.type = FUNCTION_TYPE_MAX,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_SELECT_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateInOutNum,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getMinmaxFuncEnv,
@ -2525,7 +2526,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "avg",
.type = FUNCTION_TYPE_AVG,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SPECIAL_DATA_REQUIRED | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateInNumOutDou,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getAvgFuncEnv,
@ -2544,7 +2545,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_avg_partial",
.type = FUNCTION_TYPE_AVG_PARTIAL,
.classification = FUNC_MGT_AGG_FUNC,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateAvgPartial,
.dataRequiredFunc = statisDataRequired,
.getEnvFunc = getAvgFuncEnv,
@ -2559,7 +2560,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_avg_merge",
.type = FUNCTION_TYPE_AVG_MERGE,
.classification = FUNC_MGT_AGG_FUNC,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateAvgMerge,
.getEnvFunc = getAvgFuncEnv,
.initFunc = avgFunctionSetup,
@ -2636,7 +2637,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "top",
.type = FUNCTION_TYPE_TOP,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC |
FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC,
FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateTopBot,
.getEnvFunc = getTopBotFuncEnv,
.initFunc = topBotFunctionSetup,
@ -2652,7 +2653,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "bottom",
.type = FUNCTION_TYPE_BOTTOM,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_ROWS_FUNC | FUNC_MGT_KEEP_ORDER_FUNC |
FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC,
FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_FILL_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateTopBot,
.getEnvFunc = getTopBotFuncEnv,
.initFunc = topBotFunctionSetup,
@ -2850,7 +2851,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.name = "_cache_last",
.type = FUNCTION_TYPE_CACHE_LAST,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC,
.translateFunc = translateFirstLast,
.getEnvFunc = getFirstLastFuncEnv,
.initFunc = functionSetup,
@ -2884,7 +2885,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "first",
.type = FUNCTION_TYPE_FIRST,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLast,
.dynDataRequiredFunc = firstDynDataReq,
.getEnvFunc = getFirstLastFuncEnv,
@ -2900,7 +2901,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "_first_partial",
.type = FUNCTION_TYPE_FIRST_PARTIAL,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLastPartial,
.dynDataRequiredFunc = firstDynDataReq,
.getEnvFunc = getFirstLastFuncEnv,
@ -2913,7 +2914,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "_first_merge",
.type = FUNCTION_TYPE_FIRST_MERGE,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLastMerge,
.getEnvFunc = getFirstLastFuncEnv,
.initFunc = functionSetup,
@ -2925,7 +2926,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "last",
.type = FUNCTION_TYPE_LAST,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLast,
.dynDataRequiredFunc = lastDynDataReq,
.getEnvFunc = getFirstLastFuncEnv,
@ -2941,7 +2942,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "_last_partial",
.type = FUNCTION_TYPE_LAST_PARTIAL,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLastPartial,
.dynDataRequiredFunc = lastDynDataReq,
.getEnvFunc = getFirstLastFuncEnv,
@ -2954,7 +2955,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.name = "_last_merge",
.type = FUNCTION_TYPE_LAST_MERGE,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_IGNORE_NULL_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
.translateFunc = translateFirstLastMerge,
.getEnvFunc = getFirstLastFuncEnv,
.initFunc = functionSetup,

View File

@ -3273,6 +3273,11 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) {
if (pDiffInfo->includeNull) {
colDataSetNull_f_s(pOutput, pos);
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityCols(pCtx, row.block, row.rowIndex, pos);
}
numOfElems += 1;
}
continue;

View File

@ -274,6 +274,8 @@ bool fmIsBlockDistFunc(int32_t funcId) {
return FUNCTION_TYPE_BLOCK_DIST == funcMgtBuiltins[funcId].type;
}
bool fmIsIgnoreNullFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_IGNORE_NULL_FUNC); }
void fmFuncMgtDestroy() {
void* m = gFunMgtService.pFuncNameHashTable;
if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) {

View File

@ -114,6 +114,7 @@ static int32_t columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) {
COPY_SCALAR_FIELD(projIdx);
COPY_SCALAR_FIELD(colType);
COPY_SCALAR_FIELD(hasIndex);
COPY_SCALAR_FIELD(isPrimTs);
COPY_CHAR_ARRAY_FIELD(dbName);
COPY_CHAR_ARRAY_FIELD(tableName);
COPY_CHAR_ARRAY_FIELD(tableAlias);
@ -138,7 +139,7 @@ static int32_t columnDefNodeCopy(const SColumnDefNode* pSrc, SColumnDefNode* pDs
static int32_t valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
COPY_BASE_OBJECT_FIELD(node, exprNodeCopy);
COPY_CHAR_POINT_FIELD(literal);
COPY_SCALAR_FIELD(isDuration);
COPY_SCALAR_FIELD(flag);
COPY_SCALAR_FIELD(translate);
COPY_SCALAR_FIELD(notReserved);
COPY_SCALAR_FIELD(isNull);
@ -297,6 +298,7 @@ static int32_t tempTableNodeCopy(const STempTableNode* pSrc, STempTableNode* pDs
static int32_t joinTableNodeCopy(const SJoinTableNode* pSrc, SJoinTableNode* pDst) {
COPY_BASE_OBJECT_FIELD(table, tableNodeCopy);
COPY_SCALAR_FIELD(joinType);
COPY_SCALAR_FIELD(subType);
COPY_SCALAR_FIELD(hasSubQuery);
COPY_SCALAR_FIELD(isLowLevelJoin);
CLONE_NODE_FIELD(pLeft);
@ -413,6 +415,14 @@ static int32_t hintNodeCopy(const SHintNode* pSrc, SHintNode* pDst) {
return copyHintValue(pSrc, pDst);
}
static int32_t windowOffsetCopy(const SWindowOffsetNode* pSrc, SWindowOffsetNode* pDst) {
COPY_SCALAR_FIELD(type);
CLONE_NODE_FIELD(pStartOffset);
CLONE_NODE_FIELD(pEndOffset);
return TSDB_CODE_SUCCESS;
}
static int32_t logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
CLONE_NODE_LIST_FIELD(pTargets);
CLONE_NODE_FIELD(pConditions);
@ -479,14 +489,30 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) {
COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
COPY_SCALAR_FIELD(joinType);
COPY_SCALAR_FIELD(subType);
COPY_SCALAR_FIELD(joinAlgo);
CLONE_NODE_FIELD(pWindowOffset);
CLONE_NODE_FIELD(pJLimit);
CLONE_NODE_FIELD(addPrimEqCond);
CLONE_NODE_FIELD(pPrimKeyEqCond);
CLONE_NODE_FIELD(pColEqCond);
CLONE_NODE_FIELD(pColOnCond);
CLONE_NODE_FIELD(pTagEqCond);
CLONE_NODE_FIELD(pTagOnCond);
CLONE_NODE_FIELD(pOtherOnCond);
CLONE_NODE_FIELD(pFullOnCond);
CLONE_NODE_LIST_FIELD(pLeftEqNodes);
CLONE_NODE_LIST_FIELD(pRightEqNodes);
COPY_SCALAR_FIELD(allEqTags);
COPY_SCALAR_FIELD(isSingleTableJoin);
COPY_SCALAR_FIELD(hasSubQuery);
COPY_SCALAR_FIELD(isLowLevelJoin);
COPY_SCALAR_FIELD(seqWinGroup);
COPY_SCALAR_FIELD(grpJoin);
COPY_SCALAR_FIELD(hashJoinHint);
CLONE_NODE_FIELD(pLeftOnCond);
CLONE_NODE_FIELD(pRightOnCond);
COPY_SCALAR_FIELD(timeRangeTarget);
COPY_OBJECT_FIELD(timeRange, sizeof(STimeWindow));
return TSDB_CODE_SUCCESS;
}
@ -811,6 +837,7 @@ static int32_t selectStmtCopy(const SSelectStmt* pSrc, SSelectStmt* pDst) {
COPY_SCALAR_FIELD(precision);
COPY_SCALAR_FIELD(isEmptyResult);
COPY_SCALAR_FIELD(timeLineResMode);
COPY_SCALAR_FIELD(timeLineCurMode);
COPY_SCALAR_FIELD(hasAggFuncs);
COPY_SCALAR_FIELD(hasRepeatScanFuncs);
CLONE_NODE_LIST_FIELD(pHint);
@ -924,6 +951,9 @@ SNode* nodesCloneNode(const SNode* pNode) {
case QUERY_NODE_HINT:
code = hintNodeCopy((const SHintNode*)pNode, (SHintNode*)pDst);
break;
case QUERY_NODE_WINDOW_OFFSET:
code = windowOffsetCopy((const SWindowOffsetNode*)pNode, (SWindowOffsetNode*)pDst);
break;
case QUERY_NODE_SET_OPERATOR:
code = setOperatorCopy((const SSetOperator*)pNode, (SSetOperator*)pDst);
break;

View File

@ -91,6 +91,8 @@ const char* nodesNodeName(ENodeType type) {
return "CaseWhen";
case QUERY_NODE_EVENT_WINDOW:
return "EventWindow";
case QUERY_NODE_WINDOW_OFFSET:
return "WindowOffset";
case QUERY_NODE_COUNT_WINDOW:
return "CountWindow";
case QUERY_NODE_SET_OPERATOR:
@ -1621,7 +1623,7 @@ static int32_t logicJoinNodeToJson(const void* pObj, SJson* pJson) {
code = tjsonAddObject(pJson, jkJoinLogicPlanTagEqCondition, nodeToJson, pNode->pTagEqCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinLogicPlanOnConditions, nodeToJson, pNode->pOtherOnCond);
code = tjsonAddObject(pJson, jkJoinLogicPlanOnConditions, nodeToJson, pNode->pFullOnCond);
}
return code;
}
@ -1646,7 +1648,7 @@ static int32_t jsonToLogicJoinNode(const SJson* pJson, void* pObj) {
code = jsonToNodeObject(pJson, jkJoinLogicPlanTagEqCondition, &pNode->pTagEqCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinLogicPlanOnConditions, &pNode->pOtherOnCond);
code = jsonToNodeObject(pJson, jkJoinLogicPlanOnConditions, &pNode->pFullOnCond);
}
return code;
@ -2166,15 +2168,34 @@ static int32_t jsonToPhysiProjectNode(const SJson* pJson, void* pObj) {
}
static const char* jkJoinPhysiPlanJoinType = "JoinType";
static const char* jkJoinPhysiPlanSubType = "SubType";
static const char* jkJoinPhysiPlanWinOffset = "WindowOffset";
static const char* jkJoinPhysiPlanJoinLimit = "JoinLimit";
static const char* jkJoinPhysiPlanAsofOp = "AsofOp";
static const char* jkJoinPhysiPlanLeftPrimExpr = "LeftPrimExpr";
static const char* jkJoinPhysiPlanRightPrimExpr = "RightPrimExpr";
static const char* jkJoinPhysiPlanLeftPrimSlotId = "LeftPrimSlotId";
static const char* jkJoinPhysiPlanRightPrimSlotId = "RightPrimSlotId";
static const char* jkJoinPhysiPlanLeftEqCols = "LeftEqCols";
static const char* jkJoinPhysiPlanRightEqCols = "RightEqCols";
static const char* jkJoinPhysiPlanInputTsOrder = "InputTsOrder";
static const char* jkJoinPhysiPlanOnLeftCols = "OnLeftColumns";
static const char* jkJoinPhysiPlanOnRightCols = "OnRightColumns";
static const char* jkJoinPhysiPlanPrimKeyCondition = "PrimKeyCondition";
static const char* jkJoinPhysiPlanOnConditions = "OnConditions";
static const char* jkJoinPhysiPlanTargets = "Targets";
static const char* jkJoinPhysiPlanColEqualOnConditions = "ColumnEqualOnConditions";
static const char* jkJoinPhysiPlanInputRowNum = "InputRowNum";
static const char* jkJoinPhysiPlanInputRowSize = "InputRowSize";
static const char* jkJoinPhysiPlanColOnConditions = "ColumnOnConditions";
static const char* jkJoinPhysiPlanLeftInputRowNum = "LeftInputRowNum";
static const char* jkJoinPhysiPlanRightInputRowNum = "RightInputRowNum";
static const char* jkJoinPhysiPlanLeftInputRowSize = "LeftInputRowSize";
static const char* jkJoinPhysiPlanRightInputRowSize = "RightInputRowSize";
static const char* jkJoinPhysiPlanSeqWinGroup = "SeqWinGroup";
static const char* jkJoinPhysiPlanGroupJoin = "GroupJoin";
static const char* jkJoinPhysiPlanLeftOnCond = "LeftOnCond";
static const char* jkJoinPhysiPlanRightOnCond = "RightOnCond";
static const char* jkJoinPhysiPlanTimeRangeSKey = "TimeRangeSKey";
static const char* jkJoinPhysiPlanTimeRangeEKey = "TimeRangeEKey";
static const char* jkJoinPhysiPlanTimeRangeTarget = "TimeRangeTarget";
static int32_t physiMergeJoinNodeToJson(const void* pObj, SJson* pJson) {
const SSortMergeJoinPhysiNode* pNode = (const SSortMergeJoinPhysiNode*)pObj;
@ -2184,17 +2205,63 @@ static int32_t physiMergeJoinNodeToJson(const void* pObj, SJson* pJson) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanJoinType, pNode->joinType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanPrimKeyCondition, nodeToJson, pNode->pPrimKeyCond);
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanSubType, pNode->subType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanOnConditions, nodeToJson, pNode->pOtherOnCond);
code = tjsonAddObject(pJson, jkJoinPhysiPlanWinOffset, nodeToJson, pNode->pWindowOffset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanJoinLimit, nodeToJson, pNode->pJLimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanAsofOp, pNode->asofOpType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanLeftPrimExpr, nodeToJson, pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanRightPrimExpr, nodeToJson, pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftPrimSlotId, pNode->leftPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightPrimSlotId, pNode->rightPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkJoinPhysiPlanLeftEqCols, pNode->pEqLeft);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkJoinPhysiPlanRightEqCols, pNode->pEqRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanOnConditions, nodeToJson, pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkJoinPhysiPlanTargets, pNode->pTargets);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanColEqualOnConditions, nodeToJson, pNode->pColEqCond);
code = tjsonAddObject(pJson, jkJoinPhysiPlanColOnConditions, nodeToJson, pNode->pColOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftInputRowNum, pNode->inputStat[0].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftInputRowSize, pNode->inputStat[0].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightInputRowNum, pNode->inputStat[1].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightInputRowSize, pNode->inputStat[1].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkJoinPhysiPlanSeqWinGroup, pNode->seqWinGroup);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkJoinPhysiPlanGroupJoin, pNode->grpJoin);
}
return code;
}
@ -2206,17 +2273,63 @@ static int32_t jsonToPhysiMergeJoinNode(const SJson* pJson, void* pObj) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanJoinType, pNode->joinType, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanOnConditions, &pNode->pOtherOnCond);
tjsonGetNumberValue(pJson, jkJoinPhysiPlanSubType, pNode->subType, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanPrimKeyCondition, &pNode->pPrimKeyCond);
code = jsonToNodeObject(pJson, jkJoinPhysiPlanWinOffset, &pNode->pWindowOffset);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanJoinLimit, &pNode->pJLimit);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanAsofOp, pNode->asofOpType, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanLeftPrimExpr, &pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanRightPrimExpr, &pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftPrimSlotId, pNode->leftPrimSlotId, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightPrimSlotId, pNode->rightPrimSlotId, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanLeftEqCols, &pNode->pEqLeft);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanRightEqCols, &pNode->pEqRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanOnConditions, &pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanTargets, &pNode->pTargets);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanColEqualOnConditions, &pNode->pColEqCond);
code = jsonToNodeObject(pJson, jkJoinPhysiPlanColOnConditions, &pNode->pColOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftInputRowNum, pNode->inputStat[0].inputRowNum, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftInputRowSize, pNode->inputStat[0].inputRowSize, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightInputRowNum, pNode->inputStat[1].inputRowNum, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightInputRowSize, pNode->inputStat[1].inputRowSize, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkJoinPhysiPlanSeqWinGroup, &pNode->seqWinGroup);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkJoinPhysiPlanGroupJoin, &pNode->grpJoin);
}
return code;
}
@ -2227,6 +2340,9 @@ static int32_t physiHashJoinNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanJoinType, pNode->joinType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanSubType, pNode->subType);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkJoinPhysiPlanOnLeftCols, pNode->pOnLeft);
}
@ -2234,23 +2350,51 @@ static int32_t physiHashJoinNodeToJson(const void* pObj, SJson* pJson) {
code = nodeListToJson(pJson, jkJoinPhysiPlanOnRightCols, pNode->pOnRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanOnConditions, nodeToJson, pNode->pFilterConditions);
code = tjsonAddObject(pJson, jkJoinPhysiPlanLeftPrimExpr, nodeToJson, pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanRightPrimExpr, nodeToJson, pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftPrimSlotId, pNode->leftPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightPrimSlotId, pNode->rightPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanOnConditions, nodeToJson, pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = nodeListToJson(pJson, jkJoinPhysiPlanTargets, pNode->pTargets);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanInputRowNum, pNode->inputStat[0].inputRowNum);
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftInputRowNum, pNode->inputStat[0].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanInputRowSize, pNode->inputStat[0].inputRowSize);
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanLeftInputRowSize, pNode->inputStat[0].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanInputRowNum, pNode->inputStat[1].inputRowNum);
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightInputRowNum, pNode->inputStat[1].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanInputRowSize, pNode->inputStat[1].inputRowSize);
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanRightInputRowSize, pNode->inputStat[1].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanLeftOnCond, nodeToJson, pNode->pLeftOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinPhysiPlanRightOnCond, nodeToJson, pNode->pRightOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanTimeRangeTarget, pNode->timeRangeTarget);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanTimeRangeSKey, pNode->timeRange.skey);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanTimeRangeEKey, pNode->timeRange.ekey);
}
return code;
}
@ -2261,6 +2405,9 @@ static int32_t jsonToPhysiHashJoinNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanJoinType, pNode->joinType, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanSubType, pNode->subType, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanOnLeftCols, &pNode->pOnLeft);
}
@ -2268,23 +2415,51 @@ static int32_t jsonToPhysiHashJoinNode(const SJson* pJson, void* pObj) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanOnRightCols, &pNode->pOnRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanOnConditions, &pNode->pFilterConditions);
code = jsonToNodeObject(pJson, jkJoinPhysiPlanLeftPrimExpr, &pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanRightPrimExpr, &pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftPrimSlotId, pNode->leftPrimSlotId, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightPrimSlotId, pNode->rightPrimSlotId, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanOnConditions, &pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeList(pJson, jkJoinPhysiPlanTargets, &pNode->pTargets);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanInputRowNum, pNode->inputStat[0].inputRowNum, code);
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftInputRowNum, pNode->inputStat[0].inputRowNum, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanInputRowSize, pNode->inputStat[0].inputRowSize, code);
tjsonGetNumberValue(pJson, jkJoinPhysiPlanLeftInputRowSize, pNode->inputStat[0].inputRowSize, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanInputRowNum, pNode->inputStat[1].inputRowNum, code);
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightInputRowNum, pNode->inputStat[1].inputRowNum, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanInputRowSize, pNode->inputStat[1].inputRowSize, code);
tjsonGetNumberValue(pJson, jkJoinPhysiPlanRightInputRowSize, pNode->inputStat[1].inputRowSize, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanLeftOnCond, &pNode->pLeftOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinPhysiPlanRightOnCond, &pNode->pRightOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinPhysiPlanTimeRangeTarget, pNode->timeRangeTarget, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkJoinPhysiPlanTimeRangeSKey, &pNode->timeRange.skey);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBigIntValue(pJson, jkJoinPhysiPlanTimeRangeEKey, &pNode->timeRange.ekey);
}
return code;
}
@ -3728,7 +3903,7 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
static const char* jkValueLiteralSize = "LiteralSize";
static const char* jkValueLiteral = "Literal";
static const char* jkValueDuration = "Duration";
static const char* jkValueFlag = "Flag";
static const char* jkValueTranslate = "Translate";
static const char* jkValueNotReserved = "NotReserved";
static const char* jkValueIsNull = "IsNull";
@ -3812,7 +3987,7 @@ static int32_t valueNodeToJson(const void* pObj, SJson* pJson) {
code = tjsonAddStringToObject(pJson, jkValueLiteral, pNode->literal);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkValueDuration, pNode->isDuration);
code = tjsonAddBoolToObject(pJson, jkValueFlag, pNode->flag);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkValueTranslate, pNode->translate);
@ -3966,7 +4141,7 @@ static int32_t jsonToValueNode(const SJson* pJson, void* pObj) {
code = tjsonDupStringValue(pJson, jkValueLiteral, &pNode->literal);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkValueDuration, &pNode->isDuration);
code = tjsonGetIntValue(pJson, jkValueFlag, &pNode->flag);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkValueTranslate, &pNode->translate);
@ -4311,6 +4486,7 @@ static int32_t jsonToTempTableNode(const SJson* pJson, void* pObj) {
}
static const char* jkJoinTableJoinType = "JoinType";
static const char* jkJoinTableSubType = "SubType";
static const char* jkJoinTableLeft = "Left";
static const char* jkJoinTableRight = "Right";
static const char* jkJoinTableOnCond = "OnCond";
@ -4322,6 +4498,9 @@ static int32_t joinTableNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinTableJoinType, pNode->joinType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddIntegerToObject(pJson, jkJoinTableSubType, pNode->subType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkJoinTableLeft, nodeToJson, pNode->pLeft);
}
@ -4342,6 +4521,9 @@ static int32_t jsonToJoinTableNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinTableJoinType, pNode->joinType, code);
}
if (TSDB_CODE_SUCCESS == code) {
tjsonGetNumberValue(pJson, jkJoinTableSubType, pNode->subType, code);
}
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkJoinTableLeft, &pNode->pLeft);
}
@ -4830,6 +5012,29 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) {
return code;
}
static const char* jkWindowOffsetStartOffset = "StartOffset";
static const char* jkWindowOffsetEndOffset = "EndOffset";
static int32_t windowOffsetNodeToJson(const void* pObj, SJson* pJson) {
const SWindowOffsetNode* pNode = (const SWindowOffsetNode*)pObj;
int32_t code = tjsonAddObject(pJson, jkWindowOffsetStartOffset, nodeToJson, pNode->pStartOffset);
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkWindowOffsetEndOffset, nodeToJson, pNode->pEndOffset);
}
return code;
}
static int32_t jsonToWindowOffsetNode(const SJson* pJson, void* pObj) {
SWindowOffsetNode* pNode = (SWindowOffsetNode*)pObj;
int32_t code = jsonToNodeObject(pJson, jkWindowOffsetStartOffset, &pNode->pStartOffset);
if (TSDB_CODE_SUCCESS == code) {
code = jsonToNodeObject(pJson, jkWindowOffsetEndOffset, &pNode->pEndOffset);
}
return code;
}
static const char* jkDatabaseOptionsBuffer = "Buffer";
static const char* jkDatabaseOptionsCacheModel = "CacheModel";
static const char* jkDatabaseOptionsCompressionLevel = "CompressionLevel";
@ -7170,6 +7375,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return caseWhenNodeToJson(pObj, pJson);
case QUERY_NODE_EVENT_WINDOW:
return eventWindowNodeToJson(pObj, pJson);
case QUERY_NODE_WINDOW_OFFSET:
return windowOffsetNodeToJson(pObj, pJson);
case QUERY_NODE_COUNT_WINDOW:
return countWindowNodeToJson(pObj, pJson);
case QUERY_NODE_SET_OPERATOR:
@ -7511,6 +7718,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToCaseWhenNode(pJson, pObj);
case QUERY_NODE_EVENT_WINDOW:
return jsonToEventWindowNode(pJson, pObj);
case QUERY_NODE_WINDOW_OFFSET:
return jsonToWindowOffsetNode(pJson, pObj);
case QUERY_NODE_COUNT_WINDOW:
return jsonToCountWindowNode(pJson, pObj);
case QUERY_NODE_SET_OPERATOR:

View File

@ -808,7 +808,7 @@ static int32_t msgToColumnNode(STlvDecoder* pDecoder, void* pObj) {
enum {
VALUE_CODE_EXPR_BASE = 1,
VALUE_CODE_LITERAL,
VALUE_CODE_IS_DURATION,
VALUE_CODE_FLAG,
VALUE_CODE_TRANSLATE,
VALUE_CODE_NOT_RESERVED,
VALUE_CODE_IS_NULL,
@ -869,7 +869,7 @@ static int32_t valueNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
code = tlvEncodeCStr(pEncoder, VALUE_CODE_LITERAL, pNode->literal);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, VALUE_CODE_IS_DURATION, pNode->isDuration);
code = tlvEncodeI32(pEncoder, VALUE_CODE_FLAG, pNode->flag);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, VALUE_CODE_TRANSLATE, pNode->translate);
@ -992,8 +992,8 @@ static int32_t msgToValueNode(STlvDecoder* pDecoder, void* pObj) {
case VALUE_CODE_LITERAL:
code = tlvDecodeCStrP(pTlv, &pNode->literal);
break;
case VALUE_CODE_IS_DURATION:
code = tlvDecodeBool(pTlv, &pNode->isDuration);
case VALUE_CODE_FLAG:
code = tlvDecodeI32(pTlv, &pNode->flag);
break;
case VALUE_CODE_TRANSLATE:
code = tlvDecodeBool(pTlv, &pNode->translate);
@ -1879,6 +1879,41 @@ static int32_t msgToCaseWhenNode(STlvDecoder* pDecoder, void* pObj) {
return code;
}
enum { WINDOW_OFFSET_CODE_START_OFFSET = 1, WINDOW_OFFSET_CODE_END_OFFSET };
static int32_t windowOffsetNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
const SWindowOffsetNode* pNode = (const SWindowOffsetNode*)pObj;
int32_t code = tlvEncodeObj(pEncoder, WINDOW_OFFSET_CODE_START_OFFSET, nodeToMsg, pNode->pStartOffset);
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, WINDOW_OFFSET_CODE_END_OFFSET, nodeToMsg, pNode->pEndOffset);
}
return code;
}
static int32_t msgToWindowOffsetNode(STlvDecoder* pDecoder, void* pObj) {
SWindowOffsetNode* pNode = (SWindowOffsetNode*)pObj;
int32_t code = TSDB_CODE_SUCCESS;
STlv* pTlv = NULL;
tlvForEach(pDecoder, pTlv, code) {
switch (pTlv->type) {
case WINDOW_OFFSET_CODE_START_OFFSET:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pStartOffset);
break;
case WINDOW_OFFSET_CODE_END_OFFSET:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pEndOffset);
break;
default:
break;
}
}
return code;
}
enum {
PHY_NODE_CODE_OUTPUT_DESC = 1,
PHY_NODE_CODE_CONDITIONS,
@ -2465,11 +2500,25 @@ static int32_t msgToPhysiProjectNode(STlvDecoder* pDecoder, void* pObj) {
enum {
PHY_SORT_MERGE_JOIN_CODE_BASE_NODE = 1,
PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE,
PHY_SORT_MERGE_JOIN_CODE_PRIM_KEY_CONDITION,
PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS,
PHY_SORT_MERGE_JOIN_CODE_SUB_TYPE,
PHY_SORT_MERGE_JOIN_CODE_WINDOW_OFFSET,
PHY_SORT_MERGE_JOIN_CODE_JOIN_LIMIT,
PHY_SORT_MERGE_JOIN_CODE_ASOF_OP,
PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_EXPR,
PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_EXPR,
PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_SLOT_ID,
PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_SLOT_ID,
PHY_SORT_MERGE_JOIN_CODE_LEFT_EQ_COLS,
PHY_SORT_MERGE_JOIN_CODE_RIGHT_EQ_COLS,
PHY_SORT_MERGE_JOIN_CODE_FULL_ON_CONDITIONS,
PHY_SORT_MERGE_JOIN_CODE_TARGETS,
PHY_SORT_MERGE_JOIN_CODE_INPUT_TS_ORDER,
PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS
PHY_SORT_MERGE_JOIN_CODE_COL_ON_CONDITIONS,
PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM0,
PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE0,
PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM1,
PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE1,
PHY_SORT_MERGE_JOIN_CODE_SEQ_WIN_GROUP,
PHY_SORT_MERGE_JOIN_CODE_GROUP_JOIN
};
static int32_t physiMergeJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
@ -2480,17 +2529,63 @@ static int32_t physiMergeJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder)
code = tlvEncodeEnum(pEncoder, PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE, pNode->joinType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_PRIM_KEY_CONDITION, nodeToMsg, pNode->pPrimKeyCond);
code = tlvEncodeEnum(pEncoder, PHY_SORT_MERGE_JOIN_CODE_SUB_TYPE, pNode->subType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS, nodeToMsg, pNode->pOtherOnCond);
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_WINDOW_OFFSET, nodeToMsg, pNode->pWindowOffset);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_JOIN_LIMIT, nodeToMsg, pNode->pJLimit);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_SORT_MERGE_JOIN_CODE_ASOF_OP, pNode->asofOpType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_EXPR, nodeToMsg, pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_EXPR, nodeToMsg, pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_SLOT_ID, pNode->leftPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_SLOT_ID, pNode->rightPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_LEFT_EQ_COLS, nodeListToMsg, pNode->pEqLeft);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_RIGHT_EQ_COLS, nodeListToMsg, pNode->pEqRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_COL_ON_CONDITIONS, nodeToMsg, pNode->pColOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_FULL_ON_CONDITIONS, nodeToMsg, pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS, nodeToMsg, pNode->pColEqCond);
code = tlvEncodeI64(pEncoder, PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM0, pNode->inputStat[0].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI64(pEncoder, PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM1, pNode->inputStat[1].inputRowNum);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE0, pNode->inputStat[0].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE1, pNode->inputStat[1].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, PHY_SORT_MERGE_JOIN_CODE_SEQ_WIN_GROUP, pNode->seqWinGroup);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, PHY_SORT_MERGE_JOIN_CODE_GROUP_JOIN, pNode->grpJoin);
}
return code;
}
@ -2507,17 +2602,62 @@ static int32_t msgToPhysiMergeJoinNode(STlvDecoder* pDecoder, void* pObj) {
case PHY_SORT_MERGE_JOIN_CODE_JOIN_TYPE:
code = tlvDecodeEnum(pTlv, &pNode->joinType, sizeof(pNode->joinType));
break;
case PHY_SORT_MERGE_JOIN_CODE_PRIM_KEY_CONDITION:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pPrimKeyCond);
case PHY_SORT_MERGE_JOIN_CODE_SUB_TYPE:
code = tlvDecodeEnum(pTlv, &pNode->subType, sizeof(pNode->subType));
break;
case PHY_SORT_MERGE_JOIN_CODE_ON_CONDITIONS:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pOtherOnCond);
case PHY_SORT_MERGE_JOIN_CODE_WINDOW_OFFSET:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pWindowOffset);
break;
case PHY_SORT_MERGE_JOIN_CODE_JOIN_LIMIT:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pJLimit);
break;
case PHY_SORT_MERGE_JOIN_CODE_ASOF_OP:
code = tlvDecodeI32(pTlv, &pNode->asofOpType);
break;
case PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_EXPR:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->leftPrimExpr);
break;
case PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_EXPR:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->rightPrimExpr);
break;
case PHY_SORT_MERGE_JOIN_CODE_LEFT_PRIM_SLOT_ID:
code = tlvDecodeI32(pTlv, &pNode->leftPrimSlotId);
break;
case PHY_SORT_MERGE_JOIN_CODE_RIGHT_PRIM_SLOT_ID:
code = tlvDecodeI32(pTlv, &pNode->rightPrimSlotId);
break;
case PHY_SORT_MERGE_JOIN_CODE_LEFT_EQ_COLS:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pEqLeft);
break;
case PHY_SORT_MERGE_JOIN_CODE_RIGHT_EQ_COLS:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pEqRight);
break;
case PHY_SORT_MERGE_JOIN_CODE_COL_ON_CONDITIONS:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pColOnCond);
break;
case PHY_SORT_MERGE_JOIN_CODE_FULL_ON_CONDITIONS:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pFullOnCond);
break;
case PHY_SORT_MERGE_JOIN_CODE_TARGETS:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
break;
case PHY_SORT_MERGE_JOIN_CODE_TAG_EQUAL_CONDITIONS:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pColEqCond);
case PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM0:
code = tlvDecodeI64(pTlv, &pNode->inputStat[0].inputRowNum);
break;
case PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_NUM1:
code = tlvDecodeI64(pTlv, &pNode->inputStat[1].inputRowNum);
break;
case PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE0:
code = tlvDecodeI32(pTlv, &pNode->inputStat[0].inputRowSize);
break;
case PHY_SORT_MERGE_JOIN_CODE_INPUT_ROW_SIZE1:
code = tlvDecodeI32(pTlv, &pNode->inputStat[1].inputRowSize);
break;
case PHY_SORT_MERGE_JOIN_CODE_SEQ_WIN_GROUP:
code = tlvDecodeBool(pTlv, &pNode->seqWinGroup);
break;
case PHY_SORT_MERGE_JOIN_CODE_GROUP_JOIN:
code = tlvDecodeBool(pTlv, &pNode->grpJoin);
break;
default:
break;
@ -2530,14 +2670,25 @@ static int32_t msgToPhysiMergeJoinNode(STlvDecoder* pDecoder, void* pObj) {
enum {
PHY_HASH_JOIN_CODE_BASE_NODE = 1,
PHY_HASH_JOIN_CODE_JOIN_TYPE,
PHY_HASH_JOIN_CODE_JOIN_STYPE,
PHY_HASH_JOIN_CODE_ON_LEFT_COLUMN,
PHY_HASH_JOIN_CODE_ON_RIGHT_COLUMN,
PHY_HASH_JOIN_CODE_LEFT_PRIM_EXPR,
PHY_HASH_JOIN_CODE_RIGHT_PRIM_EXPR,
PHY_HASH_JOIN_CODE_LEFT_PRIM_SLOTID,
PHY_HASH_JOIN_CODE_RIGHT_PRIM_SLOTID,
PHY_HASH_JOIN_CODE_TIME_RANGE_TARGET,
PHY_HASH_JOIN_CODE_ON_CONDITIONS,
PHY_HASH_JOIN_CODE_TARGETS,
PHY_HASH_JOIN_CODE_INPUT_ROW_NUM0,
PHY_HASH_JOIN_CODE_INPUT_ROW_SIZE0,
PHY_HASH_JOIN_CODE_INPUT_ROW_NUM1,
PHY_HASH_JOIN_CODE_INPUT_ROW_SIZE1
PHY_HASH_JOIN_CODE_INPUT_ROW_SIZE1,
PHY_HASH_JOIN_CODE_LEFT_ON_COND,
PHY_HASH_JOIN_CODE_RIGHT_ON_COND,
PHY_HASH_JOIN_CODE_TIME_RANGE_SKEY,
PHY_HASH_JOIN_CODE_TIME_RANGE_EKEY,
};
static int32_t physiHashJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
@ -2547,6 +2698,9 @@ static int32_t physiHashJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeEnum(pEncoder, PHY_HASH_JOIN_CODE_JOIN_TYPE, pNode->joinType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeEnum(pEncoder, PHY_HASH_JOIN_CODE_JOIN_STYPE, pNode->subType);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_ON_LEFT_COLUMN, nodeListToMsg, pNode->pOnLeft);
}
@ -2554,7 +2708,22 @@ static int32_t physiHashJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_ON_RIGHT_COLUMN, nodeListToMsg, pNode->pOnRight);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_ON_CONDITIONS, nodeToMsg, pNode->pFilterConditions);
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_LEFT_PRIM_EXPR, nodeToMsg, pNode->leftPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_RIGHT_PRIM_EXPR, nodeToMsg, pNode->rightPrimExpr);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_HASH_JOIN_CODE_LEFT_PRIM_SLOTID, pNode->leftPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_HASH_JOIN_CODE_RIGHT_PRIM_SLOTID, pNode->rightPrimSlotId);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_HASH_JOIN_CODE_TIME_RANGE_TARGET, pNode->timeRangeTarget);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_ON_CONDITIONS, nodeToMsg, pNode->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_TARGETS, nodeListToMsg, pNode->pTargets);
@ -2571,6 +2740,19 @@ static int32_t physiHashJoinNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI32(pEncoder, PHY_HASH_JOIN_CODE_INPUT_ROW_SIZE1, pNode->inputStat[1].inputRowSize);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_LEFT_ON_COND, nodeToMsg, pNode->pLeftOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_HASH_JOIN_CODE_RIGHT_ON_COND, nodeToMsg, pNode->pRightOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI64(pEncoder, PHY_HASH_JOIN_CODE_TIME_RANGE_SKEY, pNode->timeRange.skey);
}
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeI64(pEncoder, PHY_HASH_JOIN_CODE_TIME_RANGE_EKEY, pNode->timeRange.ekey);
}
return code;
}
@ -2588,14 +2770,32 @@ static int32_t msgToPhysiHashJoinNode(STlvDecoder* pDecoder, void* pObj) {
case PHY_HASH_JOIN_CODE_JOIN_TYPE:
code = tlvDecodeEnum(pTlv, &pNode->joinType, sizeof(pNode->joinType));
break;
case PHY_HASH_JOIN_CODE_JOIN_STYPE:
code = tlvDecodeEnum(pTlv, &pNode->subType, sizeof(pNode->subType));
break;
case PHY_HASH_JOIN_CODE_ON_LEFT_COLUMN:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pOnLeft);
break;
case PHY_HASH_JOIN_CODE_ON_RIGHT_COLUMN:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pOnRight);
break;
case PHY_HASH_JOIN_CODE_LEFT_PRIM_EXPR:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->leftPrimExpr);
break;
case PHY_HASH_JOIN_CODE_RIGHT_PRIM_EXPR:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->rightPrimExpr);
break;
case PHY_HASH_JOIN_CODE_LEFT_PRIM_SLOTID:
code = tlvDecodeI32(pTlv, &pNode->leftPrimSlotId);
break;
case PHY_HASH_JOIN_CODE_RIGHT_PRIM_SLOTID:
code = tlvDecodeI32(pTlv, &pNode->rightPrimSlotId);
break;
case PHY_HASH_JOIN_CODE_TIME_RANGE_TARGET:
code = tlvDecodeI32(pTlv, &pNode->timeRangeTarget);
break;
case PHY_HASH_JOIN_CODE_ON_CONDITIONS:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pFilterConditions);
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pFullOnCond);
break;
case PHY_HASH_JOIN_CODE_TARGETS:
code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pTargets);
@ -2612,6 +2812,18 @@ static int32_t msgToPhysiHashJoinNode(STlvDecoder* pDecoder, void* pObj) {
case PHY_HASH_JOIN_CODE_INPUT_ROW_SIZE1:
code = tlvDecodeI32(pTlv, &pNode->inputStat[1].inputRowSize);
break;
case PHY_HASH_JOIN_CODE_LEFT_ON_COND:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pLeftOnCond);
break;
case PHY_HASH_JOIN_CODE_RIGHT_ON_COND:
code = msgToNodeFromTlv(pTlv, (void**)&pNode->pRightOnCond);
break;
case PHY_HASH_JOIN_CODE_TIME_RANGE_SKEY:
code = tlvDecodeI64(pTlv, &pNode->timeRange.skey);
break;
case PHY_HASH_JOIN_CODE_TIME_RANGE_EKEY:
code = tlvDecodeI64(pTlv, &pNode->timeRange.ekey);
break;
default:
break;
}
@ -4222,6 +4434,9 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
case QUERY_NODE_CASE_WHEN:
code = caseWhenNodeToMsg(pObj, pEncoder);
break;
case QUERY_NODE_WINDOW_OFFSET:
code = windowOffsetNodeToMsg(pObj, pEncoder);
break;
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
code = physiTagScanNodeToMsg(pObj, pEncoder);
break;
@ -4381,6 +4596,9 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
case QUERY_NODE_CASE_WHEN:
code = msgToCaseWhenNode(pDecoder, pObj);
break;
case QUERY_NODE_WINDOW_OFFSET:
code = msgToWindowOffsetNode(pDecoder, pObj);
break;
case QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN:
code = msgToPhysiTagScanNode(pDecoder, pObj);
break;

View File

@ -372,6 +372,14 @@ static EDealRes rewriteExpr(SNode** pRawNode, ETraversalOrder order, FNodeRewrit
}
break;
}
case QUERY_NODE_WINDOW_OFFSET: {
SWindowOffsetNode* pWin = (SWindowOffsetNode*)pNode;
res = rewriteExpr(&pWin->pStartOffset, order, rewriter, pContext);
if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
res = rewriteExpr(&pWin->pEndOffset, order, rewriter, pContext);
}
break;
}
case QUERY_NODE_COUNT_WINDOW: {
SCountWindowNode* pEvent = (SCountWindowNode*)pNode;
res = rewriteExpr(&pEvent->pCol, order, rewriter, pContext);
@ -415,7 +423,7 @@ void nodesRewriteExprsPostOrder(SNodeList* pList, FNodeRewriter rewriter, void*
(void)rewriteExprs(pList, TRAVERSAL_POSTORDER, rewriter, pContext);
}
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext) {
void nodesWalkSelectStmtImpl(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext) {
if (NULL == pSelect) {
return;
}
@ -451,6 +459,10 @@ void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker wa
return;
}
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext) {
nodesWalkSelectStmtImpl(pSelect, clause, walker, pContext);
}
void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewriter rewriter, void* pContext) {
if (NULL == pSelect) {
return;

View File

@ -44,6 +44,74 @@ struct SNodeAllocator {
static threadlocal SNodeAllocator* g_pNodeAllocator;
static int32_t g_allocatorReqRefPool = -1;
char* getJoinTypeString(EJoinType type) {
static char* joinType[] = {"", "INNER", "LEFT", "RIGHT", "FULL"};
return joinType[type];
}
char* getJoinSTypeString(EJoinSubType type) {
static char* joinSType[] = {"", "", "OUTER", "SEMI", "ANTI", "ANY", "ASOF", "WINDOW"};
return joinSType[type];
}
char* getFullJoinTypeString(EJoinType type, EJoinSubType stype) {
static char* joinFullType[][8] = {
{"INNER", "INNER", "INNER", "INNER", "INNER", "INNER ANY", "INNER", "INNER"},
{"LEFT", "LEFT", "LEFT OUTER", "LEFT SEMI", "LEFT ANTI", "LEFT ANY", "LEFT ASOF", "LEFT WINDOW"},
{"RIGHT", "RIGHT", "RIGHT OUTER", "RIGHT SEMI", "RIGHT ANTI", "RIGHT ANY", "RIGHT ASOF", "RIGHT WINDOW"},
{"FULL", "FULL", "FULL OUTER", "FULL", "FULL", "FULL ANY", "FULL", "FULL"}
};
return joinFullType[type][stype];
}
int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc) {
if (NULL == *ppSrc) {
return TSDB_CODE_SUCCESS;
}
if (NULL == *ppDst) {
*ppDst = *ppSrc;
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)(*ppSrc))->condType == LOGIC_COND_TYPE_AND) {
TSWAP(*ppDst, *ppSrc);
}
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst)) {
SLogicConditionNode* pDst = (SLogicConditionNode*)*ppDst;
if (pDst->condType == LOGIC_COND_TYPE_AND) {
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)(*ppSrc))->condType == LOGIC_COND_TYPE_AND) {
nodesListStrictAppendList(pDst->pParameterList, ((SLogicConditionNode*)(*ppSrc))->pParameterList);
((SLogicConditionNode*)(*ppSrc))->pParameterList = NULL;
} else {
nodesListStrictAppend(pDst->pParameterList, *ppSrc);
*ppSrc = NULL;
}
nodesDestroyNode(*ppSrc);
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
}
SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
if (NULL == pLogicCond) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL;
pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
pLogicCond->condType = LOGIC_COND_TYPE_AND;
pLogicCond->pParameterList = nodesMakeList();
nodesListStrictAppend(pLogicCond->pParameterList, *ppSrc);
nodesListStrictAppend(pLogicCond->pParameterList, *ppDst);
*ppDst = (SNode*)pLogicCond;
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
static SNodeMemChunk* callocNodeChunk(SNodeAllocator* pAllocator) {
SNodeMemChunk* pNewChunk = taosMemoryCalloc(1, sizeof(SNodeMemChunk) + pAllocator->chunkSize);
if (NULL == pNewChunk) {
@ -308,6 +376,8 @@ SNode* nodesMakeNode(ENodeType type) {
return makeNode(type, sizeof(SHintNode));
case QUERY_NODE_VIEW:
return makeNode(type, sizeof(SViewNode));
case QUERY_NODE_WINDOW_OFFSET:
return makeNode(type, sizeof(SWindowOffsetNode));
case QUERY_NODE_SET_OPERATOR:
return makeNode(type, sizeof(SSetOperator));
case QUERY_NODE_SELECT_STMT:
@ -746,6 +816,9 @@ void nodesDestroyNode(SNode* pNode) {
break;
case QUERY_NODE_JOIN_TABLE: {
SJoinTableNode* pJoin = (SJoinTableNode*)pNode;
nodesDestroyNode(pJoin->pWindowOffset);
nodesDestroyNode(pJoin->pJLimit);
nodesDestroyNode(pJoin->addPrimCond);
nodesDestroyNode(pJoin->pLeft);
nodesDestroyNode(pJoin->pRight);
nodesDestroyNode(pJoin->pOnCond);
@ -877,6 +950,12 @@ void nodesDestroyNode(SNode* pNode) {
taosArrayDestroyEx(pView->pSmaIndexes, destroySmaIndex);
break;
}
case QUERY_NODE_WINDOW_OFFSET: {
SWindowOffsetNode* pWin = (SWindowOffsetNode*)pNode;
nodesDestroyNode(pWin->pStartOffset);
nodesDestroyNode(pWin->pEndOffset);
break;
}
case QUERY_NODE_SET_OPERATOR: {
SSetOperator* pStmt = (SSetOperator*)pNode;
nodesDestroyList(pStmt->pProjectionList);
@ -1211,9 +1290,19 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_LOGIC_PLAN_JOIN: {
SJoinLogicNode* pLogicNode = (SJoinLogicNode*)pNode;
destroyLogicNode((SLogicNode*)pLogicNode);
nodesDestroyNode(pLogicNode->pWindowOffset);
nodesDestroyNode(pLogicNode->pJLimit);
nodesDestroyNode(pLogicNode->addPrimEqCond);
nodesDestroyNode(pLogicNode->pPrimKeyEqCond);
nodesDestroyNode(pLogicNode->pOtherOnCond);
nodesDestroyNode(pLogicNode->pColEqCond);
nodesDestroyNode(pLogicNode->pColOnCond);
nodesDestroyNode(pLogicNode->pTagEqCond);
nodesDestroyNode(pLogicNode->pTagOnCond);
nodesDestroyNode(pLogicNode->pFullOnCond);
nodesDestroyList(pLogicNode->pLeftEqNodes);
nodesDestroyList(pLogicNode->pRightEqNodes);
nodesDestroyNode(pLogicNode->pLeftOnCond);
nodesDestroyNode(pLogicNode->pRightOnCond);
break;
}
case QUERY_NODE_LOGIC_PLAN_AGG: {
@ -1357,10 +1446,17 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN: {
SSortMergeJoinPhysiNode* pPhyNode = (SSortMergeJoinPhysiNode*)pNode;
destroyPhysiNode((SPhysiNode*)pPhyNode);
nodesDestroyNode(pPhyNode->pWindowOffset);
nodesDestroyNode(pPhyNode->pJLimit);
nodesDestroyNode(pPhyNode->leftPrimExpr);
nodesDestroyNode(pPhyNode->rightPrimExpr);
nodesDestroyList(pPhyNode->pEqLeft);
nodesDestroyList(pPhyNode->pEqRight);
nodesDestroyNode(pPhyNode->pPrimKeyCond);
nodesDestroyNode(pPhyNode->pOtherOnCond);
nodesDestroyNode(pPhyNode->pFullOnCond);
nodesDestroyList(pPhyNode->pTargets);
nodesDestroyNode(pPhyNode->pColEqCond);
nodesDestroyNode(pPhyNode->pColOnCond);
break;
}
case QUERY_NODE_PHYSICAL_PLAN_HASH_JOIN: {
@ -1368,12 +1464,17 @@ void nodesDestroyNode(SNode* pNode) {
destroyPhysiNode((SPhysiNode*)pPhyNode);
nodesDestroyList(pPhyNode->pOnLeft);
nodesDestroyList(pPhyNode->pOnRight);
nodesDestroyNode(pPhyNode->pFilterConditions);
nodesDestroyNode(pPhyNode->leftPrimExpr);
nodesDestroyNode(pPhyNode->rightPrimExpr);
nodesDestroyNode(pPhyNode->pFullOnCond);
nodesDestroyList(pPhyNode->pTargets);
nodesDestroyNode(pPhyNode->pPrimKeyCond);
nodesDestroyNode(pPhyNode->pColEqCond);
nodesDestroyNode(pPhyNode->pTagEqCond);
nodesDestroyNode(pPhyNode->pLeftOnCond);
nodesDestroyNode(pPhyNode->pRightOnCond);
break;
}
case QUERY_NODE_PHYSICAL_PLAN_HASH_AGG: {
@ -2025,6 +2126,7 @@ bool nodesIsBitwiseOp(const SOperatorNode* pOp) {
typedef struct SCollectColumnsCxt {
int32_t errCode;
const char* pTableAlias;
SSHashObj* pMultiTableAlias;
ECollectColType collectType;
SNodeList* pCols;
SHashObj* pColHash;
@ -2066,6 +2168,19 @@ static EDealRes collectColumns(SNode* pNode, void* pContext) {
return DEAL_RES_CONTINUE;
}
static EDealRes collectColumnsExt(SNode* pNode, void* pContext) {
SCollectColumnsCxt* pCxt = (SCollectColumnsCxt*)pContext;
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
SColumnNode* pCol = (SColumnNode*)pNode;
if (isCollectType(pCxt->collectType, pCol->colType) && 0 != strcmp(pCol->colName, "*") &&
(NULL == pCxt->pMultiTableAlias || NULL != (pCxt->pTableAlias = tSimpleHashGet(pCxt->pMultiTableAlias, pCol->tableAlias, strlen(pCol->tableAlias))))) {
return doCollect(pCxt, pCol, pNode);
}
}
return DEAL_RES_CONTINUE;
}
int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char* pTableAlias, ECollectColType type,
SNodeList** pCols) {
if (NULL == pSelect || NULL == pCols) {
@ -2097,6 +2212,38 @@ int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, const char*
return TSDB_CODE_SUCCESS;
}
int32_t nodesCollectColumnsExt(SSelectStmt* pSelect, ESqlClause clause, SSHashObj* pMultiTableAlias, ECollectColType type,
SNodeList** pCols) {
if (NULL == pSelect || NULL == pCols) {
return TSDB_CODE_FAILED;
}
SCollectColumnsCxt cxt = {
.errCode = TSDB_CODE_SUCCESS,
.pTableAlias = NULL,
.pMultiTableAlias = pMultiTableAlias,
.collectType = type,
.pCols = (NULL == *pCols ? nodesMakeList() : *pCols),
.pColHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK)};
if (NULL == cxt.pCols || NULL == cxt.pColHash) {
return TSDB_CODE_OUT_OF_MEMORY;
}
*pCols = NULL;
nodesWalkSelectStmtImpl(pSelect, clause, collectColumnsExt, &cxt);
taosHashCleanup(cxt.pColHash);
if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyList(cxt.pCols);
return cxt.errCode;
}
if (LIST_LENGTH(cxt.pCols) > 0) {
*pCols = cxt.pCols;
} else {
nodesDestroyList(cxt.pCols);
}
return TSDB_CODE_SUCCESS;
}
int32_t nodesCollectColumnsFromNode(SNode* node, const char* pTableAlias, ECollectColType type, SNodeList** pCols) {
if (NULL == pCols) {
return TSDB_CODE_FAILED;
@ -2437,7 +2584,6 @@ SValueNode* nodesMakeValueNodeFromString(char* literal) {
pValNode->datum.p = p;
pValNode->literal = tstrdup(literal);
pValNode->translate = true;
pValNode->isDuration = false;
pValNode->isNull = false;
}
return pValNode;
@ -2450,7 +2596,6 @@ SValueNode* nodesMakeValueNodeFromBool(bool b) {
pValNode->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
nodesSetValueNodeValue(pValNode, &b);
pValNode->translate = true;
pValNode->isDuration = false;
pValNode->isNull = false;
}
return pValNode;

View File

@ -114,37 +114,39 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
SNode* createRawValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pNode);
SNode* createRawValueNodeExt(SAstCreateContext* pCxt, int32_t dataType, const SToken* pLiteral, SNode *pLeft, SNode *pRight);
SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft, SNode* pRight, SNode* pJoinCond);
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill);
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
SNode* createIdentifierValueNode(SAstCreateContext* pCxt, SToken* pLiteral);
SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt);
SNode* createPlaceholderValueNode(SAstCreateContext* pCxt, const SToken* pLiteral);
SNode* setProjectionAlias(SAstCreateContext* pCxt, SNode* pNode, SToken* pAlias);
SNode* createLogicConditionNode(SAstCreateContext* pCxt, ELogicConditionType type, SNode* pParam1, SNode* pParam2);
SNode* createOperatorNode(SAstCreateContext* pCxt, EOperatorType type, SNode* pLeft, SNode* pRight);
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight);
SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList);
SNode* createCastFunctionNode(SAstCreateContext* pCxt, SNode* pExpr, SDataType dt);
SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList);
SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2);
SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias);
SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias);
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, SNode* pJoinCond);
SNode* createViewNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pViewName);
SNode* createLimitNode(SAstCreateContext* pCxt, const SToken* pLimit, const SToken* pOffset);
SNode* createOrderByExprNode(SAstCreateContext* pCxt, SNode* pExpr, EOrder order, ENullOrder nullOrder);
SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode* pGap);
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill);
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset);
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues);
SNode* createGroupingSetNode(SAstCreateContext* pCxt, SNode* pNode);
SNode* createInterpTimeRange(SAstCreateContext* pCxt, SNode* pStart, SNode* pEnd);
SNode* createInterpTimePoint(SAstCreateContext* pCxt, SNode* pPoint);
SNode* createWhenThenNode(SAstCreateContext* pCxt, SNode* pWhen, SNode* pThen);
SNode* createCaseWhenNode(SAstCreateContext* pCxt, SNode* pCase, SNodeList* pWhenThenList, SNode* pElse);
SNode* addWhereClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pWhere);
SNode* addPartitionByClause(SAstCreateContext* pCxt, SNode* pStmt, SNodeList* pPartitionByList);
@ -157,8 +159,9 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit);
SNode* addRangeClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pRange);
SNode* addEveryClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pEvery);
SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill);
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable,
SNodeList* pHint);
SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit);
SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset);
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable, SNodeList* pHint);
SNode* setSelectStmtTagMode(SAstCreateContext* pCxt, SNode* pStmt, bool bSelectTags);
SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight);

View File

@ -38,7 +38,7 @@ int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery);
int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock);
int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock);
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray** pPlaceholderValues);
int32_t translateTable(STranslateContext* pCxt, SNode** pTable);
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent);
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
void tfreeSParseQueryRes(void* p);

View File

@ -117,6 +117,7 @@ typedef struct SParseMetaCache {
int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...);
int32_t generateSyntaxErrMsgExt(SMsgBuf* pBuf, int32_t errCode, const char* pFormat, ...);
int32_t buildInvalidOperationMsg(SMsgBuf* pMsgBuf, const char* msg);
int32_t buildInvalidOperationMsgExt(SMsgBuf* pBuf, const char* pFormat, ...);
int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char* sourceStr);
SSchema* getTableColumnSchema(const STableMeta* pTableMeta);

View File

@ -1278,7 +1278,7 @@ from_clause_opt(A) ::= .
from_clause_opt(A) ::= FROM table_reference_list(B). { A = B; }
table_reference_list(A) ::= table_reference(B). { A = B; }
table_reference_list(A) ::= table_reference_list(B) NK_COMMA table_reference(C). { A = createJoinTableNode(pCxt, JOIN_TYPE_INNER, B, C, NULL); }
table_reference_list(A) ::= table_reference_list(B) NK_COMMA table_reference(C). { A = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, B, C, NULL); }
/************************************************ table_reference *****************************************************/
table_reference(A) ::= table_primary(B). { A = B; }
@ -1300,12 +1300,46 @@ parenthesized_joined_table(A) ::= NK_LP parenthesized_joined_table(B) NK_RP.
/************************************************ joined_table ********************************************************/
joined_table(A) ::=
table_reference(B) join_type(C) JOIN table_reference(D) ON search_condition(E). { A = createJoinTableNode(pCxt, C, B, D, E); }
table_reference(B) join_type(C) join_subtype(D) JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause_opt(G) jlimit_clause_opt(H). {
A = createJoinTableNode(pCxt, C, D, B, E, F);
A = addWindowOffsetClause(pCxt, A, G);
A = addJLimitClause(pCxt, A, H);
}
%type join_type { EJoinType }
%destructor join_type { }
join_type(A) ::= . { A = JOIN_TYPE_INNER; }
join_type(A) ::= INNER. { A = JOIN_TYPE_INNER; }
join_type(A) ::= LEFT. { A = JOIN_TYPE_LEFT; }
join_type(A) ::= RIGHT. { A = JOIN_TYPE_RIGHT; }
join_type(A) ::= FULL. { A = JOIN_TYPE_FULL; }
%type join_subtype { EJoinSubType }
%destructor join_subtype { }
join_subtype(A) ::= . { A = JOIN_STYPE_NONE; }
join_subtype(A) ::= OUTER. { A = JOIN_STYPE_OUTER; }
join_subtype(A) ::= SEMI. { A = JOIN_STYPE_SEMI; }
join_subtype(A) ::= ANTI. { A = JOIN_STYPE_ANTI; }
join_subtype(A) ::= ASOF. { A = JOIN_STYPE_ASOF; }
join_subtype(A) ::= WINDOW. { A = JOIN_STYPE_WIN; }
join_on_clause_opt(A) ::= . { A = NULL; }
join_on_clause_opt(A) ::= ON search_condition(B). { A = B; }
window_offset_clause_opt(A) ::= . { A = NULL; }
window_offset_clause_opt(A) ::= WINDOW_OFFSET NK_LP window_offset_literal(B)
NK_COMMA window_offset_literal(C) NK_RP. { A = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)); }
window_offset_literal(A) ::= NK_VARIABLE(B). { A = createRawExprNode(pCxt, &B, createTimeOffsetValueNode(pCxt, &B)); }
window_offset_literal(A) ::= NK_MINUS(B) NK_VARIABLE(C). {
SToken t = B;
t.n = (C.z + C.n) - B.z;
A = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
}
jlimit_clause_opt(A) ::= . { A = NULL; }
jlimit_clause_opt(A) ::= JLIMIT NK_INTEGER(B). { A = createLimitNode(pCxt, &B, NULL); }
/************************************************ query_specification *************************************************/
query_specification(A) ::=

View File

@ -365,7 +365,6 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
if (TSDB_DATA_TYPE_TIMESTAMP == dataType) {
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
}
val->isDuration = false;
val->translate = false;
return (SNode*)val;
}
@ -480,6 +479,9 @@ bool addHintNodeToList(SAstCreateContext* pCxt, SNodeList** ppHintList, EHintOpt
case HINT_SMALLDATA_TS_SORT:
if (paramNum > 0 || hasHint(*ppHintList, HINT_SMALLDATA_TS_SORT)) return true;
break;
case HINT_HASH_JOIN:
if (paramNum > 0 || hasHint(*ppHintList, HINT_HASH_JOIN)) return true;
break;
default:
return true;
}
@ -574,6 +576,14 @@ SNodeList* createHintNodeList(SAstCreateContext* pCxt, const SToken* pLiteral) {
}
opt = HINT_SMALLDATA_TS_SORT;
break;
case TK_HASH_JOIN:
lastComma = false;
if (0 != opt || inParamList) {
quit = true;
break;
}
opt = HINT_HASH_JOIN;
break;
case TK_NK_LP:
lastComma = false;
if (0 == opt || inParamList) {
@ -663,7 +673,7 @@ SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral)
val->literal = strndup(pLiteral->z, pLiteral->n);
}
CHECK_OUT_OF_MEM(val->literal);
val->isDuration = true;
val->flag |= VALUE_FLAG_IS_DURATION;
val->translate = false;
val->node.resType.type = TSDB_DATA_TYPE_BIGINT;
val->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
@ -671,6 +681,52 @@ SNode* createDurationValueNode(SAstCreateContext* pCxt, const SToken* pLiteral)
return (SNode*)val;
}
SNode* createTimeOffsetValueNode(SAstCreateContext* pCxt, const SToken* pLiteral) {
CHECK_PARSER_STATUS(pCxt);
SValueNode* val = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE);
CHECK_OUT_OF_MEM(val);
if (pLiteral->type == TK_NK_STRING) {
// like '100s' or "100d"
// check format: ^[0-9]+[smwbauhdny]$'
if (pLiteral->n < 4) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, pLiteral->z);
return NULL;
}
char unit = pLiteral->z[pLiteral->n - 2];
switch (unit) {
case 'a':
case 'b':
case 'd':
case 'h':
case 'm':
case 's':
case 'u':
case 'w':
break;
default:
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, pLiteral->z);
return NULL;
}
for (uint32_t i = 1; i < pLiteral->n - 2; ++i) {
if (!isdigit(pLiteral->z[i])) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, pLiteral->z);
return NULL;
}
}
val->literal = strndup(pLiteral->z + 1, pLiteral->n - 2);
} else {
val->literal = strndup(pLiteral->z, pLiteral->n);
}
CHECK_OUT_OF_MEM(val->literal);
val->flag |= VALUE_FLAG_IS_TIME_OFFSET;
val->translate = false;
val->node.resType.type = TSDB_DATA_TYPE_BIGINT;
val->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
val->node.resType.precision = TSDB_TIME_PRECISION_MILLI;
return (SNode*)val;
}
SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) {
CHECK_PARSER_STATUS(pCxt);
if (NULL == pCxt->pQueryCxt->db) {
@ -681,7 +737,6 @@ SNode* createDefaultDatabaseCondValue(SAstCreateContext* pCxt) {
CHECK_OUT_OF_MEM(val);
val->literal = taosStrdup(pCxt->pQueryCxt->db);
CHECK_OUT_OF_MEM(val->literal);
val->isDuration = false;
val->translate = false;
val->node.resType.type = TSDB_DATA_TYPE_BINARY;
val->node.resType.bytes = strlen(val->literal);
@ -801,6 +856,7 @@ static SNode* createPrimaryKeyCol(SAstCreateContext* pCxt, const SToken* pFuncNa
} else {
strncpy(pCol->colName, pFuncName->z, pFuncName->n);
}
pCol->isPrimTs = true;
return (SNode*)pCol;
}
@ -890,11 +946,12 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok
return (SNode*)tempTable;
}
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft, SNode* pRight, SNode* pJoinCond) {
SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, EJoinSubType stype, SNode* pLeft, SNode* pRight, SNode* pJoinCond) {
CHECK_PARSER_STATUS(pCxt);
SJoinTableNode* joinTable = (SJoinTableNode*)nodesMakeNode(QUERY_NODE_JOIN_TABLE);
CHECK_OUT_OF_MEM(joinTable);
joinTable->joinType = type;
joinTable->subType = stype;
joinTable->pLeft = pLeft;
joinTable->pRight = pRight;
joinTable->pOnCond = pJoinCond;
@ -1008,6 +1065,15 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
return (SNode*)interval;
}
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset) {
CHECK_PARSER_STATUS(pCxt);
SWindowOffsetNode* winOffset = (SWindowOffsetNode*)nodesMakeNode(QUERY_NODE_WINDOW_OFFSET);
CHECK_OUT_OF_MEM(winOffset);
winOffset->pStartOffset = pStartOffset;
winOffset->pEndOffset = pEndOffset;
return (SNode*)winOffset;
}
SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) {
CHECK_PARSER_STATUS(pCxt);
SFillNode* fill = (SFillNode*)nodesMakeNode(QUERY_NODE_FILL);
@ -1179,6 +1245,31 @@ SNode* addFillClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pFill) {
return pStmt;
}
SNode* addJLimitClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pJLimit) {
CHECK_PARSER_STATUS(pCxt);
if (NULL == pJLimit) {
return pJoin;
}
SJoinTableNode* pJoinNode = (SJoinTableNode*)pJoin;
pJoinNode->pJLimit = pJLimit;
return pJoin;
}
SNode* addWindowOffsetClause(SAstCreateContext* pCxt, SNode* pJoin, SNode* pWinOffset) {
CHECK_PARSER_STATUS(pCxt);
if (NULL == pWinOffset) {
return pJoin;
}
SJoinTableNode* pJoinNode = (SJoinTableNode*)pJoin;
pJoinNode->pWindowOffset = pWinOffset;
return pJoin;
}
SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable,
SNodeList* pHint) {
CHECK_PARSER_STATUS(pCxt);

View File

@ -37,9 +37,12 @@ static SKeyword keywordTable[] = {
{"ALTER", TK_ALTER},
{"ANALYZE", TK_ANALYZE},
{"AND", TK_AND},
{"ANTI", TK_ANTI},
// {"ANY", TK_ANY},
{"APPS", TK_APPS},
{"AS", TK_AS},
{"ASC", TK_ASC},
{"ASOF", TK_ASOF},
{"AT_ONCE", TK_AT_ONCE},
{"BALANCE", TK_BALANCE},
{"BATCH_SCAN", TK_BATCH_SCAN},
@ -105,6 +108,7 @@ static SKeyword keywordTable[] = {
{"FLUSH", TK_FLUSH},
{"FROM", TK_FROM},
{"FORCE", TK_FORCE},
{"FULL", TK_FULL},
{"FUNCTION", TK_FUNCTION},
{"FUNCTIONS", TK_FUNCTIONS},
{"GEOMETRY", TK_GEOMETRY},
@ -114,6 +118,7 @@ static SKeyword keywordTable[] = {
{"LOGS", TK_LOGS},
{"MACHINES", TK_MACHINES},
{"GROUP", TK_GROUP},
{"HASH_JOIN", TK_HASH_JOIN},
{"HAVING", TK_HAVING},
{"HOST", TK_HOST},
{"IF", TK_IF},
@ -129,6 +134,7 @@ static SKeyword keywordTable[] = {
{"INTERVAL", TK_INTERVAL},
{"INTO", TK_INTO},
{"IS", TK_IS},
{"JLIMIT", TK_JLIMIT},
{"JOIN", TK_JOIN},
{"JSON", TK_JSON},
{"KEEP", TK_KEEP},
@ -138,6 +144,7 @@ static SKeyword keywordTable[] = {
{"LAST", TK_LAST},
{"LAST_ROW", TK_LAST_ROW},
{"LEADER", TK_LEADER},
{"LEFT", TK_LEFT},
{"LICENCES", TK_LICENCES},
{"LIKE", TK_LIKE},
{"LIMIT", TK_LIMIT},
@ -171,6 +178,7 @@ static SKeyword keywordTable[] = {
{"ON", TK_ON},
{"OR", TK_OR},
{"ORDER", TK_ORDER},
{"OUTER", TK_OUTER},
{"OUTPUTTYPE", TK_OUTPUTTYPE},
{"PAGES", TK_PAGES},
{"PAGESIZE", TK_PAGESIZE},
@ -202,10 +210,12 @@ static SKeyword keywordTable[] = {
{"RESTORE", TK_RESTORE},
{"RETENTIONS", TK_RETENTIONS},
{"REVOKE", TK_REVOKE},
{"RIGHT", TK_RIGHT},
{"ROLLUP", TK_ROLLUP},
{"SCHEMALESS", TK_SCHEMALESS},
{"SCORES", TK_SCORES},
{"SELECT", TK_SELECT},
{"SEMI", TK_SEMI},
{"SERVER_STATUS", TK_SERVER_STATUS},
{"SERVER_VERSION", TK_SERVER_VERSION},
{"SESSION", TK_SESSION},
@ -289,7 +299,9 @@ static SKeyword keywordTable[] = {
{"WATERMARK", TK_WATERMARK},
{"WHEN", TK_WHEN},
{"WHERE", TK_WHERE},
{"WINDOW", TK_WINDOW},
{"WINDOW_CLOSE", TK_WINDOW_CLOSE},
{"WINDOW_OFFSET", TK_WINDOW_OFFSET},
{"WITH", TK_WITH},
{"WRITE", TK_WRITE},
{"_C0", TK_ROWTS},

File diff suppressed because it is too large Load Diff

View File

@ -153,7 +153,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "Some functions are allowed only in the SELECT list of a query. "
"And, cannot be mixed with other non scalar functions or columns.";
case TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY:
return "Window query not supported, since the result of subquery not include valid timestamp column";
return "Window query not supported, since not valid primary timestamp column as input";
case TSDB_CODE_PAR_INVALID_DROP_COL:
return "No columns can be dropped";
case TSDB_CODE_PAR_INVALID_COL_JSON:
@ -194,6 +194,14 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "ORDER BY \"%s\" is ambiguous";
case TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT:
return "Operator not supported multi result: %s";
case TSDB_CODE_PAR_INVALID_WJOIN_HAVING_EXPR:
return "Not supported window join having expr";
case TSDB_CODE_PAR_INVALID_WIN_OFFSET_UNIT:
return "Invalid WINDOW_OFFSET unit \"%c\"";
case TSDB_CODE_PAR_VALID_PRIM_TS_REQUIRED:
return "Valid primary timestamp required";
case TSDB_CODE_PAR_NOT_WIN_FUNC:
return "Column exists for window join with aggregation functions";
case TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY:
return "tag %s can not be primary key";
case TSDB_CODE_PAR_SECOND_COL_PK:
@ -228,6 +236,15 @@ int32_t buildInvalidOperationMsg(SMsgBuf* pBuf, const char* msg) {
return TSDB_CODE_TSC_INVALID_OPERATION;
}
int32_t buildInvalidOperationMsgExt(SMsgBuf* pBuf, const char* pFormat, ...) {
va_list vArgList;
va_start(vArgList, pFormat);
vsnprintf(pBuf->buf, pBuf->len, pFormat, vArgList);
va_end(vArgList);
return TSDB_CODE_TSC_INVALID_OPERATION;
}
int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char* sourceStr) {
if (pBuf == NULL) return TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
const char* msgFormat1 = "syntax error near \'%s\'";
@ -726,6 +743,7 @@ SNode* createSelectStmtImpl(bool isDistinct, SNodeList* pProjectionList, SNode*
select->pFromTable = pTable;
sprintf(select->stmtName, "%p", select);
select->timeLineResMode = select->isDistinct ? TIME_LINE_NONE : TIME_LINE_GLOBAL;
select->timeLineCurMode = TIME_LINE_GLOBAL;
select->onlyHasKeepOrderFunc = true;
select->timeRange = TSWINDOW_INITIALIZER;
select->pHint = pHint;
@ -1161,7 +1179,7 @@ int32_t getTableCfgFromCache(SParseMetaCache* pMetaCache, const SName* pName, ST
tNameExtractFullName(pName, fullName);
STableCfg* pCfg = NULL;
int32_t code = getMetaDataFromHash(fullName, strlen(fullName), pMetaCache->pTableCfg, (void**)&pCfg);
if (TSDB_CODE_SUCCESS == code) {
if (TSDB_CODE_SUCCESS == code && NULL != pCfg) {
*pOutput = tableCfgDup(pCfg);
if (NULL == *pOutput) {
code = TSDB_CODE_OUT_OF_MEMORY;

File diff suppressed because it is too large Load Diff

View File

@ -464,7 +464,7 @@ TEST_F(ParserSelectTest, setOperator) {
TEST_F(ParserSelectTest, setOperatorSemanticCheck) {
useDb("root", "test");
run("SELECT c1, c2 FROM t1 UNION ALL SELECT c1, c2 FROM t1 ORDER BY ts", TSDB_CODE_PAR_INVALID_COLUMN);
run("SELECT c1, c2 FROM t1 UNION ALL SELECT c1, c2 FROM t1 ORDER BY ts", TSDB_CODE_PAR_ORDERBY_UNKNOWN_EXPR);
}
TEST_F(ParserSelectTest, informationSchema) {

View File

@ -49,6 +49,7 @@ bool getBatchScanOptionFromHint(SNodeList* pList);
bool getSortForGroupOptHint(SNodeList* pList);
bool getParaTablesSortOptHint(SNodeList* pList);
bool getSmallDataTsSortOptHint(SNodeList* pList);
bool getHashJoinOptHint(SNodeList* pList);
bool getOptHint(SNodeList* pList, EHintOption hint);
SLogicNode* getLogicNodeRootNode(SLogicNode* pCurr);
int32_t collectTableAliasFromNodes(SNode* pNode, SSHashObj** ppRes);
@ -57,11 +58,16 @@ bool isPartTagAgg(SAggLogicNode* pAgg);
bool isPartTableWinodw(SWindowLogicNode* pWindow);
bool keysHasCol(SNodeList* pKeys);
bool keysHasTbname(SNodeList* pKeys);
SFunctionNode* createGroupKeyAggFunc(SColumnNode* pGroupCol);
int32_t getTimeRangeFromNode(SNode** pPrimaryKeyCond, STimeWindow* pTimeRange, bool* pIsStrict);
#define CLONE_LIMIT 1
#define CLONE_SLIMIT 1 << 1
#define CLONE_LIMIT_SLIMIT (CLONE_LIMIT | CLONE_SLIMIT)
bool cloneLimit(SLogicNode* pParent, SLogicNode* pChild, uint8_t cloneWhat);
int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, SSortLogicNode* pSort,
bool* pNotOptimize, SNodeList** pSequencingNodes, bool* keepSort);
#ifdef __cplusplus
}

View File

@ -17,10 +17,12 @@
#include "filter.h"
#include "functionMgt.h"
#include "tglobal.h"
#include "parser.h"
typedef struct SLogicPlanContext {
SPlanContext* pPlanCxt;
SLogicNode* pCurrRoot;
SSHashObj* pChildTables;
bool hasScan;
} SLogicPlanContext;
@ -52,16 +54,18 @@ static void setColumnInfo(SFunctionNode* pFunc, SColumnNode* pCol, bool isPartit
}
break;
case FUNCTION_TYPE_WSTART:
if (!isPartitionBy) {
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
}
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
pCol->colType = COLUMN_TYPE_WINDOW_START;
if (!isPartitionBy) {
pCol->isPrimTs = true;
}
break;
case FUNCTION_TYPE_WEND:
if (!isPartitionBy) {
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
}
pCol->colId = PRIMARYKEY_TIMESTAMP_COL_ID;
pCol->colType = COLUMN_TYPE_WINDOW_END;
if (!isPartitionBy) {
pCol->isPrimTs = true;
}
break;
case FUNCTION_TYPE_WDURATION:
pCol->colType = COLUMN_TYPE_WINDOW_DURATION;
@ -277,29 +281,30 @@ static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols
return SCAN_TYPE_TABLE;
}
static bool hasPkInTable(const STableMeta* pTableMeta) {
return pTableMeta->tableInfo.numOfColumns>=2 && pTableMeta->schema[1].flags & COL_IS_KEY;
}
static SNode* createFirstCol(uint64_t tableId, const SSchema* pSchema, const STableMeta* pMeta) {
static SNode* createFirstCol(SRealTableNode* pTable, const SSchema* pSchema) {
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) {
return NULL;
}
pCol->node.resType.type = pSchema->type;
pCol->node.resType.bytes = pSchema->bytes;
pCol->tableId = tableId;
pCol->tableId = pTable->pMeta->uid;
pCol->colId = pSchema->colId;
pCol->colType = COLUMN_TYPE_COLUMN;
strcpy(pCol->tableAlias, pTable->table.tableAlias);
strcpy(pCol->tableName, pTable->table.tableName);
pCol->isPk = pSchema->flags & COL_IS_KEY;
pCol->tableHasPk = hasPkInTable(pMeta);
pCol->numOfPKs = pMeta->tableInfo.numOfPKs;
pCol->tableHasPk = hasPkInTable(pTable->pMeta);
pCol->numOfPKs = pTable->pMeta->tableInfo.numOfPKs;
strcpy(pCol->colName, pSchema->name);
return (SNode*)pCol;
}
static int32_t addPrimaryKeyCol(uint64_t tableId, const SSchema* pSchema, SNodeList** pCols, const STableMeta* pMeta) {
static int32_t addPrimaryKeyCol(SRealTableNode* pTable, SNodeList** pCols) {
bool found = false;
SNode* pCol = NULL;
FOREACH(pCol, *pCols) {
@ -310,14 +315,22 @@ static int32_t addPrimaryKeyCol(uint64_t tableId, const SSchema* pSchema, SNodeL
}
if (!found) {
return nodesListMakeStrictAppend(pCols, createFirstCol(tableId, pSchema, pMeta));
return nodesListMakeStrictAppend(pCols, createFirstCol(pTable, pTable->pMeta->schema));
}
return TSDB_CODE_SUCCESS;
}
static int32_t addPkCol(uint64_t tableId, const SSchema* pSchema, SNodeList** pCols, const STableMeta* pMeta) {
static int32_t addSystableFirstCol(SRealTableNode* pTable, SNodeList** pCols) {
if (LIST_LENGTH(*pCols) > 0) {
return TSDB_CODE_SUCCESS;
}
return nodesListMakeStrictAppend(pCols, createFirstCol(pTable, pTable->pMeta->schema));
}
static int32_t addPkCol(SRealTableNode* pTable, SNodeList** pCols) {
bool found = false;
SNode* pCol = NULL;
SSchema* pSchema = &pTable->pMeta->schema[1];
FOREACH(pCol, *pCols) {
if (pSchema->colId == ((SColumnNode*)pCol)->colId) {
found = true;
@ -326,25 +339,18 @@ static int32_t addPkCol(uint64_t tableId, const SSchema* pSchema, SNodeList** pC
}
if (!found) {
return nodesListMakeStrictAppend(pCols, createFirstCol(tableId, pSchema, pMeta));
return nodesListMakeStrictAppend(pCols, createFirstCol(pTable, pSchema));
}
return TSDB_CODE_SUCCESS;
}
static int32_t addSystableFirstCol(uint64_t tableId, const SSchema* pSchema, SNodeList** pCols, const STableMeta* pMeta) {
if (LIST_LENGTH(*pCols) > 0) {
return TSDB_CODE_SUCCESS;
static int32_t addDefaultScanCol(SRealTableNode* pTable, SNodeList** pCols) {
if (TSDB_SYSTEM_TABLE == pTable->pMeta->tableType) {
return addSystableFirstCol(pTable, pCols);
}
return nodesListMakeStrictAppend(pCols, createFirstCol(tableId, pSchema, pMeta));
}
static int32_t addDefaultScanCol(const STableMeta* pMeta, SNodeList** pCols) {
if (TSDB_SYSTEM_TABLE == pMeta->tableType) {
return addSystableFirstCol(pMeta->uid, pMeta->schema, pCols, pMeta);
}
int32_t code = addPrimaryKeyCol(pMeta->uid, pMeta->schema, pCols, pMeta);
if (code == TSDB_CODE_SUCCESS && hasPkInTable(pMeta)) {
code = addPkCol(pMeta->uid, pMeta->schema + 1, pCols, pMeta);
int32_t code = addPrimaryKeyCol(pTable, pCols);
if (code == TSDB_CODE_SUCCESS && hasPkInTable(pTable->pMeta)) {
code = addPkCol(pTable, pCols);
}
return code;
}
@ -486,7 +492,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
}
if (TSDB_CODE_SUCCESS == code && needScanDefaultCol(pScan->scanType)) {
code = addDefaultScanCol(pRealTable->pMeta, &pScan->pScanCols);
code = addDefaultScanCol(pRealTable, &pScan->pScanCols);
}
if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pTags && NULL == pSelect->pPartitionByList) {
@ -545,27 +551,43 @@ static int32_t createSubqueryLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSe
return createQueryLogicNode(pCxt, pTable->pSubquery, pLogicNode);
}
int32_t collectJoinResColumns(SSelectStmt* pSelect, SJoinLogicNode* pJoin, SNodeList** pCols) {
SSHashObj* pTables = NULL;
collectTableAliasFromNodes(nodesListGetNode(pJoin->node.pChildren, 0), &pTables);
collectTableAliasFromNodes(nodesListGetNode(pJoin->node.pChildren, 1), &pTables);
int32_t code = nodesCollectColumnsExt(pSelect, SQL_CLAUSE_WHERE, pTables, COLLECT_COL_TYPE_ALL, pCols);
tSimpleHashCleanup(pTables);
return code;
}
static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SJoinTableNode* pJoinTable,
SLogicNode** pLogicNode) {
int32_t code = TSDB_CODE_SUCCESS;
SJoinLogicNode* pJoin = (SJoinLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_JOIN);
if (NULL == pJoin) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pJoin->joinType = pJoinTable->joinType;
pJoin->subType = pJoinTable->subType;
pJoin->joinAlgo = JOIN_ALGO_UNKNOWN;
pJoin->isSingleTableJoin = pJoinTable->table.singleTable;
pJoin->hasSubQuery = pJoinTable->hasSubQuery;
pJoin->node.inputTsOrder = ORDER_ASC;
pJoin->node.groupAction = GROUP_ACTION_CLEAR;
pJoin->node.requireDataOrder = DATA_ORDER_LEVEL_GLOBAL;
pJoin->hashJoinHint = getHashJoinOptHint(pSelect->pHint);
pJoin->node.requireDataOrder = pJoin->hashJoinHint ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL;
pJoin->node.resultDataOrder = DATA_ORDER_LEVEL_NONE;
pJoin->isLowLevelJoin = pJoinTable->isLowLevelJoin;
int32_t code = TSDB_CODE_SUCCESS;
// set left and right node
pJoin->pWindowOffset = nodesCloneNode(pJoinTable->pWindowOffset);
pJoin->pJLimit = nodesCloneNode(pJoinTable->pJLimit);
pJoin->addPrimEqCond = nodesCloneNode(pJoinTable->addPrimCond);
pJoin->node.pChildren = nodesMakeList();
pJoin->seqWinGroup = (JOIN_STYPE_WIN == pJoinTable->subType) && (pSelect->hasAggFuncs || pSelect->hasIndefiniteRowsFunc);
if (NULL == pJoin->node.pChildren) {
code = TSDB_CODE_OUT_OF_MEMORY;
}
@ -591,16 +613,18 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
// set on conditions
if (TSDB_CODE_SUCCESS == code && NULL != pJoinTable->pOnCond) {
pJoin->pOtherOnCond = nodesCloneNode(pJoinTable->pOnCond);
if (NULL == pJoin->pOtherOnCond) {
pJoin->pFullOnCond = nodesCloneNode(pJoinTable->pOnCond);
if (NULL == pJoin->pFullOnCond) {
code = TSDB_CODE_OUT_OF_MEMORY;
}
}
#if 0
// set the output
if (TSDB_CODE_SUCCESS == code) {
SNodeList* pColList = NULL;
if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pLeft) && !pJoin->isLowLevelJoin) {
// if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pLeft) && !pJoin->isLowLevelJoin) {
if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pLeft)) {
code = nodesCollectColumns(pSelect, SQL_CLAUSE_WHERE, ((SRealTableNode*)pJoinTable->pLeft)->table.tableAlias, COLLECT_COL_TYPE_ALL, &pColList);
} else {
pJoin->node.pTargets = nodesCloneList(pLeft->pTargets);
@ -616,7 +640,8 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
if (TSDB_CODE_SUCCESS == code) {
SNodeList* pColList = NULL;
if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pRight) && !pJoin->isLowLevelJoin) {
// if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pRight) && !pJoin->isLowLevelJoin) {
if (QUERY_NODE_REAL_TABLE == nodeType(pJoinTable->pRight)) {
code = nodesCollectColumns(pSelect, SQL_CLAUSE_WHERE, ((SRealTableNode*)pJoinTable->pRight)->table.tableAlias, COLLECT_COL_TYPE_ALL, &pColList);
} else {
if (pJoin->node.pTargets) {
@ -641,6 +666,27 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
}
}
#else
// set the output
if (TSDB_CODE_SUCCESS == code) {
SNodeList* pColList = NULL;
code = collectJoinResColumns(pSelect, pJoin, &pColList);
if (TSDB_CODE_SUCCESS == code && NULL != pColList) {
code = createColumnByRewriteExprs(pColList, &pJoin->node.pTargets);
}
nodesDestroyList(pColList);
}
if (NULL == pJoin->node.pTargets && NULL != pLeft) {
pJoin->node.pTargets = nodesCloneList(pLeft->pTargets);
if (NULL == pJoin->node.pTargets) {
code = TSDB_CODE_OUT_OF_MEMORY;
}
}
#endif
if (TSDB_CODE_SUCCESS == code) {
*pLogicNode = (SLogicNode*)pJoin;
} else {
@ -713,6 +759,10 @@ static EGroupAction getDistinctGroupAction(SLogicPlanContext* pCxt, SSelectStmt*
: GROUP_ACTION_NONE;
}
static bool isWindowJoinStmt(SSelectStmt * pSelect) {
return (QUERY_NODE_JOIN_TABLE == nodeType(pSelect->pFromTable) && IS_WINDOW_JOIN(((SJoinTableNode*)pSelect->pFromTable)->subType));
}
static EGroupAction getGroupAction(SLogicPlanContext* pCxt, SSelectStmt* pSelect) {
return ((pCxt->pPlanCxt->streamQuery || NULL != pSelect->pLimit || NULL != pSelect->pSlimit) && !pSelect->isDistinct) ? GROUP_ACTION_KEEP
: GROUP_ACTION_NONE;
@ -723,6 +773,49 @@ static EDataOrderLevel getRequireDataOrder(bool needTimeline, SSelectStmt* pSele
: DATA_ORDER_LEVEL_NONE;
}
static int32_t addWinJoinPrimKeyToAggFuncs(SSelectStmt* pSelect, SNodeList** pList) {
SNodeList* pTargets = (NULL == *pList) ? nodesMakeList() : *pList;
SJoinTableNode* pJoinTable = (SJoinTableNode*)pSelect->pFromTable;
SRealTableNode* pProbeTable = NULL;
switch (pJoinTable->joinType) {
case JOIN_TYPE_LEFT:
pProbeTable = (SRealTableNode*)pJoinTable->pLeft;
break;
case JOIN_TYPE_RIGHT:
pProbeTable = (SRealTableNode*)pJoinTable->pRight;
break;
default:
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) {
return TSDB_CODE_OUT_OF_MEMORY;
}
SSchema* pColSchema = &pProbeTable->pMeta->schema[0];
strcpy(pCol->dbName, pProbeTable->table.dbName);
strcpy(pCol->tableAlias, pProbeTable->table.tableAlias);
strcpy(pCol->tableName, pProbeTable->table.tableName);
strcpy(pCol->colName, pColSchema->name);
strcpy(pCol->node.aliasName, pColSchema->name);
strcpy(pCol->node.userAlias, pColSchema->name);
pCol->tableId = pProbeTable->pMeta->uid;
pCol->tableType = pProbeTable->pMeta->tableType;
pCol->colId = pColSchema->colId;
pCol->colType = COLUMN_TYPE_COLUMN;
pCol->hasIndex = (pColSchema != NULL && IS_IDX_ON(pColSchema));
pCol->node.resType.type = pColSchema->type;
pCol->node.resType.bytes = pColSchema->bytes;
pCol->node.resType.precision = pProbeTable->pMeta->tableInfo.precision;
SNode* pFunc = (SNode*)createGroupKeyAggFunc(pCol);
nodesListAppend(pTargets, pFunc);
return TSDB_CODE_SUCCESS;
}
static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (!pSelect->hasAggFuncs && NULL == pSelect->pGroupByList) {
return TSDB_CODE_SUCCESS;
@ -733,14 +826,16 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
return TSDB_CODE_OUT_OF_MEMORY;
}
bool winJoin = isWindowJoinStmt(pSelect);
pAgg->hasLastRow = pSelect->hasLastRowFunc;
pAgg->hasLast = pSelect->hasLastFunc;
pAgg->hasTimeLineFunc = pSelect->hasTimeLineFunc;
pAgg->hasGroupKeyOptimized = false;
pAgg->onlyHasKeepOrderFunc = pSelect->onlyHasKeepOrderFunc;
pAgg->node.groupAction = getGroupAction(pCxt, pSelect);
pAgg->node.groupAction = winJoin ? GROUP_ACTION_NONE : getGroupAction(pCxt, pSelect);
pAgg->node.requireDataOrder = getRequireDataOrder(pAgg->hasTimeLineFunc, pSelect);
pAgg->node.resultDataOrder = pAgg->onlyHasKeepOrderFunc ? pAgg->node.requireDataOrder : DATA_ORDER_LEVEL_NONE;
pAgg->node.forceCreateNonBlockingOptr = winJoin ? true : false;
int32_t code = TSDB_CODE_SUCCESS;
@ -1199,7 +1294,7 @@ static bool isPrimaryKeySort(SNodeList* pOrderByList) {
if (QUERY_NODE_COLUMN != nodeType(pExpr)) {
return false;
}
return PRIMARYKEY_TIMESTAMP_COL_ID == ((SColumnNode*)pExpr)->colId;
return isPrimaryKeyImpl(pExpr);
}
static int32_t createSortLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
@ -1330,7 +1425,8 @@ static int32_t createPartitionLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pS
}
if (TSDB_CODE_SUCCESS == code) {
code = nodesCollectFuncs(pSelect, SQL_CLAUSE_GROUP_BY, NULL, fmIsAggFunc, &pPartition->pAggFuncs);
// code = nodesCollectFuncs(pSelect, SQL_CLAUSE_GROUP_BY, NULL, fmIsAggFunc, &pPartition->pAggFuncs);
code = nodesCollectFuncs(pSelect, SQL_CLAUSE_PARTITION_BY, NULL, fmIsAggFunc, &pPartition->pAggFuncs);
}
if (TSDB_CODE_SUCCESS == code) {
@ -1702,7 +1798,7 @@ static int32_t createDeleteScanLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* p
STableMeta* pMeta = ((SRealTableNode*)pDelete->pFromTable)->pMeta;
if (TSDB_CODE_SUCCESS == code && hasPkInTable(pMeta)) {
code = addPkCol(pMeta->uid, pMeta->schema + 1, &pScan->pScanCols, pMeta);
code = addPkCol((SRealTableNode*)pDelete->pFromTable, &pScan->pScanCols);
}
if (TSDB_CODE_SUCCESS == code && NULL != pDelete->pTagCond) {

File diff suppressed because it is too large Load Diff

View File

@ -741,49 +741,6 @@ static int32_t createScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubplan,
return TSDB_CODE_FAILED;
}
static int32_t mergeEqCond(SNode** ppDst, SNode** ppSrc) {
if (NULL == *ppSrc) {
return TSDB_CODE_SUCCESS;
}
if (NULL == *ppDst) {
*ppDst = *ppSrc;
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) {
TSWAP(*ppDst, *ppSrc);
}
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst)) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc)) {
nodesListStrictAppendList(pLogic->pParameterList, ((SLogicConditionNode*)(*ppSrc))->pParameterList);
((SLogicConditionNode*)(*ppSrc))->pParameterList = NULL;
} else {
nodesListStrictAppend(pLogic->pParameterList, *ppSrc);
*ppSrc = NULL;
}
nodesDestroyNode(*ppSrc);
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION);
if (NULL == pLogicCond) {
return TSDB_CODE_OUT_OF_MEMORY;
}
pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL;
pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
pLogicCond->condType = LOGIC_COND_TYPE_AND;
pLogicCond->pParameterList = nodesMakeList();
nodesListStrictAppend(pLogicCond->pParameterList, *ppSrc);
nodesListStrictAppend(pLogicCond->pParameterList, *ppDst);
*ppDst = (SNode*)pLogicCond;
*ppSrc = NULL;
return TSDB_CODE_SUCCESS;
}
static int32_t getJoinDataBlockDescNode(SNodeList* pChildren, int32_t idx, SDataBlockDescNode** ppDesc) {
if (2 == pChildren->length) {
*ppDesc = ((SPhysiNode*)nodesListGetNode(pChildren, idx))->pOutputDataBlockDesc;
@ -798,6 +755,146 @@ static int32_t getJoinDataBlockDescNode(SNodeList* pChildren, int32_t idx, SData
return TSDB_CODE_SUCCESS;
}
static int32_t setColEqList(SNode* pEqCond, int16_t leftBlkId, int16_t rightBlkId, SNodeList** ppLeft, SNodeList** ppRight) {
if (QUERY_NODE_OPERATOR == nodeType(pEqCond) && ((SOperatorNode*)pEqCond)->opType == OP_TYPE_EQUAL) {
SOperatorNode* pOp = (SOperatorNode*)pEqCond;
if (leftBlkId == ((SColumnNode*)pOp->pLeft)->dataBlockId) {
nodesListMakeStrictAppend(ppLeft, nodesCloneNode(pOp->pLeft));
} else if (rightBlkId == ((SColumnNode*)pOp->pLeft)->dataBlockId) {
nodesListMakeStrictAppend(ppRight, nodesCloneNode(pOp->pLeft));
} else {
planError("invalid col equal list, leftBlockId:%d", ((SColumnNode*)pOp->pLeft)->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
if (leftBlkId == ((SColumnNode*)pOp->pRight)->dataBlockId) {
nodesListMakeStrictAppend(ppLeft, nodesCloneNode(pOp->pRight));
} else if (rightBlkId == ((SColumnNode*)pOp->pRight)->dataBlockId) {
nodesListMakeStrictAppend(ppRight, nodesCloneNode(pOp->pRight));
} else {
planError("invalid col equal list, rightBlockId:%d", ((SColumnNode*)pOp->pRight)->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
} else if (QUERY_NODE_LOGIC_CONDITION == nodeType(pEqCond) && ((SLogicConditionNode*)pEqCond)->condType == LOGIC_COND_TYPE_AND) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)pEqCond;
SNode* pNode = NULL;
FOREACH(pNode, pLogic->pParameterList) {
int32_t code = setColEqList(pNode, leftBlkId, rightBlkId, ppLeft, ppRight);
if (code) {
return code;
}
}
} else {
planError("invalid col equal cond, type:%d", nodeType(pEqCond));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
return TSDB_CODE_SUCCESS;
}
static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_t leftBlkId, int16_t rightBlkId, SSortMergeJoinPhysiNode* pJoin) {
if (QUERY_NODE_OPERATOR == nodeType(pEqCond)) {
SOperatorNode* pOp = (SOperatorNode*)pEqCond;
if (pOp->opType != OP_TYPE_EQUAL && JOIN_STYPE_ASOF != subType) {
planError("invalid primary cond opType, opType:%d", pOp->opType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
switch (nodeType(pOp->pLeft)) {
case QUERY_NODE_COLUMN: {
SColumnNode* pCol = (SColumnNode*)pOp->pLeft;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->asofOpType = pOp->opType;
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
} else {
planError("invalid primary key col equal cond, leftBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pLeft;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
planError("invalid primary cond left function type, leftFuncType:%d", pFunc->funcType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0);
if (QUERY_NODE_COLUMN != nodeType(pParam)) {
planError("invalid primary cond left timetruncate param type, leftParamType:%d", nodeType(pParam));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SColumnNode* pCol = (SColumnNode*)pParam;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->asofOpType = pOp->opType;
pJoin->leftPrimExpr = nodesCloneNode((SNode*)pFunc);
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
pJoin->rightPrimExpr = nodesCloneNode((SNode*)pFunc);
} else {
planError("invalid primary key col equal cond, leftBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
default:
planError("invalid primary cond left node type, leftNodeType:%d", nodeType(pOp->pLeft));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
switch (nodeType(pOp->pRight)) {
case QUERY_NODE_COLUMN: {
SColumnNode* pCol = (SColumnNode*)pOp->pRight;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->asofOpType = getAsofJoinReverseOp(pOp->opType);
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
} else {
planError("invalid primary key col equal cond, rightBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pRight;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
planError("invalid primary cond right function type, rightFuncType:%d", pFunc->funcType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0);
if (QUERY_NODE_COLUMN != nodeType(pParam)) {
planError("invalid primary cond right timetruncate param type, rightParamType:%d", nodeType(pParam));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SColumnNode* pCol = (SColumnNode*)pParam;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->asofOpType = getAsofJoinReverseOp(pOp->opType);
pJoin->leftPrimExpr = nodesCloneNode((SNode*)pFunc);
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
pJoin->rightPrimExpr = nodesCloneNode((SNode*)pFunc);
} else {
planError("invalid primary key col equal cond, rightBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
default:
planError("invalid primary cond right node type, rightNodeType:%d", nodeType(pOp->pRight));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
} else {
planError("invalid primary key col equal cond, type:%d", nodeType(pEqCond));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
return TSDB_CODE_SUCCESS;
}
static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SJoinLogicNode* pJoinLogicNode,
SPhysiNode** pPhyNode) {
SSortMergeJoinPhysiNode* pJoin =
@ -807,7 +904,12 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
}
pJoin->joinType = pJoinLogicNode->joinType;
pJoin->subType = pJoinLogicNode->subType;
pJoin->pWindowOffset = nodesCloneNode(pJoinLogicNode->pWindowOffset);
pJoin->pJLimit = nodesCloneNode(pJoinLogicNode->pJLimit);
pJoin->node.inputTsOrder = pJoinLogicNode->node.inputTsOrder;
pJoin->seqWinGroup = pJoinLogicNode->seqWinGroup;
pJoin->grpJoin = pJoinLogicNode->grpJoin;
SDataBlockDescNode* pLeftDesc = NULL;
SDataBlockDescNode* pRightDesc = NULL;
@ -816,9 +918,34 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
code = getJoinDataBlockDescNode(pChildren, 1, &pRightDesc);
}
if (TSDB_CODE_SUCCESS == code) {
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pPrimKeyEqCond) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pPrimKeyEqCond,
&pJoin->pPrimKeyCond);
if (TSDB_CODE_SUCCESS == code) {
code = setMergeJoinPrimColEqCond(pJoin->pPrimKeyCond, pJoin->subType, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoin);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->leftPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->leftPrimExpr, pLeftDesc);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->rightPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->rightPrimExpr, pRightDesc);
}
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->addPrimEqCond) {
SNode* pPrimKeyCond = NULL;
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->addPrimEqCond,
&pPrimKeyCond);
if (TSDB_CODE_SUCCESS == code) {
code = setMergeJoinPrimColEqCond(pPrimKeyCond, pJoin->subType, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoin);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->leftPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->leftPrimExpr, pLeftDesc);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->rightPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->rightPrimExpr, pRightDesc);
}
nodesDestroyNode(pPrimKeyCond);
}
if (TSDB_CODE_SUCCESS == code) {
@ -826,17 +953,43 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
&pJoin->pTargets);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOtherOnCond) {
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pFullOnCond) {
code = setNodeSlotId(pCxt, ((SPhysiNode*)pJoin)->pOutputDataBlockDesc->dataBlockId, -1,
pJoinLogicNode->pOtherOnCond, &pJoin->pOtherOnCond);
pJoinLogicNode->pFullOnCond, &pJoin->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code && ((NULL != pJoinLogicNode->pColEqCond) || (NULL != pJoinLogicNode->pTagEqCond))) {
code = mergeEqCond(&pJoinLogicNode->pColEqCond, &pJoinLogicNode->pTagEqCond);
code = mergeJoinConds(&pJoinLogicNode->pColEqCond, &pJoinLogicNode->pTagEqCond);
}
//TODO set from input blocks for group algo
/*
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pColEqCond) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pColEqCond, &pJoin->pColEqCond);
}
*/
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pColEqCond) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId,
pJoinLogicNode->pColEqCond, &pJoin->pColEqCond);
if (TSDB_CODE_SUCCESS == code) {
code = setColEqList(pJoin->pColEqCond, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, &pJoin->pEqLeft, &pJoin->pEqRight);
}
}
if (TSDB_CODE_SUCCESS == code && ((NULL != pJoinLogicNode->pColOnCond) || (NULL != pJoinLogicNode->pTagOnCond))) {
code = mergeJoinConds(&pJoinLogicNode->pColOnCond, &pJoinLogicNode->pTagOnCond);
}
//TODO set from input blocks for group algo
/*
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pColOnCond) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pColOnCond, &pJoin->pColOnCond);
}
*/
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pColOnCond) {
code = setNodeSlotId(pCxt, ((SPhysiNode*)pJoin)->pOutputDataBlockDesc->dataBlockId, -1,
pJoinLogicNode->pColOnCond, &pJoin->pColOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = setConditionsSlotId(pCxt, (const SLogicNode*)pJoinLogicNode, (SPhysiNode*)pJoin);
}
@ -980,6 +1133,107 @@ static int32_t sortHashJoinTargets(int16_t lBlkId, int16_t rBlkId, SHashJoinPhys
return TSDB_CODE_SUCCESS;
}
static int32_t setHashJoinPrimColEqCond(SNode* pEqCond, int16_t leftBlkId, int16_t rightBlkId, SHashJoinPhysiNode* pJoin) {
if (QUERY_NODE_OPERATOR == nodeType(pEqCond)) {
SOperatorNode* pOp = (SOperatorNode*)pEqCond;
if (pOp->opType != OP_TYPE_EQUAL) {
planError("invalid primary cond opType, opType:%d", pOp->opType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
switch (nodeType(pOp->pLeft)) {
case QUERY_NODE_COLUMN: {
SColumnNode* pCol = (SColumnNode*)pOp->pLeft;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
} else {
planError("invalid primary key col equal cond, leftBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pLeft;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
planError("invalid primary cond left function type, leftFuncType:%d", pFunc->funcType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0);
if (QUERY_NODE_COLUMN != nodeType(pParam)) {
planError("invalid primary cond left timetruncate param type, leftParamType:%d", nodeType(pParam));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SColumnNode* pCol = (SColumnNode*)pParam;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->leftPrimExpr = nodesCloneNode((SNode*)pFunc);
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
pJoin->rightPrimExpr = nodesCloneNode((SNode*)pFunc);
} else {
planError("invalid primary key col equal cond, leftBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
default:
planError("invalid primary cond left node type, leftNodeType:%d", nodeType(pOp->pLeft));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
switch (nodeType(pOp->pRight)) {
case QUERY_NODE_COLUMN: {
SColumnNode* pCol = (SColumnNode*)pOp->pRight;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
} else {
planError("invalid primary key col equal cond, rightBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pRight;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
planError("invalid primary cond right function type, rightFuncType:%d", pFunc->funcType);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SNode* pParam = nodesListGetNode(pFunc->pParameterList, 0);
if (QUERY_NODE_COLUMN != nodeType(pParam)) {
planError("invalid primary cond right timetruncate param type, rightParamType:%d", nodeType(pParam));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
SColumnNode* pCol = (SColumnNode*)pParam;
if (leftBlkId == pCol->dataBlockId) {
pJoin->leftPrimSlotId = pCol->slotId;
pJoin->leftPrimExpr = nodesCloneNode((SNode*)pFunc);
} else if (rightBlkId == pCol->dataBlockId) {
pJoin->rightPrimSlotId = pCol->slotId;
pJoin->rightPrimExpr = nodesCloneNode((SNode*)pFunc);
} else {
planError("invalid primary key col equal cond, rightBlockId:%d", pCol->dataBlockId);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
break;
}
default:
planError("invalid primary cond right node type, rightNodeType:%d", nodeType(pOp->pRight));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
} else {
planError("invalid primary key col equal cond, type:%d", nodeType(pEqCond));
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
return TSDB_CODE_SUCCESS;
}
static int32_t createHashJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SJoinLogicNode* pJoinLogicNode,
SPhysiNode** pPhyNode) {
SHashJoinPhysiNode* pJoin =
@ -993,17 +1247,45 @@ static int32_t createHashJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChil
int32_t code = TSDB_CODE_SUCCESS;
pJoin->joinType = pJoinLogicNode->joinType;
pJoin->subType = pJoinLogicNode->subType;
pJoin->pWindowOffset = nodesCloneNode(pJoinLogicNode->pWindowOffset);
pJoin->pJLimit = nodesCloneNode(pJoinLogicNode->pJLimit);
pJoin->node.inputTsOrder = pJoinLogicNode->node.inputTsOrder;
pJoin->timeRangeTarget = pJoinLogicNode->timeRangeTarget;
pJoin->timeRange.skey = pJoinLogicNode->timeRange.skey;
pJoin->timeRange.ekey = pJoinLogicNode->timeRange.ekey;
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pPrimKeyEqCond, &pJoin->pPrimKeyCond);
if (NULL != pJoinLogicNode->pPrimKeyEqCond) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pPrimKeyEqCond,
&pJoin->pPrimKeyCond);
if (TSDB_CODE_SUCCESS == code) {
code = setHashJoinPrimColEqCond(pJoin->pPrimKeyCond, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoin);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->leftPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->leftPrimExpr, pLeftDesc);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->rightPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->rightPrimExpr, pRightDesc);
}
}
if (TSDB_CODE_SUCCESS == code) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pColEqCond, &pJoin->pColEqCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pTagEqCond, &pJoin->pTagEqCond);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pOtherOnCond) {
code = setNodeSlotId(pCxt, ((SPhysiNode*)pJoin)->pOutputDataBlockDesc->dataBlockId, -1, pJoinLogicNode->pOtherOnCond, &pJoin->pFilterConditions);
if (TSDB_CODE_SUCCESS == code) {
code = setNodeSlotId(pCxt, pLeftDesc->dataBlockId, -1, pJoinLogicNode->pLeftOnCond, &pJoin->pLeftOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = setNodeSlotId(pCxt, -1, pRightDesc->dataBlockId, pJoinLogicNode->pRightOnCond, &pJoin->pRightOnCond);
}
if (TSDB_CODE_SUCCESS == code && ((NULL != pJoinLogicNode->pColOnCond) || (NULL != pJoinLogicNode->pTagOnCond))) {
code = mergeJoinConds(&pJoinLogicNode->pColOnCond, &pJoinLogicNode->pTagOnCond);
}
SNode* pOnCond = (NULL != pJoinLogicNode->pColOnCond) ? pJoinLogicNode->pColOnCond : pJoinLogicNode->pTagOnCond;
if (TSDB_CODE_SUCCESS == code && NULL != pOnCond) {
code = setNodeSlotId(pCxt, ((SPhysiNode*)pJoin)->pOutputDataBlockDesc->dataBlockId, -1, pOnCond, &pJoin->pFullOnCond);
}
if (TSDB_CODE_SUCCESS == code) {
code = setListSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->node.pTargets, &pJoin->pTargets);

View File

@ -183,7 +183,7 @@ static int32_t splMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) {
static bool splMatchByNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SLogicNode* pNode, FSplFindSplitNode func,
void* pInfo) {
if (func(pCxt, pSubplan, pNode, pInfo)) {
if (!pNode->splitDone && func(pCxt, pSubplan, pNode, pInfo)) {
return true;
}
SNode* pChild;
@ -192,7 +192,7 @@ static bool splMatchByNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SLogicN
return true;
}
}
return NULL;
return false;
}
static bool splMatch(SSplitContext* pCxt, SLogicSubplan* pSubplan, int32_t flag, FSplFindSplitNode func, void* pInfo) {
@ -1012,27 +1012,6 @@ static int32_t stbSplSplitAggNodeForPartTable(SSplitContext* pCxt, SStableSplitI
return code;
}
static SFunctionNode* createGroupKeyAggFunc(SColumnNode* pGroupCol) {
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
if (pFunc) {
strcpy(pFunc->functionName, "_group_key");
strcpy(pFunc->node.aliasName, pGroupCol->node.aliasName);
strcpy(pFunc->node.userAlias, pGroupCol->node.userAlias);
int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode((SNode*)pGroupCol));
if (code == TSDB_CODE_SUCCESS) {
code = fmGetFuncInfo(pFunc, NULL, 0);
}
if (TSDB_CODE_SUCCESS != code) {
nodesDestroyNode((SNode*)pFunc);
pFunc = NULL;
}
char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_POINTER_PRINT_BYTES + 1] = {0};
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", pFunc->functionName, pFunc);
taosCreateMD5Hash(name, len);
strncpy(pFunc->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
}
return pFunc;
}
/**
* @brief For pipelined agg node, add a SortMergeNode to merge result from vnodes.
@ -1276,6 +1255,7 @@ static int32_t stbSplSplitSortNode(SSplitContext* pCxt, SStableSplitInfo* pInfo)
}
if (TSDB_CODE_SUCCESS == code) {
nodesDestroyNode((SNode*)pInfo->pSplitNode);
pInfo->pSplitNode = NULL;
if (groupSort) {
stbSplSetScanPartSort(pPartSort);
}
@ -1421,7 +1401,7 @@ static int32_t stbSplCreateMergeScanNode(SScanLogicNode* pScan, SLogicNode** pOu
}
static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SScanLogicNode* pScan,
bool groupSort) {
bool groupSort, SStableSplitInfo* pInfo) {
SLogicNode* pMergeScan = NULL;
SNodeList* pMergeKeys = NULL;
int32_t code = stbSplCreateMergeScanNode(pScan, &pMergeScan, &pMergeKeys);
@ -1433,6 +1413,9 @@ static int32_t stbSplSplitMergeScanNode(SSplitContext* pCxt, SLogicSubplan* pSub
code = stbSplCreateMergeNode(pCxt, pSubplan, (SLogicNode*)pScan, pMergeKeys, pMergeScan, groupSort, true);
}
if (TSDB_CODE_SUCCESS == code) {
if ((void*)pInfo->pSplitNode == (void*)pScan) {
pInfo->pSplitNode = NULL;
}
nodesDestroyNode((SNode*)pScan);
code = nodesListMakeStrictAppend(&pSubplan->pChildren,
(SNode*)splCreateScanSubplan(pCxt, pMergeScan, SPLIT_FLAG_STABLE_SPLIT));
@ -1445,7 +1428,7 @@ static int32_t stbSplSplitScanNode(SSplitContext* pCxt, SStableSplitInfo* pInfo)
SScanLogicNode* pScan = (SScanLogicNode*)pInfo->pSplitNode;
if (SCAN_TYPE_TABLE_MERGE == pScan->scanType) {
pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE;
return stbSplSplitMergeScanNode(pCxt, pInfo->pSubplan, pScan, true);
return stbSplSplitMergeScanNode(pCxt, pInfo->pSubplan, pScan, true, pInfo);
}
if (NULL != pScan->pGroupTags) {
return stbSplSplitScanNodeWithPartTags(pCxt, pInfo);
@ -1453,7 +1436,7 @@ static int32_t stbSplSplitScanNode(SSplitContext* pCxt, SStableSplitInfo* pInfo)
return stbSplSplitScanNodeWithoutPartTags(pCxt, pInfo);
}
static int32_t stbSplSplitJoinNodeImpl(SSplitContext* pCxt, SLogicSubplan* pSubplan, SJoinLogicNode* pJoin) {
static int32_t stbSplSplitJoinNodeImpl(SSplitContext* pCxt, SLogicSubplan* pSubplan, SJoinLogicNode* pJoin, SStableSplitInfo* pInfo) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pChild = NULL;
FOREACH(pChild, pJoin->node.pChildren) {
@ -1461,10 +1444,10 @@ static int32_t stbSplSplitJoinNodeImpl(SSplitContext* pCxt, SLogicSubplan* pSubp
//if (pJoin->node.dynamicOp) {
// code = TSDB_CODE_SUCCESS;
//} else {
code = stbSplSplitMergeScanNode(pCxt, pSubplan, (SScanLogicNode*)pChild, false);
code = stbSplSplitMergeScanNode(pCxt, pSubplan, (SScanLogicNode*)pChild, pJoin->grpJoin ? true : false, pInfo);
//}
} else if (QUERY_NODE_LOGIC_PLAN_JOIN == nodeType(pChild)) {
code = stbSplSplitJoinNodeImpl(pCxt, pSubplan, (SJoinLogicNode*)pChild);
code = stbSplSplitJoinNodeImpl(pCxt, pSubplan, (SJoinLogicNode*)pChild, pInfo);
} else {
code = TSDB_CODE_PLAN_INTERNAL_ERROR;
}
@ -1476,12 +1459,13 @@ static int32_t stbSplSplitJoinNodeImpl(SSplitContext* pCxt, SLogicSubplan* pSubp
}
static int32_t stbSplSplitJoinNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
int32_t code = stbSplSplitJoinNodeImpl(pCxt, pInfo->pSubplan, (SJoinLogicNode*)pInfo->pSplitNode);
int32_t code = stbSplSplitJoinNodeImpl(pCxt, pInfo->pSubplan, (SJoinLogicNode*)pInfo->pSplitNode, pInfo);
if (TSDB_CODE_SUCCESS == code) {
//if (!pInfo->pSplitNode->dynamicOp) {
pInfo->pSubplan->subplanType = SUBPLAN_TYPE_MERGE;
//}
SPLIT_FLAG_SET_MASK(pInfo->pSubplan->splitFlag, SPLIT_FLAG_STABLE_SPLIT);
//SPLIT_FLAG_SET_MASK(pInfo->pSubplan->splitFlag, SPLIT_FLAG_STABLE_SPLIT);
pInfo->pSplitNode->splitDone = true;
}
return code;
}
@ -1551,6 +1535,9 @@ static int32_t stableSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
break;
}
if (info.pSplitNode) {
info.pSplitNode->splitDone = true;
}
pCxt->split = true;
return code;
}
@ -1619,7 +1606,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;

View File

@ -15,11 +15,13 @@
#include "functionMgt.h"
#include "planInt.h"
#include "scalar.h"
#include "filter.h"
static char* getUsageErrFormat(int32_t errCode) {
switch (errCode) {
case TSDB_CODE_PLAN_EXPECTED_TS_EQUAL:
return "left.ts = right.ts is expected in join expression";
return "primary timestamp equal condition is expected in join conditions";
case TSDB_CODE_PLAN_NOT_SUPPORT_CROSS_JOIN:
return "not support cross join";
case TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND:
@ -490,6 +492,19 @@ bool getSmallDataTsSortOptHint(SNodeList* pList) {
return false;
}
bool getHashJoinOptHint(SNodeList* pList) {
if (!pList) return false;
SNode* pNode;
FOREACH(pNode, pList) {
SHintNode* pHint = (SHintNode*)pNode;
if (pHint->option == HINT_HASH_JOIN) {
return true;
}
}
return false;
}
int32_t collectTableAliasFromNodes(SNode* pNode, SSHashObj** ppRes) {
int32_t code = TSDB_CODE_SUCCESS;
SLogicNode* pCurr = (SLogicNode*)pNode;
@ -566,3 +581,37 @@ bool keysHasCol(SNodeList* pKeys) {
nodesWalkExprs(pKeys, partTagsOptHasColImpl, &hasCol);
return hasCol;
}
SFunctionNode* createGroupKeyAggFunc(SColumnNode* pGroupCol) {
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
if (pFunc) {
strcpy(pFunc->functionName, "_group_key");
strcpy(pFunc->node.aliasName, pGroupCol->node.aliasName);
strcpy(pFunc->node.userAlias, pGroupCol->node.userAlias);
int32_t code = nodesListMakeStrictAppend(&pFunc->pParameterList, nodesCloneNode((SNode*)pGroupCol));
if (code == TSDB_CODE_SUCCESS) {
code = fmGetFuncInfo(pFunc, NULL, 0);
}
if (TSDB_CODE_SUCCESS != code) {
nodesDestroyNode((SNode*)pFunc);
pFunc = NULL;
}
char name[TSDB_FUNC_NAME_LEN + TSDB_NAME_DELIMITER_LEN + TSDB_POINTER_PRINT_BYTES + 1] = {0};
int32_t len = snprintf(name, sizeof(name) - 1, "%s.%p", pFunc->functionName, pFunc);
taosCreateMD5Hash(name, len);
strncpy(pFunc->node.aliasName, name, TSDB_COL_NAME_LEN - 1);
}
return pFunc;
}
int32_t getTimeRangeFromNode(SNode** pPrimaryKeyCond, STimeWindow* pTimeRange, bool* pIsStrict) {
SNode* pNew = NULL;
int32_t code = scalarCalculateConstants(*pPrimaryKeyCond, &pNew);
if (TSDB_CODE_SUCCESS == code) {
*pPrimaryKeyCond = pNew;
code = filterGetTimeRange(*pPrimaryKeyCond, pTimeRange, pIsStrict);
}
return code;
}

View File

@ -20,6 +20,11 @@
extern "C" {
#endif
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
#ifdef __cplusplus
}
#endif

View File

@ -21,18 +21,36 @@
#include "tsched.h"
// clang-format off
#include "cJSON.h"
#include "queryInt.h"
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
int32_t getAsofJoinReverseOp(EOperatorType op) {
switch (op) {
case OP_TYPE_GREATER_THAN:
return OP_TYPE_LOWER_THAN;
case OP_TYPE_GREATER_EQUAL:
return OP_TYPE_LOWER_EQUAL;
case OP_TYPE_LOWER_THAN:
return OP_TYPE_GREATER_THAN;
case OP_TYPE_LOWER_EQUAL:
return OP_TYPE_GREATER_EQUAL;
case OP_TYPE_EQUAL:
return OP_TYPE_EQUAL;
default:
break;
}
static struct SSchema _s = {
.colId = TSDB_TBNAME_COLUMN_INDEX,
.type = TSDB_DATA_TYPE_BINARY,
.bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE,
.name = "tbname",
};
return -1;
}
const SSchema* tGetTbnameColumnSchema() { return &_s; }
const SSchema* tGetTbnameColumnSchema() {
static struct SSchema _s = {
.colId = TSDB_TBNAME_COLUMN_INDEX,
.type = TSDB_DATA_TYPE_BINARY,
.bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE,
.name = "tbname",
};
return &_s;
}
static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen) {
int32_t rowLen = 0;

View File

@ -3911,6 +3911,7 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *isStri
int32_t optr = 0;
int32_t code = 0;
bool empty = false, all = false;
uint32_t emptyGroups = 0;
for (uint32_t i = 0; i < info->groupNum; ++i) {
SFilterGroup *group = &info->groups[i];
@ -3922,6 +3923,7 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *isStri
optr = LOGIC_COND_TYPE_OR;
}
empty = false;
for (uint32_t u = 0; u < group->unitNum; ++u) {
uint32_t uidx = group->unitIdxs[u];
SFilterUnit *unit = &info->units[uidx];
@ -3929,7 +3931,9 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *isStri
uint8_t raOptr = FILTER_UNIT_OPTR(unit);
filterAddRangeOptr(cur, raOptr, LOGIC_COND_TYPE_AND, &empty, NULL);
FLT_CHK_JMP(empty);
if (empty) {
emptyGroups++;
}
if (FILTER_NO_MERGE_OPTR(raOptr)) {
continue;
@ -3938,6 +3942,10 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *isStri
filterAddUnitRange(info, unit, cur, optr);
}
if (empty) {
continue;
}
if (cur->notnull) {
prev->notnull = true;
break;
@ -3952,6 +3960,8 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool *isStri
}
}
FLT_CHK_JMP(emptyGroups == info->groupNum);
if (prev->notnull) {
*win = TSWINDOW_INITIALIZER;
} else {
@ -4792,14 +4802,8 @@ static EDealRes classifyConditionImpl(SNode *pNode, void *pContext) {
return DEAL_RES_CONTINUE;
}
typedef enum EConditionType {
COND_TYPE_PRIMARY_KEY = 1,
COND_TYPE_TAG_INDEX,
COND_TYPE_TAG,
COND_TYPE_NORMAL
} EConditionType;
static EConditionType classifyCondition(SNode *pNode) {
EConditionType filterClassifyCondition(SNode *pNode) {
SClassifyConditionCxt cxt = {.hasPrimaryKey = false, .hasTagIndexCol = false, .hasOtherCol = false};
nodesWalkExpr(pNode, classifyConditionImpl, &cxt);
return cxt.hasOtherCol ? COND_TYPE_NORMAL
@ -4809,7 +4813,7 @@ static EConditionType classifyCondition(SNode *pNode) {
: (cxt.hasTagIndexCol ? COND_TYPE_TAG_INDEX : COND_TYPE_TAG)));
}
static bool isCondColumnsFromMultiTable(SNode *pCond) {
bool filterIsMultiTableColsCond(SNode *pCond) {
SNodeList *pCondCols = nodesMakeList();
int32_t code = nodesCollectColumnsFromNode(pCond, NULL, COLLECT_COL_TYPE_ALL, &pCondCols);
if (code == TSDB_CODE_SUCCESS) {
@ -4841,12 +4845,12 @@ static int32_t partitionLogicCond(SNode **pCondition, SNode **pPrimaryKeyCond, S
SNodeList *pOtherConds = NULL;
SNode *pCond = NULL;
FOREACH(pCond, pLogicCond->pParameterList) {
if (isCondColumnsFromMultiTable(pCond)) {
if (filterIsMultiTableColsCond(pCond)) {
if (NULL != pOtherCond) {
code = nodesListMakeAppend(&pOtherConds, nodesCloneNode(pCond));
}
} else {
switch (classifyCondition(pCond)) {
switch (filterClassifyCondition(pCond)) {
case COND_TYPE_PRIMARY_KEY:
if (NULL != pPrimaryKeyCond) {
code = nodesListMakeAppend(&pPrimaryKeyConds, nodesCloneNode(pCond));
@ -4932,13 +4936,13 @@ int32_t filterPartitionCond(SNode **pCondition, SNode **pPrimaryKeyCond, SNode *
}
bool needOutput = false;
if (isCondColumnsFromMultiTable(*pCondition)) {
if (filterIsMultiTableColsCond(*pCondition)) {
if (NULL != pOtherCond) {
*pOtherCond = *pCondition;
needOutput = true;
}
} else {
switch (classifyCondition(*pCondition)) {
switch (filterClassifyCondition(*pCondition)) {
case COND_TYPE_PRIMARY_KEY:
if (NULL != pPrimaryKeyCond) {
*pPrimaryKeyCond = *pCondition;

View File

@ -1285,7 +1285,7 @@ int32_t toCharFunction(SScalarParam* pInput, int32_t inputNum, SScalarParam* pOu
}
/** Time functions **/
static int64_t offsetFromTz(char *timezone, int64_t factor) {
int64_t offsetFromTz(char *timezone, int64_t factor) {
char *minStr = &timezone[3];
int64_t minutes = taosStr2Int64(minStr, NULL, 10);
memset(minStr, 0, strlen(minStr));

View File

@ -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);
}

View File

@ -435,6 +435,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_QWORKER_QUIT, "Vnode/Qnode is quitti
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_GEO_NOT_SUPPORT_ERROR, "Geometry not support in this operator")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_WINDOW_CONDITION, "The time pseudo column is illegally used in the condition of the event window.")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR, "Executor internal error")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR, "Executor internal error")
TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_JOIN_CONDITION, "Not supported join on condition")
// grant
TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_EXPIRED, "License expired")
@ -597,7 +599,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FUNCTION_NAME, "Invalid function na
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COMMENT_TOO_LONG, "Comment too long")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_FUNC, "Some functions are allowed only in the SELECT list of a query. "
"And, cannot be mixed with other non scalar functions or columns.")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not supported, since the result of subquery not include valid timestamp column")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_WIN_QUERY, "Window query not supported, since not valid primary timestamp column as input")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DROP_COL, "No columns can be dropped")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COL_JSON, "Only tag can be json type")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALUE_TOO_LONG, "Value too long for column/tag")
@ -624,6 +626,12 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_VIEW_QUERY, "Invalid view query
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_QUERY_MISMATCH, "Columns number mismatch with query result")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VIEW_CONFLICT_WITH_TABLE, "View name is conflict with table")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_SUPPORT_MULTI_RESULT, "Operator not supported multi result")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_WJOIN_HAVING_EXPR, "Invalid window join having expr")
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, "Invalid expr in order by clause")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_WIN_FUNC, "Column exists for window join with aggregation functions")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_IS_PRIMARY_KEY, "tag can not be primary key")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SECOND_COL_PK, "primary key must be second column")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_COL_PK_TYPE, "primary key column must be of type int, uint, bigint, ubigint, and varchar")

View File

@ -949,6 +949,7 @@
,,n,system-test,python3 ./test.py -f eco-system/meta/database/keep_time_offset.py
#tsim test
,,y,script,./test.sh -f tsim/join/join.sim
,,y,script,./test.sh -f tsim/tmq/basic2Of2ConsOverlap.sim
,,y,script,./test.sh -f tsim/parser/where.sim
,,y,script,./test.sh -f tsim/parser/join_manyblocks.sim

View File

@ -0,0 +1,262 @@
sql connect
sql use test0;
sql select a.col1, b.col1 from sta a full join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 16 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data20 != NULL then
return -1
endi
if $data21 != 4 then
return -1
endi
sql select a.col1, b.col1 from sta a full join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a full join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.col1, b.col1 from tba1 a full join tba2 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 6 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 7 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data21 != 2 then
return -1
endi
if $data30 != 3 then
return -1
endi
if $data31 != NULL then
return -1
endi
if $data40 != 4 then
return -1
endi
if $data41 != 5 then
return -1
endi
if $data50 != 5 then
return -1
endi
if $data51 != NULL then
return -1
endi
sql select a.col1, b.col1 from tba2 a full join tba1 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 6 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 5 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 3 then
return -1
endi
if $data31 != NULL then
return -1
endi
if $data40 != 5 then
return -1
endi
if $data41 != 4 then
return -1
endi
if $data50 != 7 then
return -1
endi
if $data51 != NULL then
return -1
endi
sql select a.ts, b.ts from tba1 a full join tba2 b on a.ts = b.ts and a.ts < '2023-11-17 16:29:03' and b.ts < '2023-11-17 16:29:03' order by a.ts;
if $rows != 7 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data20 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data40 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data50 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data60 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a full join tba2 b on a.ts = b.ts and a.ts < '2023-11-17 16:29:03' and b.ts < '2023-11-17 16:29:03' order by b.ts desc;
if $rows != 7 then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data41 != NULL then
return -1
endi
if $data51 != NULL then
return -1
endi
if $data61 != NULL then
return -1
endi
sql select b.ts, a.ts from tba1 a full join tba2 b on a.ts = b.ts and a.ts < '2023-11-17 16:29:03' and b.ts < '2023-11-17 16:29:03' order by b.ts desc, a.ts;
if $rows != 7 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data40 != NULL then
return -1
endi
if $data50 != NULL then
return -1
endi
if $data60 != NULL then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data41 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data51 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data61 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select count(*) from tba1 a full join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 6 then
return -1
endi
sql select count(a.*) from tba1 a full join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(b.*) from tba1 a full join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi

View File

@ -0,0 +1,197 @@
sql connect
sql use test0;
sql select a.col1, b.col1 from sta a inner join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.col1, b.col1;
if $rows != 5 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
print $data01
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
if $data40 != 3 then
return -1
endi
if $data41 != 3 then
return -1
endi
sql select a.col1, b.col1 from sta a join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.col1, b.col1 from tba1 a join tba2 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data11 != 5 then
return -1
endi
sql select a.col1, b.col1 from tba2 a join tba1 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 5 then
return -1
endi
if $data11 != 4 then
return -1
endi
sql select a.ts, a.col1, b.ts,b.col1 from sta a join sta b on a.ts = b.ts and a.t1=b.t1 order by a.t1, a.ts;
if $rows != 8 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != 3 then
return -1
endi
if $data12 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data13 != 3 then
return -1
endi
sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by a.ts desc;
if $rows != 12 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by b.ts desc;
if $rows != 12 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from sta a join sta b on a.ts=b.ts order by a.ts desc, b.ts;
if $rows != 12 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
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

View File

@ -0,0 +1,121 @@
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql drop database if exists test0;
sql create database test0 vgroups 3;
sql use test0;
sql create stable sta (ts timestamp, col1 int) tags(t1 int);
sql create table tba1 using sta tags(1);
sql create table tba2 using sta tags(2);
sql insert into tba1 values ('2023-11-17 16:29:00', 1);
sql insert into tba1 values ('2023-11-17 16:29:02', 3);
sql insert into tba1 values ('2023-11-17 16:29:03', 4);
sql insert into tba1 values ('2023-11-17 16:29:04', 5);
sql insert into tba2 values ('2023-11-17 16:29:00', 2);
sql insert into tba2 values ('2023-11-17 16:29:01', 3);
sql insert into tba2 values ('2023-11-17 16:29:03', 5);
sql insert into tba2 values ('2023-11-17 16:29:05', 7);
sql drop database if exists testa;
sql create database testa vgroups 3;
sql use testa;
sql create table sta1(ts timestamp, f int, g bigint) tags (t int);
sql insert into cta11 using sta1 tags(1) values('2023-10-16 09:10:11.001', 100111, 1001110);
sql insert into cta12 using sta1 tags(2) values('2023-10-16 09:10:12.001', 100112, 1001120);
sql insert into cta13 using sta1 tags(3) values('2023-10-16 09:10:13.001', 100113, 1001130);
sql insert into cta14 using sta1 tags(4) values('2023-10-16 09:10:14.001', 100114, 1001140);
sql create table sta2(ts timestamp, f int, g bigint) tags (t int);
sql insert into cta21 using sta2 tags(1) values('2023-10-16 09:10:11.002', 100221, 1002210);
sql insert into cta22 using sta2 tags(2) values('2023-10-16 09:10:12.002', 100222, 1002220);
sql insert into cta23 using sta2 tags(3) values('2023-10-16 09:10:13.002', 100223, 1002230);
sql insert into cta24 using sta2 tags(4) values('2023-10-16 09:10:14.002', 100224, 1002240);
sql create table stt(ts timestamp, f int, g int) tags (t int);
sql create table tt using stt tags(99);
sql create table stv(ts timestamp, h int) tags (t1 int);
sql insert into ctv1 using stv tags(1) values('2023-10-16 10:10:10', 1);
sql drop database if exists testb;
sql create database testb vgroups 1 PRECISION 'us';
sql use testb;
sql create table stb1(ts timestamp, f int,g int) tags (t int);
sql insert into ctb11 using stb1 tags(1) values('2023-10-16 09:10:11', 110111, 1101110);
sql insert into ctb12 using stb1 tags(2) values('2023-10-16 09:10:12', 110112, 1101120);
sql insert into ctb13 using stb1 tags(3) values('2023-10-16 09:10:13', 110113, 1101130);
sql insert into ctb14 using stb1 tags(4) values('2023-10-16 09:10:14', 110114, 1101140);
sql create table st2(ts timestamp, f int, g int) tags (t int);
sql insert into ctb21 using st2 tags(1) values('2023-10-16 09:10:11', 110221, 1102210);
sql insert into ctb22 using st2 tags(2) values('2023-10-16 09:10:12', 110222, 1102220);
sql insert into ctb23 using st2 tags(3) values('2023-10-16 09:10:13', 110223, 1102230);
sql insert into ctb24 using st2 tags(4) values('2023-10-16 09:10:14', 110224, 1102240);
sql drop database if exists testc;
sql create database testc vgroups 3;
sql use testc;
sql create table stc1(ts timestamp, f int) tags (t json);
sql insert into ctb11 using stc1 tags("{\"tag1\":\"1-11\",\"tag2\":1}") values('2023-10-16 09:10:11', 11);
sql insert into ctb11 using stc1 tags("{\"tag1\":\"1-11\",\"tag2\":1}") values('2023-10-16 09:10:12', 12);
sql insert into ctb12 using stc1 tags("{\"tag1\":\"1-12\",\"tag2\":2}") values('2023-10-16 09:10:11', 21);
sql insert into ctb12 using stc1 tags("{\"tag1\":\"1-12\",\"tag2\":2}") values('2023-10-16 09:10:12', 22);
sql create table stc2(ts timestamp, f int) tags (t json);
sql insert into ctb21 using stc2 tags("{\"tag1\":\"1-21\",\"tag2\":1}") values('2023-10-16 09:10:11', 110);
sql insert into ctb21 using stc2 tags("{\"tag1\":\"1-21\",\"tag2\":1}") values('2023-10-16 09:10:12', 120);
sql insert into ctb22 using stc2 tags("{\"tag1\":\"1-22\",\"tag2\":2}") values('2023-10-16 09:10:11', 210);
sql insert into ctb22 using stc2 tags("{\"tag1\":\"1-22\",\"tag2\":2}") values('2023-10-16 09:10:12', 220);
run tsim/join/inner_join.sim
run tsim/join/left_join.sim
run tsim/join/right_join.sim
run tsim/join/full_join.sim
run tsim/join/left_semi_join.sim
run tsim/join/right_semi_join.sim
run tsim/join/left_anti_join.sim
run tsim/join/right_anti_join.sim
run tsim/join/left_asof_join.sim
run tsim/join/right_asof_join.sim
run tsim/join/left_win_join.sim
run tsim/join/right_win_join.sim
run tsim/join/join_scalar1.sim
run tsim/join/join_scalar2.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
run tsim/join/join_json.sim
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
run tsim/join/inner_join.sim
run tsim/join/left_join.sim
run tsim/join/right_join.sim
run tsim/join/full_join.sim
run tsim/join/left_semi_join.sim
run tsim/join/right_semi_join.sim
run tsim/join/left_anti_join.sim
run tsim/join/right_anti_join.sim
run tsim/join/left_asof_join.sim
run tsim/join/right_asof_join.sim
run tsim/join/left_win_join.sim
run tsim/join/right_win_join.sim
run tsim/join/join_scalar1.sim
run tsim/join/join_scalar2.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
run tsim/join/join_json.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -0,0 +1,597 @@
sql connect
sql use test0;
#join type
sql_error select a.ts from sta a outer join sta b on b.ts = b.ts;
sql_error select a.ts from sta a semi join sta b on b.ts = b.ts;
sql_error select a.ts from sta a anti join sta b on b.ts = b.ts;
sql_error select a.ts from sta a asof join sta b on b.ts = b.ts;
sql_error select a.ts from sta a window join sta b window_offset(-1s, 1s);
sql_error select a.ts from sta a inner outer join sta b on b.ts = b.ts;
sql_error select a.ts from sta a inner semi join sta b on b.ts = b.ts;
sql_error select a.ts from sta a inner anti join sta b on b.ts = b.ts;
sql_error select a.ts from sta a inner asof join sta b on b.ts = b.ts;
sql_error select a.ts from sta a inner window join sta b on b.ts = b.ts;
sql_error select a.ts from sta a left inner join sta b on b.ts = b.ts;
sql_error select a.ts from sta a right inner join sta b on b.ts = b.ts;
sql_error select a.ts from sta a full inner join sta b on b.ts = b.ts;
sql_error select a.ts from sta a full semi join sta b on b.ts = b.ts;
sql_error select a.ts from sta a full anti join sta b on b.ts = b.ts;
sql_error select a.ts from sta a full asof join sta b on b.ts = b.ts;
sql_error select a.ts from sta a full window join sta b window_offset(-1s, 1s);
#inner join
sql_error select a.ts from sta a join sta b;
sql_error select a.ts from sta a join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a join sta b where a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a join sta b on a.col1 = b.col1;
sql_error select a.ts from sta a join sta b on a.col1 is null;
sql_error select a.ts from sta a join sta b on a.ts + 1 = b.col1;
sql_error select a.ts from sta a join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql select a.ts from sta a join sta b on a.ts = b.ts;
sql select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts;
sql select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1w);
sql_error select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql_error select a.ts from sta a join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s);
sql_error select a.ts from sta a join sta b on a.col1 = b.col1 where a.col1=b.col1;
sql select a.ts from sta a join sta b on a.col1 = b.col1 where a.ts=b.ts;
sql select a.ts from sta a join sta b where a.ts=b.ts;
sql_error select a.ts from sta a ,sta b on a.ts=b.ts;
sql select a.ts from sta a ,sta b where a.ts=b.ts;
sql select a.ts from sta a ,sta b where a.ts=b.ts and a.col1 + 1 = b.col1;
sql select b.col1 from sta a ,sta b where a.ts=b.ts and a.col1 + 1 = b.col1 order by a.ts;
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
sql_error select a.ts from sta a left join sta b;
sql_error select a.ts from sta a left join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left join sta b where a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left join sta b on a.col1 = b.col1;
sql_error select a.ts from sta a left join sta b on a.col1 is not NULL;
sql_error select a.ts from sta a left join sta b on a.ts + 1 = b.col1;
sql_error select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql_error select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql_error select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s);
sql select a.ts from sta a left join sta b on timetruncate(a.ts, 1d) = b.ts;
sql_error select a.ts from sta a left join sta b on a.col1 = b.col1 where a.col1 = b.col1;
sql_error select a.ts from sta a left join sta b on a.col1 = b.col1 where a.ts = b.ts;
sql_error select a.ts from sta a left join sta b where a.ts = b.ts;
sql_error 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 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 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 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;
sql_error select a.ts from sta a left semi join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left semi join sta b where a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left semi join sta b on a.col1 = b.col1;
sql_error select a.ts from sta a left semi join sta b on a.col1 like '1';
sql_error select a.ts from sta a left semi join sta b on a.col1 is null;
sql_error select a.ts from sta a left semi join sta b on a.ts + 1 = b.col1;
sql_error select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql_error select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql_error select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s);
sql select a.ts from sta a left semi join sta b on timetruncate(a.ts, 1d) = b.ts;
sql_error select a.ts from sta a left semi join sta b on a.col1 = b.col1 where a.col1 = b.col1;
sql_error select a.ts from sta a left semi join sta b on a.col1 = b.col1 where a.ts = b.ts;
sql_error select a.ts from sta a left semi join sta b where a.ts = b.ts;
sql_error 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 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 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 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;
sql_error select a.ts from sta a left anti join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left anti join sta b where a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left anti join sta b on a.col1 = b.col1;
sql_error select a.ts from sta a left anti join sta b on a.col1 / 1;
sql_error select a.ts from sta a left anti join sta b on a.col1 is null;
sql_error select a.ts from sta a left anti join sta b on a.ts + 1 = b.col1;
sql_error select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql_error select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql_error select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s);
sql select a.ts from sta a left anti join sta b on timetruncate(a.ts, 1d) = b.ts;
sql_error select a.ts from sta a left anti join sta b on a.col1 = b.col1 where a.col1 = b.col1;
sql_error select a.ts from sta a left anti join sta b on a.col1 = b.col1 where a.ts = b.ts;
sql_error select a.ts from sta a left anti join sta b where a.ts = b.ts;
sql_error 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 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 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 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;
sql_error select a.ts from sta a left asof join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left asof join sta b on a.ts = b.ts and a.ts = b.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;
sql_error select a.ts from sta a left asof join sta b on a.ts != b.ts;
sql_error select a.ts from sta a left asof join sta b on a.ts is null;
sql_error select a.ts from sta a left asof join sta b on a.ts + 1 = b.col1;
sql select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 0;
sql select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1024;
sql_error select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1025;
sql_error select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts jlimit -1;
sql_error select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts window_offset(-1s, 1s);
sql select a.ts from sta a left asof join sta b on timetruncate(a.ts, 1d) = b.ts;
sql select a.ts from sta a left asof join sta b on a.col1 = b.col1 where a.col1 = b.col1;
sql select a.ts from sta a left asof join sta b on a.col1 = b.col1 where a.ts = b.ts;
sql select a.ts from sta a left asof join sta b where a.ts = b.ts;
sql 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 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 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 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 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;
sql_error select a.ts from sta a left window join sta b on a.ts = b.ts or a.ts = b.ts;
sql_error select a.ts from sta a left window join sta b on a.ts = b.ts and a.ts = b.ts;
sql_error select a.ts from sta a left window join sta b on a.ts = b.ts or a.col1 = b.col1;
sql_error select a.ts from sta a left window join sta b on a.ts = b.ts and a.col1 = b.col1;
sql_error 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 select a.ts from sta a left window join sta b on a.col1 = b.col1 and a.ts = b.ts;
sql_error 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 select a.ts from sta a left window join sta b where a.ts = b.ts;
sql select a.ts from sta a left window join sta b window_offset(-1s,1s) where a.ts = b.ts;
sql_error select a.ts from sta a left window join sta b where a.ts = b.ts or a.ts = b.ts;
sql 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 select a.ts from sta a left window join sta b on a.col1 = b.col1;
sql select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s);
sql select a.ts from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s,1s);
sql 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 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 select a.ts from sta a left window join sta b on a.ts != b.ts;
sql_error select a.ts from sta a left window join sta b on a.ts != b.ts window_offset(-1s,1s);
sql_error select a.ts from sta a left window join sta b on a.ts is null;
sql_error select a.ts from sta a left window join sta b on a.ts is null window_offset(-1s,1s);
sql_error select a.ts from sta a left window join sta b on a.ts + 1 = b.col1;
sql_error select a.ts from sta a left window join sta b on a.ts + 1 = b.col1 window_offset(-1s,1s);
sql_error select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) > b.ts;
sql_error select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) > b.ts window_offset(-1s,1s);
sql_error select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts + 1;
sql_error 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 select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 0;
sql select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1024;
sql_error select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit 1025;
sql_error select a.ts from sta a left window join sta b window_offset(-1s,1s) jlimit -1;
sql select a.ts from sta a left window join sta b on a.col1 = b.col1 window_offset(-1s, 1s) jlimit 1;
sql_error select a.ts from sta a left window join sta b on timetruncate(a.ts, 1d) = b.ts;
sql_error select a.ts from sta a left window join sta b on a.col1 = b.col1 where a.col1 = b.col1;
sql 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 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 select a.ts from sta a left window join sta b where a.ts = b.ts;
sql_error 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 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 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 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 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 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 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 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 select a.ts from test0.sta a left window join testb.stb1 b window_offset(-1s,1s);
sql select a.ts from testb.stb1 a left window join testb.stb1 b window_offset(-1s,1s);
sql_error select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit a.col1;
sql_error select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit 1 + 1;
sql_error select a.ts from sta a left window join sta b window_offset(1s,1s-1s) jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(1s,-1s) jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(-1a,1a) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1b,1b) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1b,1s) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1u,1u) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1u,1s) jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(-1h,1m) jlimit 1;
sql select a.ts from sta a left window join sta b window_offset(-1d,1w) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1n,1n) jlimit 1;
sql_error select a.ts from sta a left window join sta b window_offset(-1y,1y) jlimit 1;
sql connect;
sql use testb;
sql_error select a.ts from stb1 a left window join stb1 b window_offset(-1b,1b) jlimit 1;
sql_error select a.ts from stb1 a left window join stb1 b window_offset(-1b,1s) jlimit 1;
sql select a.ts from stb1 a left window join stb1 b window_offset(-1u,1u) jlimit 1;
sql select a.ts from stb1 a left window join stb1 b window_offset(-1s,1s) jlimit 1;
sql connect;
sql use test0;
sql_error 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 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 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 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 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 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 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 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 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 select diff(a.col1) from sta a left window join sta b window_offset(-1s,1s);
sql_error select csum(a.col1) from sta a left window join sta b window_offset(-1s,1s);
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;

View File

@ -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;

View File

@ -0,0 +1,135 @@
sql connect
sql use testc;
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1';
if $rows != 0 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2';
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1';
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2';
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts;
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1';
if $rows != 0 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left semi join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2';
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts and a.t->'tag1' = b.t->'tag1';
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left anti join stc2 b on a.ts = b.ts and a.t->'tag2' = b.t->'tag2';
if $rows != 0 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b;
if $rows != 4 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b on a.t->'tag1' = b.t->'tag1';
if $rows != 4 then
return -1
endi
if $data02 != NULL then
return -1
endi
if $data12 != NULL then
return -1
endi
if $data22 != NULL then
return -1
endi
if $data32 != NULL then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left asof join stc2 b on a.t->'tag2' = b.t->'tag2';
if $rows != 4 then
return -1
endi
if $data02 != @23-10-16 09:10:11.000@ then
return -1
endi
if $data12 != @23-10-16 09:10:12.000@ then
return -1
endi
if $data22 != @23-10-16 09:10:11.000@ then
return -1
endi
if $data32 != @23-10-16 09:10:12.000@ then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b window_offset(0s, 1s);
if $rows != 12 then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b on a.t->'tag1' = b.t->'tag1' window_offset(0s, 1s);
if $rows != 4 then
return -1
endi
if $data02 != NULL then
return -1
endi
if $data12 != NULL then
return -1
endi
if $data22 != NULL then
return -1
endi
if $data32 != NULL then
return -1
endi
sql select a.ts, a.t->'tag1', b.ts, b.t->'tag1' from stc1 a left window join stc2 b on a.t->'tag2' = b.t->'tag2' window_offset(0s, 1s);
if $rows != 6 then
return -1
endi
if $data02 != @23-10-16 09:10:11.000@ then
return -1
endi
if $data12 != @23-10-16 09:10:12.000@ then
return -1
endi
if $data22 != @23-10-16 09:10:12.000@ then
return -1
endi
if $data32 != @23-10-16 09:10:11.000@ then
return -1
endi
if $data42 != @23-10-16 09:10:12.000@ then
return -1
endi
if $data52 != @23-10-16 09:10:12.000@ then
return -1
endi

View File

@ -0,0 +1,946 @@
sql connect
sql use test0;
sql select a.ts from sta a ,(select TIMETRUNCATE(ts,1d) ts from sta) b where timetruncate(a.ts, 1d) = b.ts;
if $rows != 64 then
return -1
endi
#inner join + non join
sql_error select tail(col1, 1) from (select b.col1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0) c;
sql_error select tail(col1, 1) from (select b.col1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0 order by b.ts) c;
sql select tail(col1, 1) from (select b.col1, a.ts from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0 order by b.ts) c;
if $rows != 1 then
return -1
endi
if $data00 != 7 then
return -1
endi
sql_error select a.*,b.* from (select * from sta partition by tbname) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql select a.t1 from (select * from sta partition by tbname order by ts) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts order by b.ts desc;
if $rows != 12 then
return -1
endi
#left join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql select a.t1 from (select * from sta partition by tbname order by ts) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts order by b.ts desc;
if $rows != 12 then
return -1
endi
#left semi join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql select a.t1 from (select * from sta partition by tbname order by ts) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts order by b.ts desc;
if $rows != 8 then
return -1
endi
#left anti join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql select a.t1 from (select * from sta partition by tbname order by ts) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.t1 from (select * from sta partition by tbname order by ts desc) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts order by b.ts desc;
if $rows != 0 then
return -1
endi
#left asof join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left asof join (select * from sta partition by tbname order by ts) b;
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a left asof join (select * from sta partition by tbname order by ts) b;
sql_error select a.t1 from (select * from sta partition by tbname order by ts) a left asof join (select * from sta partition by tbname order by ts) b;
sql_error select a.t1 from (select * from sta partition by tbname order by ts desc) a left asof join (select * from sta partition by tbname order by ts) b;
sql_error select a.t1 from (select * from sta partition by tbname order by ts desc) a left asof join (select * from sta partition by tbname order by ts) b order by b.ts desc;
#left window join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left window join (select * from sta partition by tbname order by ts) b window_offset(-1s,1s);
sql_error select a.t1 from (select * from sta partition by tbname order by col1) a left window join (select * from sta partition by tbname order by ts) b window_offset(-1s,1s);
sql_error select a.t1 from (select * from sta partition by tbname order by ts) a left window join (select * from sta partition by tbname order by ts) b window_offset(-1s,1s);
sql_error select a.t1 from (select * from sta partition by tbname order by ts desc) a left window join (select * from sta partition by tbname order by ts) b window_offset(-1s,1s);
sql_error select a.t1 from (select * from sta partition by tbname order by ts desc) a left window join (select * from sta partition by tbname order by ts) b window_offset(-1s,1s) order by b.ts desc;
#inner join + inner join
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts and tb1.t1=tb2.t1) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql select a.ts from (select tba1.ts from tba1 join tba2 on tba1.ts=tba2.ts) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 20 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
if $rows != 20 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
if $rows != 20 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
if $rows != 20 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) b on a.ts = b.ts;
if $rows != 36 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) b on a.ts = b.ts;
if $rows != 36 then
return -1
endi
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#inner join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a join sta b on a.ts = b.ts;
sql select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a join sta b on a.ts = b.ts;
if $rows != 20 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
if $rows != 36 then
return -1
endi
sql_error select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#inner join + left semi join
sql select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a join (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#inner join + left anti join
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a join sta b on a.ts = b.ts;
sql select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a join (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql_error select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#inner join + left asof join
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2 order by tb2.ts) a join sta b on a.ts = b.ts;
sql select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a join (select tb1.ts from sta tb1 left asof join sta tb2 order by tb1.ts desc) b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql_error select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left asof join sta tb2 order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left asof join sta tb2) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#inner join + left window join
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb2.ts) a join sta b on a.ts = b.ts;
sql select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a join sta b on a.ts = b.ts;
if $rows != 42 then
return -1
endi
sql select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a join (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb1.ts desc) b on a.ts = b.ts;
if $rows != 152 then
return -1
endi
sql_error select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb2.ts desc) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
sql select count(a.col1) from (select tb1.ts,tb1.col1 from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts session(a.ts, 1s);;
#left join + inner join
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts and tb1.t1=tb2.t1) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tba1.ts from tba1 join tba2 on tba1.ts=tba2.ts) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) b on a.ts = b.ts;
#left join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left join + left semi join
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left join (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left join + left anti join
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left join (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left join + left asof join
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2 order by tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left join (select tb1.ts from sta tb1 left asof join sta tb2 order by tb1.ts desc) b on a.ts = b.ts;
#left join + left window join
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb2.ts) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a left join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a left join (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb1.ts desc) b on a.ts = b.ts;
#left semi join + inner join
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts and tb1.t1=tb2.t1) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tba1.ts from tba1 join tba2 on tba1.ts=tba2.ts) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left semi join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left semi join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left semi join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left semi join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left semi join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) b on a.ts = b.ts;
#left semi join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left semi join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left semi join + left semi join
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left semi join (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left semi join + left anti join
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left semi join (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left semi join + left asof join
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2 order by tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left semi join (select tb1.ts from sta tb1 left asof join sta tb2 order by tb1.ts desc) b on a.ts = b.ts;
#left semi join + left window join
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb2.ts) a left semi join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a left semi join sta b on a.ts = b.ts;
#left anti join + inner join
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts and tb1.t1=tb2.t1) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tba1.ts from tba1 join tba2 on tba1.ts=tba2.ts) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts) a left anti join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left anti join (select * from sta partition by tbname order by ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left anti join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left anti join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts desc) a left anti join (select tb1.ts from sta tb1 join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) b on a.ts = b.ts;
#left anti join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left anti join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left anti join + left semi join
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts) a left anti join (select tb1.ts from sta tb1 left semi join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left anti join + left anti join
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts) a left anti join (select tb1.ts from sta tb1 left anti join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b on a.ts = b.ts;
#left anti join + left asof join
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2 order by tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left asof join sta tb2) a left anti join (select tb1.ts from sta tb1 left asof join sta tb2 order by tb1.ts desc) b on a.ts = b.ts;
#left anti join + left window join
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s) order by tb2.ts) a left anti join sta b on a.ts = b.ts;
sql_error select a.ts from (select tb1.ts from sta tb1 left window join sta tb2 window_offset(-1s,1s)) a left anti join sta b on a.ts = b.ts;
#left asof join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left asof join sta b;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left asof join sta b;
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left asof join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b;
#left window join + left join
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb2.ts) a left window join sta b window_offset(-1s, 1s);
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left window join sta b window_offset(-1s, 1s);
sql_error select a.ts from (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts) a left window join (select tb1.ts from sta tb1 left join sta tb2 on tb1.ts=tb2.ts order by tb1.ts desc) b window_offset(-1s, 1s);
#multi level join
sql select a.ts from sta a join sta b on a.ts = b.ts join sta c on b.ts = c.ts;
if $rows != 20 then
return -1
endi
sql_error select a.ts from sta a join sta b on a.ts = b.ts left join sta c on b.ts = c.ts;
sql_error select a.ts from sta a join sta b on a.ts = b.ts left semi join sta c on b.ts = c.ts;
sql select a.ts from sta a left join sta b on a.ts = b.ts join sta c on b.ts = c.ts;
sql select a.ts from sta a left semi join sta b on a.ts = b.ts join sta c on b.ts = c.ts;
sql select a.ts from sta a left anti join sta b on a.ts = b.ts join sta c on b.ts = c.ts;
sql select a.ts from (sta a left asof join sta b) join sta c on b.ts = c.ts;
sql select a.ts from sta a left window join sta b window_offset(-1s,1s) join sta c on b.ts = c.ts;
sql_error select a.ts from sta a left join sta b on a.ts = b.ts left join sta c on b.ts = c.ts;
sql_error select a.ts from sta a left semi join sta b on a.ts = b.ts left join sta c on b.ts = c.ts;
sql_error select a.ts from sta a left anti join sta b on a.ts = b.ts left semi join sta c on b.ts = c.ts;
sql select a.ts from sta a full join sta b on a.ts = b.ts join sta c on b.ts = c.ts;
#timeline + inner join
sql select sum(c1) from (select a.col1 c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1);
if $rows != 1 then
return -1
endi
if $data00 != 30 then
return -1
endi
sql select sum(c1) from (select a.col1 c1 from sta a join sta b on a.ts = b.ts);
if $rows != 1 then
return -1
endi
if $data00 != 42 then
return -1
endi
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a join sta b on a.ts = b.ts where b.t1 > 1);
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts where b.t1 > 1);
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts where b.t1 > 1);
if $rows != 0 then
return -1
endi
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts where b.t1 > 1);
if $rows != 0 then
return -1
endi
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left asof join sta b);
if $rows != 3 then
return -1
endi
sql select diff(c1) from (select distinct a.ts, a.col1 c1 from tba1 a left window join sta b window_offset(-1s, 0s) order by a.ts);
if $rows != 3 then
return -1
endi
sql select diff(c1) from (select b.col1 c1, a.ts from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 where a.t1 > 1 order by a.ts);
if $rows != 3 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
sql select count(c1) from (select b.ts, a.col1 c1 from tba1 a join sta b on a.ts = b.ts) c session(c.ts, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
sql select count(c1) from (select b.ts, a.col1 c1 from tba1 a join sta b on a.ts = b.ts partition by a.col1 order by a.ts) c session(c.ts, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
sql_error select diff(c1) from (select a.ts, a.col1 c1 from sta a join sta b on a.ts = b.ts);
sql_error select diff(c1) from (select a.col1 c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1);
sql_error select diff(c1) from (select a.col1 c1 from sta a join sta b on a.ts = b.ts);
sql_error select diff(c1) from (select a.col1 c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 order by a.ts);
sql_error select diff(c1) from (select a.col1 c1, a.ts from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 order by a.ts);
sql_error select count(c1) from (select a.col1 c1 from tba1 a join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a join sta b on a.ts = b.ts partition by a.col1) c session(c.ts, 1s);
#timeline + left join
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left join tba2 b on a.ts = b.ts);
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
sql_error select diff(c1) from (select b.col1 c1 from tba1 a left join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select b.ts, b.col1 c1 from tba1 a left join tba2 b on a.ts = b.ts);
sql select diff(c1) from (select a.ts, b.col1 c1 from tba1 a left join tba2 b on a.ts = b.ts);
if $rows != 3 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data20 != NULL then
return -1
endi
sql_error select count(c1) from (select a.col1 c1 from tba1 a left join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts order by b.ts) interval(1s);
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts) c session(c.ts1, 1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts order by ts1) c session(c.ts1, 1s);
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
#timeline + left semi join
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left semi join tba2 b on a.ts = b.ts);
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql_error select diff(c1) from (select b.col1 c1 from tba1 a left semi join tba2 b on a.ts = b.ts);
sql select diff(c1) from (select b.ts, b.col1 c1 from tba1 a left semi join tba2 b on a.ts = b.ts);
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select diff(c1) from (select a.ts, b.col1 c1 from tba1 a left semi join tba2 b on a.ts = b.ts);
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts) interval(1s);
sql select count(c1) from (select b.ts, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select b.ts, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts order by b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts order by ts1) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left semi join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
#timeline + left anti join
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left anti join tba2 b on a.ts = b.ts);
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql_error select diff(c1) from (select b.col1 c1 from tba1 a left anti join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select b.ts, b.col1 c1 from tba1 a left anti join tba2 b on a.ts = b.ts);
#????
sql select diff(c1) from (select b.ts, b.col1 c1,a.ts from tba1 a left anti join tba2 b on a.ts = b.ts);
sql select diff(c1) from (select a.ts, b.col1 c1 from tba1 a left anti join tba2 b on a.ts = b.ts);
sql_error select count(c1) from (select a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts order by b.ts) interval(1s);
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts) interval(1s);
if $rows != 0 then
return -1
endi
sql select count(c1) from (select a.col1 c1,a.ts from tba1 a left anti join sta b on a.ts = b.ts) interval(1s);
if $rows != 0 then
return -1
endi
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts) c session(c.ts1, 1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts order by ts1) c session(c.ts1, 1s);
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left anti join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 0 then
return -1
endi
sql select count(c1) from (select a.col1 c1, timetruncate(a.ts, 1d) ts1 from tba1 a left anti join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 0 then
return -1
endi
sql select count(c1) from (select a.col1 c1, a.ts + 1s ts1 from tba1 a left anti join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 0 then
return -1
endi
#timeline + left asof join
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left asof join tba2 b);
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
sql_error select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left asof join tba2 b on a.col1 = b.col1);
sql_error select diff(c1) from (select b.col1 c1 from tba1 a left asof join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select b.ts, b.col1 c1 from tba1 a left asof join tba2 b on a.ts = b.ts);
sql select diff(c1) from (select b.ts, b.col1 c1,a.ts from tba1 a left asof join tba2 b on a.ts = b.ts);
if $rows != 3 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data20 != NULL then
return -1
endi
sql_error select count(c1) from (select a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts order by b.ts) interval(1s);
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left asof join sta b on a.col1 = b.col1) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(c1) from (select a.col1 c1,a.ts from tba1 a left asof join sta b on a.ts = b.ts) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts) c session(c.ts1, 1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts order by ts1) c session(c.ts1, 1s);
sql_error select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left asof join sta b on a.col1 = b.col1) c session(c.ts1, 1s);
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left asof join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1, timetruncate(a.ts, 1d) ts1 from tba1 a left asof join sta b on a.col1 = b.col1) c session(c.ts1, 1s);
sql select count(c1) from (select a.col1 c1, timetruncate(a.ts, 1d) ts1 from tba1 a left asof join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1, a.ts + 1s ts1 from tba1 a left asof join sta b on a.col1 = b.col1) c session(c.ts1, 1s);
sql select count(c1) from (select a.col1 c1, a.ts + 1s ts1 from tba1 a left asof join sta b on a.ts = b.ts) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
#timeline + left window join
sql select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left window join tba2 b window_offset(1s,1s));
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
sql_error select diff(c1) from (select a.ts, a.col1 c1 from tba1 a left window join tba2 b on a.col1 = b.col1 window_offset(1s,1s));
sql_error select diff(c1) from (select b.col1 c1 from tba1 a left window join tba2 b window_offset(1s,1s));
sql_error select diff(c1) from (select b.ts, b.col1 c1 from tba1 a left window join tba2 b window_offset(1s,1s));
sql select diff(c1) from (select b.ts, b.col1 c1,a.ts from tba1 a left window join tba2 b window_offset(1s,1s));
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data20 != 2 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s)) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s)) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s) order by b.ts) interval(1s);
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s)) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
sql select count(c1) from (select a.ts, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s)) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data20 != 4 then
return -1
endi
if $data30 != 4 then
return -1
endi
sql select count(c1) from (select a.col1 c1,a.ts from tba1 a left window join sta b window_offset(-1s,1s)) interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data20 != 4 then
return -1
endi
if $data30 != 4 then
return -1
endi
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s)) c session(c.ts1, 1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s) order by ts1) c session(c.ts1, 1s);
sql_error select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s)) c session(c.ts1, 1s);
sql select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a left window join sta b window_offset(-1s,1s)) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 12 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1, timetruncate(a.ts, 1d) ts1 from tba1 a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s)) c session(c.ts1, 1s);
sql select count(c1) from (select a.col1 c1, timetruncate(a.ts, 1d) ts1 from tba1 a left window join sta b window_offset(-1s,1s)) c session(c.ts1, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 15 then
return -1
endi
sql_error select count(c1) from (select a.col1 c1, a.ts + 1s ts1 from tba1 a left window join sta b on a.col1 = b.col1 window_offset(-1s,1s)) c session(c.ts1, 1s);
sql select count(c1) from (select a.col1 c1, a.ts + 1s ts1 from tba1 a left window join sta b window_offset(-1s,1s)) c session(c.ts1, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 12 then
return -1
endi
#timeline + full join
sql_error select diff(c1) from (select a.ts, a.col1 c1 from tba1 a full join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select b.col1 c1 from tba1 a full join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select b.ts, b.col1 c1 from tba1 a full join tba2 b on a.ts = b.ts);
sql_error select diff(c1) from (select a.ts, b.col1 c1 from tba1 a full join tba2 b on a.ts = b.ts);
sql_error select count(c1) from (select a.col1 c1 from tba1 a full join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts order by b.ts) interval(1s);
sql_error select count(c1) from (select a.ts, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts) interval(1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts) c session(c.ts1, 1s);
sql_error select count(c1) from (select b.ts ts1, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts order by ts1) c session(c.ts1, 1s);
sql_error select count(c1) from (select a.ts ts1, a.col1 c1 from tba1 a full join sta b on a.ts = b.ts) c session(c.ts1, 1s);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,903 @@
sql connect
sql use test0;
##### conditions
sql use test0;
#full join
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts or a.ts != b.ts;
if $rows != 64 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h);
if $rows != 16 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 where a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 or a.col1 = b.col1 where a.ts = b.ts;
sql_error select count(*),last(a.col1) from sta a full join sta b on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 where a.ts = b.ts and a.col1 > 2;
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta a full join sta b on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 14 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 14 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 15 then
return -1
endi
sql select a.tbname from sta a full join sta b on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 15 then
return -1
endi
sql_error select a.tbname from sta a full join sta b on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 13 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 11 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 16 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 10 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql_error select a.tbname from sta a full join sta b where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta a full join sta b where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta a full join sta b where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
#right join
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts or a.ts != b.ts;
if $rows != 64 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h);
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 or a.col1 = b.col1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select count(*),last(a.col1) from sta b right join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 where a.ts = b.ts and a.col1 > 2;
sql select count(*),last(a.col1) from sta b right join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 and a.ts = b.ts and a.col1 > 2;
if $rows != 1 then
return -1
endi
if $data00 != 9 then
return -1
endi
if $data01 != 7 then
return -1
endi
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta b right join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql select first(b.col1),count(b.t1),last(a.col1),count(*) from sta b right join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null and a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
if $rows != 1 then
return -1
endi
if $data00 != 5 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data02 != 7 then
return -1
endi
if $data03 != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 8 then
return -1
endi
sql select count(b.ts) from sta b right join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 8 then
return -1
endi
sql select count(b.col1) from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 8 then
return -1
endi
sql select count(b.ts) from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select a.tbname from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 8 then
return -1
endi
sql select count(b.*) from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql_error select a.tbname from sta b right join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 8 then
return -1
endi
sql select count(b.ts) from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 8 then
return -1
endi
sql select count(b.col1) from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 1 then
return -1
endi
if $data00 != 5 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 8 then
return -1
endi
sql select count(b.col1) from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 8 then
return -1
endi
sql select count(b.ts) from sta b right join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 1 then
return -1
endi
if $data00 != 6 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql_error select a.tbname from sta b right join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
#right semi join
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts;
if $rows != 2 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts or a.ts != b.ts;
if $rows != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h);
if $rows != 0 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 or a.col1 = b.col1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select count(*),last(a.col1) from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 where a.ts = b.ts and a.col1 > 2;
sql select count(*),last(a.col1) from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 and a.ts = b.ts and a.col1 > 2;
if $rows != 1 then
return -1
endi
if $data00 != 6 then
return -1
endi
if $data01 != 7 then
return -1
endi
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta b right semi join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql select first(b.col1),count(b.t1),last(a.col1),count(*) from sta b right semi join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null and a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
if $rows != 1 then
return -1
endi
if $data00 != 5 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data02 != 7 then
return -1
endi
if $data03 != 2 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 8 then
return -1
endi
sql select count(b.ts) from sta b right semi join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 2 then
return -1
endi
sql select count(b.col1) from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 4 then
return -1
endi
sql select count(b.ts) from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select a.tbname from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 1 then
return -1
endi
sql select count(b.*) from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql_error select a.tbname from sta b right semi join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 3 then
return -1
endi
sql select count(b.ts) from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 5 then
return -1
endi
sql select count(b.col1) from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 1 then
return -1
endi
if $data00 != 5 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 0 then
return -1
endi
sql select count(b.col1) from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 6 then
return -1
endi
sql select count(b.ts) from sta b right semi join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 1 then
return -1
endi
if $data00 != 6 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql_error select a.tbname from sta b right semi join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right semi join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right semi join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
#right anti join
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts or a.ts != b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h);
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 or a.col1 = b.col1 where a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql_error select count(*),last(a.col1) from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 where a.ts = b.ts and a.col1 > 2;
sql select count(*),count(a.col1) from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 and a.ts = b.ts and a.col1 > 2;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 2 then
return -1
endi
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta b right anti join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql select first(b.col1),count(b.t1),last(a.col1),count(*) from sta b right anti join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null and a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
if $rows != 1 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != 5 then
return -1
endi
if $data03 != 6 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 0 then
return -1
endi
sql select count(b.ts) from sta b right anti join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 6 then
return -1
endi
sql select count(b.col1) from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 4 then
return -1
endi
sql select count(b.ts) from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.tbname from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 7 then
return -1
endi
sql select count(b.*) from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql_error select a.tbname from sta b right anti join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 5 then
return -1
endi
sql select count(b.ts) from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 3 then
return -1
endi
sql select count(b.col1) from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 8 then
return -1
endi
sql select count(b.col1) from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 2 then
return -1
endi
sql select count(b.ts) from sta b right anti join sta a on a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql_error select a.tbname from sta b right anti join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right anti join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right anti join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
#right asof join
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts;
if $rows != 2 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) where a.ts = b.ts or a.ts != b.ts;
if $rows != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h);
if $rows != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 where a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 or a.col1 = b.col1 where a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.ts >= b.ts and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select count(*),last(a.col1) from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 where a.ts = b.ts and a.col1 > 2;
sql_error select count(*),count(a.col1) from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 and a.ts = b.ts and a.col1 > 2;
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta b right asof join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql_error select count(b.ts) from sta b right asof join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 8 then
return -1
endi
sql select count(b.col1) from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts where b.col1 > 1 or a.col1 > 2;
if $rows != 7 then
return -1
endi
sql_error select a.tbname from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql select a.tbname from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts where a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right asof join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts where a.col1 > 2 and b.col1 < 5;
if $rows != 3 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts where (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 5 then
return -1
endi
sql select count(b.col1) from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts where (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 1 then
return -1
endi
if $data00 != 5 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts where (a.col1 < 3 or b.col1 > 3);
if $rows != 6 then
return -1
endi
sql select count(b.ts) from sta b right asof join sta a on a.t1 = b.t1 and a.ts = b.ts where (a.col1 < 3 or b.col1 > 3);
if $rows != 1 then
return -1
endi
if $data00 != 6 then
return -1
endi
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql select a.tbname from sta b right asof join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right asof join sta a where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right asof join sta a where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
#right window join
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on timetruncate(a.ts, 1h) = timetruncate(b.ts, 1h) window_offset(-1s, 1s) where a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on timetruncate(a.ts, 1d) = timetruncate(b.ts, 1h) window_offset(-1s, 1s);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 and a.ts = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 or a.col1 = b.col1 window_offset(-1s, 1s) where a.ts = b.ts;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.ts >= b.ts and a.ts = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts window_offset(-1s, 1s);
sql_error select count(*),last(a.col1) from sta b right window join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 window_offset(-1s, 1s) where a.ts = b.ts and a.col1 > 2;
sql_error select count(*),count(a.col1) from sta b right window join sta a on (a.t1 = b.t1 or a.col1 > b.col1) and a.col1 > 1 and a.ts = b.ts and a.col1 > 2 window_offset(-1s, 1s);
sql_error select first(b.col1),count(b.t1),last(a.col1) from sta b right window join sta a on a.t1 = b.t1 and a.col1 > 1 and b.t1 is not null window_offset(-1s, 1s) where a.ts = b.ts and b.col1 > 3 and a.t1 != 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts) window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts window_offset(-1s, 1s);
sql_error select count(b.ts) from sta b right window join sta a on (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 window_offset(-1s, 1s);
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 and a.col1 = b.col1 window_offset(-1s, 1s);
if $rows != 8 then
return -1
endi
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 and b.col1 > 1 window_offset(-1s, 1s);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.col1 > 1 or a.col1 > 2;
if $rows != 13 then
return -1
endi
sql_error select a.tbname from sta b right window join sta a on a.t1 = b.t1 and a.col1 = b.col1 + 1 window_offset(-1s, 1s);
sql_error select a.tbname from sta b right window join sta a on a.t1 = b.t1 and count(a.col1) = 1;
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5 window_offset(-1s, 1s);
sql_error select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 and a.ts = b.ts window_offset(-1s, 1s) where a.col1 > 2 and b.col1 < 5;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
if $rows != 7 then
return -1
endi
sql select a.ts from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where (a.col1 < 3 or a.col1 > 4) and b.col1 is not null having(count(a.ts) > 0);
sql select a.ts from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 having(count(a.ts) > 1);
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
sql_error select a.ts from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 having(count(a.ts) > 1) order by b.col1;
sql_error select a.ts from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 having(count(a.ts) > 1) order by b.tbname;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 order by a.t1;
if $rows != 5 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data30 != 1 then
return -1
endi
if $data40 != 1 then
return -1
endi
sql_error select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 order by b.col1;
sql select count(b.col1) c from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 < 3 or a.col1 > 4 order by a.col1, c;
if $rows != 5 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data40 != 1 then
return -1
endi
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.ts > 0 and b.col1 is not null;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.ts > 0;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.tbname > 'a';
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.t1 > 1;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.col1 > 1;
sql select count(b.col1) from sta b right window join sta a on a.col1 = b.col1 window_offset(-1s, 1s) where b.col1 > 1;
sql select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) where b.tbname > 'a';
sql select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) where b.t1 > 1;
sql select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) where b.col1 > 1;
sql select count(b.col1) from tba1 b right window join sta a on a.col1 = b.col1 window_offset(-1s, 1s) where b.col1 > 1;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.tbname > 'tba1';
if $rows != 4 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(b.col1) from tba2 b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.tbname < 'tba2';
if $rows != 1 then
return -1
endi
if $data00 != 0 then
return -1
endi
sql select count(b.col1) from tba2 b right window join sta a window_offset(-1s, 1s) where b.tbname < 'tba2';
sql select count(b.col1) from tba2 b right window join sta a window_offset(-1s, 1s) where b.t1 < 2;
sql select count(b.col1) from tba2 b right window join sta a window_offset(-1s, 1s) where b.col1 < 1;
sql_error select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by b.tbname;
sql_error select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by b.col1;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by b.t1;
sql_error select count(b.col1) from sta b right window join sta a window_offset(-1s, 1s) order by b.t1;
sql select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) order by b.tbname;
sql_error select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) order by b.col1;
sql select count(b.col1) from tba1 b right window join sta a window_offset(-1s, 1s) order by b.t1;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by a.tbname, a.ts;
if $rows != 8 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data20 != 3 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data40 != 2 then
return -1
endi
if $data50 != 2 then
return -1
endi
if $data60 != 1 then
return -1
endi
if $data70 != 1 then
return -1
endi
sql select count(b.col1) from tba2 b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by b.tbname, a.ts;
if $rows != 8 then
return -1
endi
if $data00 != 0 then
return -1
endi
if $data10 != 0 then
return -1
endi
if $data20 != 0 then
return -1
endi
if $data30 != 0 then
return -1
endi
if $data40 != 2 then
return -1
endi
if $data50 != 2 then
return -1
endi
if $data60 != 1 then
return -1
endi
if $data70 != 1 then
return -1
endi
sql_error select count(b.col1), b.tbname from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s);
sql select count(b.col1), a.tbname from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s);
sql select count(b.col1), b.tbname from tba2 b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s);
sql select first(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.ts > 0;
sql select first(a.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where b.ts > 0;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.ts > 0;
sql select count(b.col1) from sta b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) where a.col1 > 0;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) and a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) or a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) and (timetruncate(a.ts, 1h) = b.ts or a.ts = b.ts);
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where (a.t1 = b.t1 or a.col1 = b.col1) and timetruncate(a.ts, 1m) = b.ts;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and b.col1 > 1;
sql select a.tbname from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and a.col1 = b.col1 + 1;
sql_error select a.tbname from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and timetruncate(a.ts, 1m) = b.ts and count(a.col1) = 1;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and a.ts = b.ts and a.col1 > 2 and b.col1 < 5;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is not null;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or a.col1 > 4) and b.col1 is null;
sql select a.ts, a.col1, b.ts, b.col1 from sta b right window join sta a window_offset(-1s, 1s) where a.t1 = b.t1 and a.ts = b.ts and (a.col1 < 3 or b.col1 > 3);
sql_error select distinct count(b.col1) from tba2 b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by b.tbname, a.ts;
sql select distinct count(b.col1) c from tba2 b right window join sta a on a.t1 = b.t1 window_offset(-1s, 1s) order by c;
if $rows != 3 then
return -1
endi
if $data00 != 0 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 2 then
return -1
endi

View File

@ -0,0 +1,672 @@
sql connect
sql use test0;
#inner join + join group
sql select sum(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1;
if $rows != 1 then
return -1
endi
if $data00 != 30 then
return -1
endi
sql_error select diff(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1;
sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1;
sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1;
if $rows != 1 then
return -1
endi
if $data00 != 7 then
return -1
endi
sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0;
if $rows != 1 then
return -1
endi
if $data00 != 7 then
return -1
endi
sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 interval(1s);
if $rows != 6 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 session(a.ts, 1s);
sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 session(b.ts, 1s);
sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 state_window(b.col1);
sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 interval(1s);
#inner join + no join group
sql select sum(a.col1) c1 from sta a join sta b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 42 then
return -1
endi
sql select diff(a.col1) c1 from tba1 a join tba2 b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts;
sql select csum(b.col1) from tba1 a join tba2 b on a.ts = b.ts;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 7 then
return -1
endi
sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts interval(1s);
if $rows != 6 then
return -1
endi
if $data00 != 4 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 4 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts session(a.ts, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 12 then
return -1
endi
sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts session(b.ts, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 12 then
return -1
endi
sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts state_window(b.col1);
#left join
sql select sum(a.col1) c1 from sta a left join sta b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 42 then
return -1
endi
sql select diff(a.col1) c1 from tba1 a left join tba2 b on a.ts = b.ts;
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
sql select diff(b.col1) c1 from tba1 a left join tba2 b on a.ts = b.ts;
if $rows != 3 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data20 != NULL then
return -1
endi
sql_error select csum(b.col1) from sta a left join sta b on a.ts = b.ts;
sql select csum(b.col1) from tba1 a left join tba2 b on a.ts = b.ts;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 7 then
return -1
endi
sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts interval(1s);
if $rows != 6 then
return -1
endi
if $data00 != 4 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 4 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts session(a.ts, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 12 then
return -1
endi
sql_error select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts session(b.ts, 1s);
sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts state_window(b.col1);
#left semi join
sql select sum(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 30 then
return -1
endi
sql select diff(a.col1) c1 from tba1 a left semi join tba2 b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql select diff(b.col1) c1 from tba1 a left semi join tba2 b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
sql_error select csum(b.col1) from sta a left semi join sta b on a.ts = b.ts;
sql select csum(b.col1) from tba1 a left semi join tba2 b on a.ts = b.ts;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 7 then
return -1
endi
sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts interval(1s);
if $rows != 6 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts session(a.ts, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 8 then
return -1
endi
sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts session(b.ts, 1s);
if $rows != 1 then
return -1
endi
if $data00 != 8 then
return -1
endi
sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts state_window(b.col1);
#left anti join
sql select sum(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select diff(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
#???????
sql select diff(b.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts;
sql select csum(b.col1) from sta a left anti join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select csum(b.col1) from tba1 a left anti join tba2 b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts interval(1s);
if $rows != 0 then
return -1
endi
sql select count(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts interval(1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
sql select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts session(a.ts, 1s);
if $rows != 0 then
return -1
endi
sql select count(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts session(a.ts, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
sql_error select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts session(b.ts, 1s);
sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts state_window(b.col1);
#left asof join + join group
sql select sum(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1;
if $rows != 1 then
return -1
endi
if $data00 != 30 then
return -1
endi
sql_error select diff(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1;
sql_error select diff(b.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1;
sql_error select csum(a.col1) from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1;
sql_error select csum(b.col1) from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1;
sql select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 interval(1s);
if $rows != 6 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 session(a.ts, 1s);
sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 session(b.ts, 1s);
sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 state_window(b.col1);
#left asof join + no join group
sql select sum(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 30 then
return -1
endi
sql_error select diff(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts;
sql select diff(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts;
if $rows != 3 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
sql select diff(b.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts;
if $rows != 3 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data10 != 0 then
return -1
endi
if $data20 != 2 then
return -1
endi
sql select csum(a.col1) from tba1 a left asof join tba2 b on a.ts > b.ts;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data20 != 8 then
return -1
endi
if $data30 != 13 then
return -1
endi
sql select csum(b.col1) from tba1 a left asof join tba2 b on a.ts > b.ts;
if $rows != 3 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 6 then
return -1
endi
if $data20 != 11 then
return -1
endi
sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts interval(1s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts session(a.ts, 1s);
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
sql_error select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts session(b.ts, 1s);
sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts state_window(b.col1);
#left win join + join group
sql select sum(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s);
if $rows != 8 then
return -1
endi
if $data00 != 4 then
return -1
endi
if $data10 != 6 then
return -1
endi
if $data20 != 5 then
return -1
endi
if $data30 != 7 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 6 then
return -1
endi
if $data60 != 12 then
return -1
endi
if $data70 != 10 then
return -1
endi
sql_error select diff(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s);
sql_error select csum(a.col1) from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s);
sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) interval(1s);
sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) session(a.ts, 1s);
sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) session(b.ts, 1s);
sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) state_window(b.col1);
#left win join + no join group
sql select sum(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) order by c1;
if $rows != 8 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data10 != 6 then
return -1
endi
if $data20 != 12 then
return -1
endi
if $data30 != 12 then
return -1
endi
if $data40 != 14 then
return -1
endi
if $data50 != 16 then
return -1
endi
if $data60 != 20 then
return -1
endi
if $data70 != 20 then
return -1
endi
sql_error select diff(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s);
sql select diff(a.col1) c1 from tba1 a left window join tba2 b window_offset(-1s, 0s);
if $rows != 0 then
return -1
endi
sql select diff(b.col1) c1 from tba1 a left window join tba2 b window_offset(-1s, 0s);
if $rows != 0 then
return -1
endi
sql select diff(b.col1) c1 from sta a left window join tba1 b window_offset(-1s, 1s);
if $rows != 7 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data30 != 1 then
return -1
endi
if $data40 != 1 then
return -1
endi
if $data50 != 1 then
return -1
endi
if $data60 != 1 then
return -1
endi
sql_error select csum(a.col1) from sta a left window join sta b window_offset(-1s, 1s);
sql_error select csum(a.col1) from tba1 a left window join tba2 b window_offset(-1s, 1s);
sql select csum(a.col1) from tba1 a left window join tba2 b window_offset(-1s, 0s);
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data20 != 4 then
return -1
endi
if $data30 != 5 then
return -1
endi
sql select csum(b.col1) from tba1 a left window join tba2 b window_offset(-1s, 1s);
if $rows != 7 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data10 != 5 then
return -1
endi
if $data20 != 3 then
return -1
endi
if $data30 != 8 then
return -1
endi
if $data40 != 5 then
return -1
endi
if $data50 != 5 then
return -1
endi
if $data60 != 12 then
return -1
endi
sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) interval(1s);
sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) session(a.ts, 1s);
sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) session(b.ts, 1s);
sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) state_window(b.col1);
#full join
sql select sum(a.col1) c1 from sta a full join sta b on a.ts = b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 42 then
return -1
endi
sql_error select diff(a.col1) c1 from tba1 a full join tba2 b on a.ts = b.ts;
sql_error select diff(b.col1) c1 from tba1 a full join tba2 b on a.ts = b.ts;
sql_error select csum(b.col1) from sta a full join sta b on a.ts = b.ts;
sql_error select csum(b.col1) from tba1 a full join tba2 b on a.ts = b.ts;
sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts interval(1s);
sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts session(a.ts, 1s);
sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts session(b.ts, 1s);
sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts state_window(b.col1);

View File

@ -0,0 +1,191 @@
sql connect
sql use test0;
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.ts
if $rows != 5 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
if $data40 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data41 != NULL then
return -1
endi
sql select a.col1, b.col1 from sta a left anti join sta b on a.ts = b.ts and a.col1 != b.col1 where a.ts < '2023-11-17 16:29:02' order by a.col1;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql select a.col1, b.col1 from sta a left anti join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, b.ts from tba1 a left anti join tba2 b on a.ts = b.ts order by a.ts;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.col1, b.col1 from tba2 a left anti join tba1 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != 7 then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.ts, b.ts from tba1 a left anti join tba2 b on a.ts = b.ts order by a.ts desc;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by a.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by b.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by a.ts desc, b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,273 @@
sql connect
sql use test0;
sql select a.col1, b.col1 from sta a left join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 10 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
if $data40 != 3 then
return -1
endi
if $data41 != NULL then
return -1
endi
if $data50 != 3 then
return -1
endi
if $data51 != NULL then
return -1
endi
if $data60 != 4 then
return -1
endi
if $data61 != NULL then
return -1
endi
if $data70 != 5 then
return -1
endi
if $data71 != NULL then
return -1
endi
if $data80 != 5 then
return -1
endi
if $data81 != NULL then
return -1
endi
if $data90 != 7 then
return -1
endi
if $data91 != NULL then
return -1
endi
sql select a.col1, b.col1 from sta a left join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a left join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.col1, b.col1 from tba1 a left join tba2 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != 4 then
return -1
endi
if $data21 != 5 then
return -1
endi
if $data30 != 5 then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.col1, b.col1 from tba2 a left join tba1 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 3 then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != 5 then
return -1
endi
if $data21 != 4 then
return -1
endi
if $data30 != 7 then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from tba2 a left join tba1 b on a.ts = b.ts order by a.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from sta a left join sta b on a.ts=b.ts order by a.ts desc;
if $rows != 12 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a left join tba2 b on a.ts=b.ts order by b.ts desc;
if $rows != 4 then
return -1
endi
if $data01 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from tba1 a left join tba2 b on a.ts=b.ts order by b.ts desc, a.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select count(*) from tba1 a left join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(a.*) from tba1 a left join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(b.*) from tba1 a left join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi

View File

@ -0,0 +1,148 @@
sql connect
sql use test0;
sql select a.ts, b.ts from sta a left semi join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.ts
if $rows != 3 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:01.000@ then
return -1
endi
sql select a.col1, b.col1 from sta a left semi join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a left semi join sta b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.col1, b.col1 from tba1 a left semi join tba2 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data11 != 5 then
return -1
endi
sql select a.col1, b.col1 from tba2 a left semi join tba1 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 5 then
return -1
endi
if $data11 != 4 then
return -1
endi
sql select a.ts, b.ts from tba1 a left semi join tba2 b on a.ts = b.ts order by a.ts desc;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from sta a left semi join sta b on a.ts = b.ts order by a.ts desc;
if $rows != 8 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a left semi join tba2 b on a.ts = b.ts order by b.ts desc;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a left semi join tba2 b on a.ts = b.ts order by b.ts desc, a.ts;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
sql_error select a.ts, b.ts from sta a left semi join sta b jlimit 3 where a.ts > b.ts;
sql_error select a.ts, b.ts from sta a left semi join sta b where a.ts > b.ts;
sql_error select a.ts, b.ts from sta a left semi join sta b on a.ts > 1 where a.ts = b.ts;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
sql connect
sql use test0;
sql select a.ts, b.ts from sta a right anti join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.ts
if $rows != 5 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data20 != NULL then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data40 != NULL then
return -1
endi
if $data41 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.col1, b.col1 from sta a right anti join sta b on a.ts = b.ts and a.col1 != b.col1 where a.ts < '2023-11-17 16:29:02' order by a.col1;
if $rows != 0 then
return -1
endi
sql select a.col1, b.col1 from sta a right anti join sta b on a.ts = b.ts and a.col1 != b.col1 where b.ts < '2023-11-17 16:29:02' order by a.col1;
if $rows != 1 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
sql select a.col1, b.col1 from sta a right anti join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, b.ts from tba1 a right anti join tba2 b on a.ts = b.ts order by a.ts;
if $rows != 2 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.col1, b.col1 from tba2 a right anti join tba1 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 5 then
return -1
endi

View File

@ -0,0 +1,476 @@
sql connect
sql use test0;
sql_error select a.col1, b.col1 from sta a right asof join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
sql select a.col1, b.col1 from sta a right asof join sta b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 8 then
return -1
endi
sql select a.col1, b.col1 from sta a right asof join sta b on a.ts >= b.ts order by a.col1, b.col1;
if $rows != 8 then
return -1
endi
sql select a.col1, b.col1 from sta a right asof join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by b.col1;
if $rows != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts = b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on b.ts = a.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts >= b.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on b.ts <= a.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts > b.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on b.ts < a.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts <= b.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on b.ts >= a.ts ;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts < b.ts ;
if $rows != 4 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on b.ts > a.ts ;
if $rows != 4 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba2 a right asof join tba1 b on a.ts >= b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba2 a right asof join tba1 b on a.ts > b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba2 a right asof join tba1 b on a.ts <= b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba2 a right asof join tba1 b on a.ts < b.ts;
if $rows != 4 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:04.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right asof join tba2 b on a.ts > b.ts jlimit 2
if $rows != 6 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data40 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data41 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data50 != NULL then
return -1
endi
if $data51 != @23-11-17 16:29:05.000@ then
return -1
endi

View File

@ -0,0 +1,181 @@
sql connect
sql use test0;
sql select a.col1, b.col1 from sta a right join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by b.col1, a.col1;
if $rows != 10 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 2 then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data21 != 2 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
if $data40 != NULL then
return -1
endi
if $data41 != 3 then
return -1
endi
if $data50 != NULL then
return -1
endi
if $data51 != 3 then
return -1
endi
if $data60 != NULL then
return -1
endi
if $data61 != 4 then
return -1
endi
if $data70 != NULL then
return -1
endi
if $data71 != 5 then
return -1
endi
if $data80 != NULL then
return -1
endi
if $data81 != 5 then
return -1
endi
if $data90 != NULL then
return -1
endi
if $data91 != 7 then
return -1
endi
sql select a.col1, b.col1 from sta a right join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a right join sta b on a.ts = b.ts;
if $rows != 12 then
return -1
endi
sql select a.col1, b.col1 from tba1 a right join tba2 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 7 then
return -1
endi
if $data20 != 1 then
return -1
endi
if $data21 != 2 then
return -1
endi
if $data30 != 4 then
return -1
endi
if $data31 != 5 then
return -1
endi
sql select a.col1, b.col1 from tba2 a right join tba1 b on a.ts = b.ts order by a.col1, b.col1;
if $rows != 4 then
return -1
endi
if $data00 != NULL then
return -1
endi
if $data01 != 3 then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != 5 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 5 then
return -1
endi
if $data31 != 4 then
return -1
endi
sql select count(*) from tba1 a right join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(a.*) from tba1 a right join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql select count(b.*) from tba1 a right join tba2 b on a.ts=b.ts;
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi

View File

@ -0,0 +1,76 @@
sql connect
sql use test0;
sql select a.ts, b.ts from sta a right semi join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:02' order by a.ts
if $rows != 3 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:01.000@ then
return -1
endi
sql select a.col1, b.col1 from sta a right semi join sta b on a.ts = b.ts where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by b.col1;
if $rows != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
sql select a.col1, b.col1 from sta a right semi join sta b on a.ts = b.ts;
if $rows != 8 then
return -1
endi
sql select a.col1, b.col1 from tba1 a right semi join tba2 b on a.ts = b.ts order by b.col1;
if $rows != 2 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data10 != 4 then
return -1
endi
if $data11 != 5 then
return -1
endi
sql select a.col1, b.col1 from tba2 a right semi join tba1 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 2 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 5 then
return -1
endi
if $data11 != 4 then
return -1
endi

View File

@ -0,0 +1,276 @@
sql connect
sql use test0;
sql_error select a.col1, b.col1 from sta a right window join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' window_offset(-1s, 1s) order by a.col1, b.col1;
sql_error select a.col1, b.col1 from sta a right window join sta b on a.ts = b.ts order by a.col1, b.col1;
sql_error select a.col1, b.col1 from sta a right window join sta b on a.ts = b.ts window_offset(-1s, 1s) order by a.col1, b.col1;
sql select a.col1, b.col1 from sta a right window join sta b window_offset(-1s, 1s) order by a.col1, b.col1;
if $rows != 28 then
return -1
endi
sql select a.col1, b.col1 from sta a right window join sta b window_offset(-1s, 1s) jlimit 2 order by a.col1, b.col1;
if $rows != 16 then
return -1
endi
sql select a.col1, b.col1 from sta a right window join sta b window_offset(1s, 1s) order by a.col1, b.col1;
if $rows != 9 then
return -1
endi
sql select a.col1, b.col1 from sta a right window join sta b window_offset(-1s, 1s) where a.ts < '2023-11-17 16:29:02' and b.ts < '2023-11-17 16:29:01' order by a.col1, b.col1;
if $rows != 6 then
return -1
endi
if $data00 != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data10 != 1 then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data20 != 2 then
return -1
endi
if $data21 != 1 then
return -1
endi
if $data30 != 2 then
return -1
endi
if $data31 != 2 then
return -1
endi
if $data40 != 3 then
return -1
endi
if $data41 != 1 then
return -1
endi
if $data50 != 3 then
return -1
endi
if $data51 != 2 then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1s, 1s)
if $rows != 7 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data40 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data41 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data50 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data51 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data60 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data61 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1s, 1s) order by b.ts desc;
if $rows != 7 then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data41 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data51 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data61 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1s, 1s) order by a.ts desc;
if $rows != 7 then
return -1
endi
if $data00 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data40 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data50 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data60 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1s, 1s) order by b.ts desc, a.ts;
if $rows != 7 then
return -1
endi
if $data00 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data40 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data41 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data50 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data51 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data60 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data61 != @23-11-17 16:29:00.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1s, 1s) jlimit 1;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1a, 1a) jlimit 1;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data01 != @23-11-17 16:29:00.000@ then
return -1
endi
if $data10 != NULL then
return -1
endi
if $data11 != @23-11-17 16:29:01.000@ then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data30 != NULL then
return -1
endi
if $data31 != @23-11-17 16:29:05.000@ then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(-1h, 1h);
if $rows != 16 then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(1h, -1h);
if $rows != 16 then
return -1
endi
sql select a.ts, b.ts from tba1 a right window join tba2 b window_offset(1a, -1h);
if $rows != 9 then
return -1
endi

View File

@ -407,7 +407,7 @@ if $data00 != 396.000000000 then
endi
# first/last
sql select count(join_mt0.c1), sum(join_mt1.c2), first(join_mt0.c5), last(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts and join_mt0.t1=1 interval(10a) order by _wstart asc;
sql select count(join_mt0.c1), sum(join_mt1.c2) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts and join_mt0.t1=1 interval(10a) order by _wstart asc;
$val = 100
if $rows != $val then
@ -426,13 +426,8 @@ if $data01 != $val then
return -1
endi
$val = 0
if $data02 != 0 then
return -1
endi
# order by first/last
sql select count(join_mt0.c1), sum(join_mt1.c2), first(join_mt0.c5), last(join_mt1.c7) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts and join_mt0.t1=1 interval(10a) order by _wstart desc;
sql select count(join_mt0.c1), sum(join_mt1.c2) from join_mt0, join_mt1 where join_mt0.t1=join_mt1.t1 and join_mt0.ts=join_mt1.ts and join_mt0.t1=1 interval(10a) order by _wstart desc;
$val = 100
if $rows != $val then

View File

@ -295,7 +295,7 @@ class TDTestCase:
"table_expr": "db.stb1 as stable1, db.stb2 as stable2",
"condition": "where stable1.ts=stable2.ts and stable1.st1=stable2.st2 order by stable1.ts"
}
tdSql.query(self.diff_query_form(**stb_join)) # stb join
tdSql.error(self.diff_query_form(**stb_join)) # stb join
interval_sql = {
"condition": "where ts>0 and ts < now interval(1h) fill(next)"
}

View File

@ -498,7 +498,7 @@ class TDTestCase:
# "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
# }
# self.checkmavg(**err44) # stb join
tdSql.query(f"select mavg( stb1.c1 , 1 ) from {dbname}.stb1 stb1, {dbname}.stb2 stb2 where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts;")
tdSql.error(f"select mavg( stb1.c1 , 1 ) from {dbname}.stb1 stb1, {dbname}.stb2 stb2 where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts;")
err45 = {
"condition": "where ts>0 and ts < now interval(1h) fill(next)"
}

View File

@ -423,16 +423,8 @@ class TDTestCase:
self.calc_select_in_not_support_ts_j = ['apercentile(t1.q_int,20)' , 'apercentile(t1.q_bigint,20)' ,'apercentile(t1.q_smallint,20)' ,'apercentile(t1.q_tinyint,20)' ,'apercentile(t1.q_float,20)' ,'apercentile(t1.q_double,20)' ,
'apercentile(t1.q_int_null,20)' , 'apercentile(t1.q_bigint_null,20)' ,'apercentile(t1.q_smallint_null,20)' ,'apercentile(t1.q_tinyint_null,20)' ,'apercentile(t1.q_float_null,20)' ,'apercentile(t1.q_double_null,20)' ,
'last_row(t1.q_int)' , 'last_row(t1.q_bigint)' , 'last_row(t1.q_smallint)' , 'last_row(t1.q_tinyint)' , 'last_row(t1.q_float)' ,
'last_row(t1.q_double)' , 'last_row(t1.q_bool)' ,'last_row(t1.q_binary)' ,'last_row(t1.q_nchar)' ,'last_row(t1.q_ts)' ,
'last_row(t1.q_int_null)' , 'last_row(t1.q_bigint_null)' , 'last_row(t1.q_smallint_null)' , 'last_row(t1.q_tinyint_null)' , 'last_row(t1.q_float_null)' ,
'last_row(t1.q_double_null)' , 'last_row(t1.q_bool_null)' ,'last_row(t1.q_binary_null)' ,'last_row(t1.q_nchar_null)' ,'last_row(t1.q_ts_null)' ,
'apercentile(t2.q_int,20)' , 'apercentile(t2.q_bigint,20)' ,'apercentile(t2.q_smallint,20)' ,'apercentile(t2.q_tinyint,20)' ,'apercentile(t2.q_float,20)' ,'apercentile(t2.q_double,20)' ,
'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' ,
'last_row(t2.q_int)' , 'last_row(t2.q_bigint)' , 'last_row(t2.q_smallint)' , 'last_row(t2.q_tinyint)' , 'last_row(t2.q_float)' ,
'last_row(t2.q_double)' , 'last_row(t2.q_bool)' ,'last_row(t2.q_binary)' ,'last_row(t2.q_nchar)' ,'last_row(t2.q_ts)',
'last_row(t2.q_int_null)' , 'last_row(t2.q_bigint_null)' , 'last_row(t2.q_smallint_null)' , 'last_row(t2.q_tinyint_null)' , 'last_row(t2.q_float_null)' ,
'last_row(t2.q_double_null)' , 'last_row(t2.q_bool_null)' ,'last_row(t2.q_binary_null)' ,'last_row(t2.q_nchar_null)' ,'last_row(t2.q_ts_null)']
'apercentile(t2.q_int_null,20)' , 'apercentile(t2.q_bigint_null,20)' ,'apercentile(t2.q_smallint_null,20)' ,'apercentile(t2.q_tinyint_null,20)' ,'apercentile(t2.q_float_null,20)' ,'apercentile(t2.q_double_null,20)' ]
self.calc_select_in_j = ['min(t1.q_int)' , 'min(t1.q_bigint)' , 'min(t1.q_smallint)' , 'min(t1.q_tinyint)' , 'min(t1.q_float)' ,'min(t1.q_double)' ,
'max(t1.q_int)' , 'max(t1.q_bigint)' , 'max(t1.q_smallint)' , 'max(t1.q_tinyint)' ,'max(t1.q_float)' ,'max(t1.q_double)' ,
@ -1385,8 +1377,19 @@ class TDTestCase:
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) :
sql = "select count(asct1) from ( select "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += "and %s " % random.choice(self.t_u_where)
sql += "and %s " % random.choice(self.t_u_or_where)
sql += "%s " % random.choice(self.limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
elif (mathlist == ['TAIL']) or (mathlist == ['SAMPLE']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) :
sql = "select count(asct1) from ( select "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
@ -1399,7 +1402,7 @@ class TDTestCase:
tdLog.info(len(sql))
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
self.explain_sql(sql)
self.restartDnodes()
tdSql.query("select 1-10 as math_nest from stable_1 limit 1;")
@ -1628,9 +1631,7 @@ class TDTestCase:
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
sql = "select count(asct1) from ( select "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "
@ -3345,9 +3346,7 @@ class TDTestCase:
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
tdSql.error(sql)
self.restartDnodes()
tdSql.query("select 1-10 as time_nest from stable_1 limit 1;")
@ -3700,9 +3699,7 @@ class TDTestCase:
sql = "select asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select "
sql += "%s as asct2, " % time_fun_join_1
sql += "%s as asct1 " % time_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "
@ -4852,8 +4849,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(self.calc_calculate_regular_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += ") "
sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
@ -5213,8 +5209,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "limit 2 ) "
sql += "%s " % random.choice(self.limit1_where)
tdLog.info(sql)
@ -5588,9 +5583,7 @@ class TDTestCase:
sql += ") "
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
tdSql.error(sql)
tdSql.query("select 18-7 from stable_1;")
for i in range(self.fornum):

View File

@ -1239,8 +1239,7 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['SAMPLE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) or (mathlist == ['UNIQUE']) or (mathlist == ['TAIL']) :
sql = "select /*+ para_tables_sort() */ %s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
@ -1250,6 +1249,15 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['CSUM']) or (mathlist == ['MAVG']) or (mathlist == ['statecount','stateduration']) :
sql = "select /*+ para_tables_sort() */ %s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += "and %s " % random.choice(self.t_u_where)
sql += "and %s " % random.choice(self.t_u_or_where)
sql += "%s " % random.choice(self.limit1_where)
tdLog.info(sql)
tdSql.error(sql)
tdSql.query("select /*+ para_tables_sort() */1-10 as math_nest from stable_1 limit 1;")
for i in range(self.fornum):
@ -1441,8 +1449,19 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) :
sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "
sql += "%s ;" % random.choice(self.limit_u_where)
tdLog.info(sql)
tdSql.error(sql)
elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) :
sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
@ -3025,8 +3044,7 @@ class TDTestCase:
sql += "%s " % random.choice(self.limit1_where)
sql += ") ;"
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
tdSql.error(sql)
tdSql.query("select /*+ para_tables_sort() */1-10 as time_nest from stable_1 limit 1;")
@ -3343,9 +3361,7 @@ class TDTestCase:
sql = "select /*+ para_tables_sort() */ asct1,(now()),(now()),asct2 ,now(),today(),timezone() from ( select /*+ para_tables_sort() */"
sql += "%s as asct2, " % time_fun_join_1
sql += "%s as asct1 " % time_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "

View File

@ -1385,8 +1385,7 @@ class TDTestCase:
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['UNIQUE']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) :
sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
@ -1400,6 +1399,19 @@ class TDTestCase:
tdSql.query(sql)
self.cur1.execute(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) \
or (mathlist == ['statecount','stateduration']) :
sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += "and %s " % random.choice(self.t_u_where)
sql += "and %s " % random.choice(self.t_u_or_where)
sql += "%s " % random.choice(self.limit1_where)
sql += ") ;"
tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
self.restartDnodes()
tdSql.query("select /*+ para_tables_sort() */1-10 as math_nest from stable_1 limit 1;")
@ -1628,9 +1640,7 @@ class TDTestCase:
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
sql = "select /*+ para_tables_sort() */ count(asct1) from ( select /*+ para_tables_sort() */ "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "

View File

@ -1239,8 +1239,7 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE'])or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['HISTOGRAM']) or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['MODE']) or (mathlist == ['UNIQUE']) :
sql = "select %s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
@ -1250,6 +1249,15 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) or (mathlist == ['statecount','stateduration']) :
sql = "select %s as asct1 " % math_fun_join_2
sql += "from stable_1 t1 , stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += "and %s " % random.choice(self.t_u_where)
sql += "and %s " % random.choice(self.t_u_or_where)
sql += "%s " % random.choice(self.limit1_where)
tdLog.info(sql)
tdSql.error(sql)
tdSql.query("select 1-10 as math_nest from stable_1 limit 1;")
for i in range(self.fornum):
@ -1441,8 +1449,8 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['CSUM']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) or (mathlist == ['statecount','stateduration']) :
elif (mathlist == ['SAMPLE']) or (mathlist == ['TAIL']) or (mathlist == ['HISTOGRAM']) \
or (mathlist == ['HYPERLOGLOG']) or (mathlist == ['UNIQUE']) or (mathlist == ['MODE']) :
sql = "select count(asct1) from ( select "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
@ -1455,6 +1463,20 @@ class TDTestCase:
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
elif (mathlist == ['MAVG']) or (mathlist == ['CSUM']) \
or (mathlist == ['statecount','stateduration']) :
sql = "select count(asct1) from ( select "
sql += "%s as asct1 " % math_fun_join_2
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "%s " % random.choice(self.partiton_where_j)
sql += "%s " % random.choice(self.slimit1_where)
sql += ") "
sql += "%s ;" % random.choice(self.limit_u_where)
tdLog.info(sql)
tdSql.error(sql)
#taos -f sql
# startTime_taosf = time.time()
@ -3025,8 +3047,7 @@ class TDTestCase:
sql += "%s " % random.choice(self.limit1_where)
sql += ") ;"
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
tdSql.error(sql)
tdSql.query("select 1-10 as time_nest from stable_1 limit 1;")
@ -3351,8 +3372,7 @@ class TDTestCase:
sql += ") "
sql += "%s ;" % random.choice(self.limit_u_where)
tdLog.info(sql)
tdSql.query(sql)
self.explain_sql(sql)
tdSql.error(sql)
#taos -f sql
startTime_taos_f = time.time()
@ -3796,9 +3816,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(self.calc_select_in_not_support_ts_j)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " and %s " % random.choice(self.qt_u_or_where)
sql += "from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.limit1_where)
sql += ") ;"
tdLog.info(sql)
@ -3924,8 +3942,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s " % random.choice(self.calc_calculate_regular_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.partiton_where_j)
sql += ") "
sql += "%s " % random.choice([self.limit_where[2] , self.limit_where[3]] )
@ -4044,9 +4061,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc15_2 " % random.choice(self.calc_aggregate_regular_j)
sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.q_u_where)
sql += "%s " % random.choice(self.group_where_regular_j)
sql += "from regular_table_1 t1, regular_table_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.limit_u_where)
sql += ") "
sql += "%s ;" % random.choice(self.limit_u_where)
@ -4093,8 +4108,7 @@ class TDTestCase:
sql += "%s as calc15_1, " % random.choice(self.calc_aggregate_groupbytbname_j)
sql += "%s as calc15_2, " % random.choice(self.calc_aggregate_groupbytbname_j)
sql += "%s " % random.choice(self.calc_aggregate_groupbytbname_j)
sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " as calc15_3 from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.group_only_where_j)
sql += "%s " % random.choice(self.having_support_j)
sql += ") "
@ -4234,8 +4248,7 @@ class TDTestCase:
for i in range(self.fornum):
sql = "select * from ( select "
sql += "%s as calc16_1 " % random.choice(self.calc_calculate_groupbytbname_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "limit 2 ) "
sql += "%s " % random.choice(self.limit1_where)
tdLog.info(sql)
@ -4547,8 +4560,7 @@ class TDTestCase:
sql = "select apercentile(cal18_1, %d)/1000 ,apercentile(cal18_2, %d)*10+%d from ( select " %(random.randint(0,100) , random.randint(0,100) ,random.randint(-1000,1000))
sql += "%s as cal18_1 ," % random.choice(self.calc_aggregate_all_j)
sql += "%s as cal18_2 " % random.choice(self.calc_aggregate_all_j)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts and "
sql += "%s " % random.choice(self.t_join_where)
sql += " from stable_1 t1, stable_2 t2 where t1.ts = t2.ts "
sql += "%s " % random.choice(self.session_u_where)
sql += "%s " % random.choice(self.limit_u_where)
sql += ") "

View File

@ -124,11 +124,13 @@ class TDTestCase:
tdSql.query(f"select a.* from sta a ,stb b where a.ts=b.ts and a.ts is not null;")
tdSql.checkRows(48)
tdSql.query(f"select a.* from sta a join stb b on a.ts=b.ts where a.tg1=b.tg1 or a.tg2=b.tg2;"); #!!!!it works now
tdSql.checkRows(18)
# tdSql.checkData(0,1,10)
tdSql.error(f"select a.* from sta a join stb b on a.tg1=b.tg1 where a.ts=b.ts or a.tg2=b.tg2;")
tdSql.error(f"select b.* from sta a, stb b where a.tg1=b.tg1 or a.ts=b.ts;")
tdSql.error(f"select a.* from sta a join stb b on a.ts=b.ts where a.tg1=b.tg1 or a.tg2=b.tg2;"); #!!!!make it work
def stop(self):
tdSql.close()

View File

@ -413,16 +413,12 @@ class TDTestCase:
tdSql.checkData(1,0,1)
tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 group by c2);")
tdSql.checkRows(1)
tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 partition by c2);")
tdSql.checkRows(1)
tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 order by c2);")
tdSql.checkRows(1)
tdSql.query(f"select tail(a, 1) from (select _rowts, first(c2) as a from {dbname}.ct1 union select _rowts, first(c2) as a from {dbname}.ct1);")
tdSql.checkRows(1)
def check_boundary_values(self, dbname="bound_test"):

View File

@ -253,8 +253,8 @@ class TDTestCase:
tdSql.checkRows(1)
tdSql.checkData(0, 0, 0)
tdSql.error(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.error(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.query(f"select first(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.query(f"select last(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.error(f"select irate(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.error(f"select elapsed(ts) from (select * from {dbname}.t1 union select * from {dbname}.t1)")
tdSql.error(f"select diff(c1) from (select * from {dbname}.t1 union select * from {dbname}.t1)")

View File

@ -386,6 +386,7 @@ if __name__ == "__main__":
if res[i][0] == "queryPolicy" :
if int(res[i][1]) == int(queryPolicy):
tdLog.info(f'alter queryPolicy to {queryPolicy} successfully')
cursor.close()
else:
tdLog.debug(res)
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
@ -443,6 +444,7 @@ if __name__ == "__main__":
if res[i][0] == "queryPolicy" :
if int(res[i][1]) == int(queryPolicy):
tdLog.info(f'alter queryPolicy to {queryPolicy} successfully')
cursor.close()
else:
tdLog.debug(res)
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
@ -566,6 +568,7 @@ if __name__ == "__main__":
if res[i][0] == "queryPolicy" :
if int(res[i][1]) == int(queryPolicy):
tdLog.info(f'alter queryPolicy to {queryPolicy} successfully')
cursor.close()
else:
tdLog.debug(res)
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
@ -631,6 +634,7 @@ if __name__ == "__main__":
if res[i][0] == "queryPolicy" :
if int(res[i][1]) == int(queryPolicy):
tdLog.info(f'alter queryPolicy to {queryPolicy} successfully')
cursor.close()
else:
tdLog.debug(res)
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")

View File

@ -730,6 +730,10 @@ bool shellIsShowWhole(const char *sql) {
if (taosStrCaseStr(sql, "show ") != NULL) {
return true;
}
// explain
if (taosStrCaseStr(sql, "explain ") != NULL) {
return true;
}
return false;
}

View File

@ -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,