From 2a395670bde9ac81cf96e00f8d07cd486a3eec4d Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 9 Sep 2020 13:24:07 +0800 Subject: [PATCH] [td-1369] --- src/client/src/tscSQLParser.c | 37 ++- src/client/src/tscUtil.c | 5 +- src/inc/taoserror.h | 2 +- src/query/inc/qAst.h | 1 + src/query/inc/sql.y | 80 ++--- src/query/src/qAst.c | 36 ++- src/query/src/qExecutor.c | 5 +- src/query/src/qFilterfunc.c | 81 +++++ src/query/src/qParserImpl.c | 5 + src/query/src/sql.c | 548 +++++++++++++++++----------------- src/tsdb/src/tsdbRead.c | 14 +- 11 files changed, 475 insertions(+), 339 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 75d21fd9eb..adb6bfccbc 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2784,6 +2784,12 @@ static int32_t doExtractColumnFilterInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, case TK_LIKE: pColumnFilter->lowerRelOptr = TSDB_RELATION_LIKE; break; + case TK_ISNULL: + pColumnFilter->lowerRelOptr = TSDB_RELATION_ISNULL; + break; + case TK_NOTNULL: + pColumnFilter->lowerRelOptr = TSDB_RELATION_NOTNULL; + break; default: return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); } @@ -2829,19 +2835,19 @@ static int32_t tSQLExprNodeToString(tSQLExpr* pExpr, char** str) { return TSDB_CODE_SUCCESS; } +// pExpr->nSQLOptr == 0 while handling "is null" query static bool isExprLeafNode(tSQLExpr* pExpr) { return (pExpr->pRight == NULL && pExpr->pLeft == NULL) && - (pExpr->nSQLOptr == TK_ID || (pExpr->nSQLOptr >= TK_BOOL && pExpr->nSQLOptr <= TK_NCHAR) || - pExpr->nSQLOptr == TK_SET); + (pExpr->nSQLOptr == 0 || pExpr->nSQLOptr == TK_ID || (pExpr->nSQLOptr >= TK_BOOL && pExpr->nSQLOptr <= TK_NCHAR) || pExpr->nSQLOptr == TK_SET); } -static bool isExprDirectParentOfLeaftNode(tSQLExpr* pExpr) { +static bool isExprDirectParentOfLeafNode(tSQLExpr* pExpr) { return (pExpr->pLeft != NULL && pExpr->pRight != NULL) && (isExprLeafNode(pExpr->pLeft) && isExprLeafNode(pExpr->pRight)); } static int32_t tSQLExprLeafToString(tSQLExpr* pExpr, bool addParentheses, char** output) { - if (!isExprDirectParentOfLeaftNode(pExpr)) { + if (!isExprDirectParentOfLeafNode(pExpr)) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -3052,7 +3058,7 @@ static int32_t getTagCondString(tSQLExpr* pExpr, char** str) { return TSDB_CODE_SUCCESS; } - if (!isExprDirectParentOfLeaftNode(pExpr)) { + if (!isExprDirectParentOfLeafNode(pExpr)) { *(*str) = '('; *str += 1; @@ -3108,7 +3114,7 @@ static int32_t getColumnQueryCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQ return TSDB_CODE_SUCCESS; } - if (!isExprDirectParentOfLeaftNode(pExpr)) { // internal node + if (!isExprDirectParentOfLeafNode(pExpr)) { // internal node int32_t ret = getColumnQueryCondInfo(pCmd, pQueryInfo, pExpr->pLeft, pExpr->nSQLOptr); if (ret != TSDB_CODE_SUCCESS) { return ret; @@ -3134,7 +3140,7 @@ static int32_t getJoinCondInfo(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr* return TSDB_CODE_SUCCESS; } - if (!isExprDirectParentOfLeaftNode(pExpr)) { + if (!isExprDirectParentOfLeafNode(pExpr)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -3453,7 +3459,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQL return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } - assert(isExprDirectParentOfLeaftNode(*pExpr)); + assert(isExprDirectParentOfLeafNode(*pExpr)); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, index.tableIndex); STableMeta* pTableMeta = pTableMetaInfo->pTableMeta; @@ -3499,7 +3505,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQL } } - // in case of in operator, keep it in a seperate attribute + // in case of in operator, keep it in a seprate attribute if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) { if (!validTableNameOptr(*pExpr)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg7); @@ -3520,7 +3526,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQL *type = TSQL_EXPR_TBNAME; *pExpr = NULL; } else { - if (pRight->nSQLOptr == TK_ID) { // join on tag columns for stable query + if (pRight != NULL && pRight->nSQLOptr == TK_ID) { // join on tag columns for stable query if (!validateJoinExprNode(pCmd, pQueryInfo, *pExpr, &index)) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -3573,7 +3579,7 @@ int32_t getQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLExpr** pExpr int32_t leftType = -1; int32_t rightType = -1; - if (!isExprDirectParentOfLeaftNode(*pExpr)) { + if (!isExprDirectParentOfLeafNode(*pExpr)) { int32_t ret = getQueryCondExpr(pCmd, pQueryInfo, &(*pExpr)->pLeft, pCondExpr, &leftType, (*pExpr)->nSQLOptr); if (ret != TSDB_CODE_SUCCESS) { return ret; @@ -3635,7 +3641,7 @@ static void doCompactQueryExpr(tSQLExpr** pExpr) { } static void doExtractExprForSTable(SSqlCmd* pCmd, tSQLExpr** pExpr, SQueryInfo* pQueryInfo, tSQLExpr** pOut, int32_t tableIndex) { - if (isExprDirectParentOfLeaftNode(*pExpr)) { + if (isExprDirectParentOfLeafNode(*pExpr)) { tSQLExpr* pLeft = (*pExpr)->pLeft; SColumnIndex index = COLUMN_INDEX_INITIALIZER; @@ -3794,7 +3800,7 @@ static int32_t getTimeRangeFromExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSQLE return TSDB_CODE_SUCCESS; } - if (!isExprDirectParentOfLeaftNode(pExpr)) { + if (!isExprDirectParentOfLeafNode(pExpr)) { if (pExpr->nSQLOptr == TK_OR) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } @@ -6215,6 +6221,11 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS return ret; } } + + if (pSqlExpr->pLeft == NULL && pSqlExpr->pRight == NULL && pSqlExpr->nSQLOptr == 0) { + *pExpr = calloc(1, sizeof(tExprNode)); + return TSDB_CODE_SUCCESS; + } if (pSqlExpr->pLeft == NULL) { if (pSqlExpr->nSQLOptr >= TK_BOOL && pSqlExpr->nSQLOptr <= TK_STRING) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 80e3828c9d..ad87825e34 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -1531,9 +1531,10 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo) { pQueryInfo->fieldsInfo.pSupportInfo = taosArrayInit(4, sizeof(SFieldSupInfo)); assert(pQueryInfo->exprList == NULL); - pQueryInfo->exprList = taosArrayInit(4, POINTER_BYTES); - pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES); + pQueryInfo->exprList = taosArrayInit(4, POINTER_BYTES); + pQueryInfo->colList = taosArrayInit(4, POINTER_BYTES); pQueryInfo->udColumnId = TSDB_UD_COLUMN_INDEX; + pQueryInfo->window = TSWINDOW_INITIALIZER; } int32_t tscAddSubqueryInfo(SSqlCmd* pCmd) { diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index d8e5c8f1d7..3198d6d97e 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -98,7 +98,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_ACTION_IN_PROGRESS, 0, 0x0212, "Action in TAOS_DEFINE_ERROR(TSDB_CODE_TSC_DISCONNECTED, 0, 0x0213, "Disconnected from service") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_NO_WRITE_AUTH, 0, 0x0214, "No write permission") TAOS_DEFINE_ERROR(TSDB_CODE_TSC_CONN_KILLED, 0, 0x0215, "Connection killed") -TAOS_DEFINE_ERROR(TSDB_CODE_TSC_SQL_SYNTAX_ERROR, 0, 0x0216, "Syntax errr in SQL") +TAOS_DEFINE_ERROR(TSDB_CODE_TSC_SQL_SYNTAX_ERROR, 0, 0x0216, "Syntax error in SQL") // mnode TAOS_DEFINE_ERROR(TSDB_CODE_MND_MSG_NOT_PROCESSED, 0, 0x0300, "Message not processed") diff --git a/src/query/inc/qAst.h b/src/query/inc/qAst.h index 547616dee6..d3e60c21dc 100644 --- a/src/query/inc/qAst.h +++ b/src/query/inc/qAst.h @@ -32,6 +32,7 @@ struct tExprNode; struct SSchema; enum { + TSQL_NODE_DUMMY = 0x0, TSQL_NODE_EXPR = 0x1, TSQL_NODE_COL = 0x2, TSQL_NODE_VALUE = 0x4, diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index 79aec2f349..e0dd9d98f0 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -567,53 +567,53 @@ where_opt(A) ::= WHERE expr(X). {A = X;} %type expr {tSQLExpr*} %destructor expr {tSQLExprDestroy($$);} -expr(A) ::= LP expr(X) RP. {A = X; } +expr(A) ::= LP expr(X) RP. {A = X; } -expr(A) ::= ID(X). {A = tSQLExprIdValueCreate(&X, TK_ID);} -expr(A) ::= ID(X) DOT ID(Y). {X.n += (1+Y.n); A = tSQLExprIdValueCreate(&X, TK_ID);} -expr(A) ::= ID(X) DOT STAR(Y). {X.n += (1+Y.n); A = tSQLExprIdValueCreate(&X, TK_ALL);} +expr(A) ::= ID(X). {A = tSQLExprIdValueCreate(&X, TK_ID);} +expr(A) ::= ID(X) DOT ID(Y). {X.n += (1+Y.n); A = tSQLExprIdValueCreate(&X, TK_ID);} +expr(A) ::= ID(X) DOT STAR(Y). {X.n += (1+Y.n); A = tSQLExprIdValueCreate(&X, TK_ALL);} -expr(A) ::= INTEGER(X). {A = tSQLExprIdValueCreate(&X, TK_INTEGER);} +expr(A) ::= INTEGER(X). {A = tSQLExprIdValueCreate(&X, TK_INTEGER);} expr(A) ::= MINUS(X) INTEGER(Y). {X.n += Y.n; X.type = TK_INTEGER; A = tSQLExprIdValueCreate(&X, TK_INTEGER);} expr(A) ::= PLUS(X) INTEGER(Y). {X.n += Y.n; X.type = TK_INTEGER; A = tSQLExprIdValueCreate(&X, TK_INTEGER);} -expr(A) ::= FLOAT(X). {A = tSQLExprIdValueCreate(&X, TK_FLOAT);} -expr(A) ::= MINUS(X) FLOAT(Y). {X.n += Y.n; X.type = TK_FLOAT; A = tSQLExprIdValueCreate(&X, TK_FLOAT);} -expr(A) ::= PLUS(X) FLOAT(Y). {X.n += Y.n; X.type = TK_FLOAT; A = tSQLExprIdValueCreate(&X, TK_FLOAT);} -expr(A) ::= STRING(X). {A = tSQLExprIdValueCreate(&X, TK_STRING);} -expr(A) ::= NOW(X). {A = tSQLExprIdValueCreate(&X, TK_NOW); } -expr(A) ::= VARIABLE(X). {A = tSQLExprIdValueCreate(&X, TK_VARIABLE);} -expr(A) ::= BOOL(X). {A = tSQLExprIdValueCreate(&X, TK_BOOL);} -// normal functions: min(x) -expr(A) ::= ID(X) LP exprlist(Y) RP(E). { - A = tSQLExprCreateFunction(Y, &X, &E, X.type); -} - -// this is for: count(*)/first(*)/last(*) operation -expr(A) ::= ID(X) LP STAR RP(Y). { - A = tSQLExprCreateFunction(NULL, &X, &Y, X.type); -} - -//binary expression: a+2, b+3 -expr(A) ::= expr(X) AND expr(Y). {A = tSQLExprCreate(X, Y, TK_AND);} -expr(A) ::= expr(X) OR expr(Y). {A = tSQLExprCreate(X, Y, TK_OR); } - -//binary relational expression -expr(A) ::= expr(X) LT expr(Y). {A = tSQLExprCreate(X, Y, TK_LT);} -expr(A) ::= expr(X) GT expr(Y). {A = tSQLExprCreate(X, Y, TK_GT);} -expr(A) ::= expr(X) LE expr(Y). {A = tSQLExprCreate(X, Y, TK_LE);} -expr(A) ::= expr(X) GE expr(Y). {A = tSQLExprCreate(X, Y, TK_GE);} -expr(A) ::= expr(X) NE expr(Y). {A = tSQLExprCreate(X, Y, TK_NE);} -expr(A) ::= expr(X) EQ expr(Y). {A = tSQLExprCreate(X, Y, TK_EQ);} - -//binary arithmetic expression +expr(A) ::= FLOAT(X). {A = tSQLExprIdValueCreate(&X, TK_FLOAT);} +expr(A) ::= MINUS(X) FLOAT(Y). {X.n += Y.n; X.type = TK_FLOAT; A = tSQLExprIdValueCreate(&X, TK_FLOAT);} +expr(A) ::= PLUS(X) FLOAT(Y). {X.n += Y.n; X.type = TK_FLOAT; A = tSQLExprIdValueCreate(&X, TK_FLOAT);} +expr(A) ::= STRING(X). {A = tSQLExprIdValueCreate(&X, TK_STRING);} +expr(A) ::= NOW(X). {A = tSQLExprIdValueCreate(&X, TK_NOW); } +expr(A) ::= VARIABLE(X). {A = tSQLExprIdValueCreate(&X, TK_VARIABLE);} +expr(A) ::= BOOL(X). {A = tSQLExprIdValueCreate(&X, TK_BOOL);} + +// ordinary functions: min(x), max(x), top(k, 20) +expr(A) ::= ID(X) LP exprlist(Y) RP(E). { A = tSQLExprCreateFunction(Y, &X, &E, X.type); } + +// for parsing sql functions with wildcard for parameters. e.g., count(*)/first(*)/last(*) operation +expr(A) ::= ID(X) LP STAR RP(Y). { A = tSQLExprCreateFunction(NULL, &X, &Y, X.type); } + +// is (not) null expression +expr(A) ::= expr(X) IS NULL. {A = tSQLExprCreate(X, NULL, TK_ISNULL);} +expr(A) ::= expr(X) IS NOT NULL. {A = tSQLExprCreate(X, NULL, TK_NOTNULL);} + +// relational expression +expr(A) ::= expr(X) LT expr(Y). {A = tSQLExprCreate(X, Y, TK_LT);} +expr(A) ::= expr(X) GT expr(Y). {A = tSQLExprCreate(X, Y, TK_GT);} +expr(A) ::= expr(X) LE expr(Y). {A = tSQLExprCreate(X, Y, TK_LE);} +expr(A) ::= expr(X) GE expr(Y). {A = tSQLExprCreate(X, Y, TK_GE);} +expr(A) ::= expr(X) NE expr(Y). {A = tSQLExprCreate(X, Y, TK_NE);} +expr(A) ::= expr(X) EQ expr(Y). {A = tSQLExprCreate(X, Y, TK_EQ);} + +expr(A) ::= expr(X) AND expr(Y). {A = tSQLExprCreate(X, Y, TK_AND);} +expr(A) ::= expr(X) OR expr(Y). {A = tSQLExprCreate(X, Y, TK_OR); } + +// binary arithmetic expression expr(A) ::= expr(X) PLUS expr(Y). {A = tSQLExprCreate(X, Y, TK_PLUS); } expr(A) ::= expr(X) MINUS expr(Y). {A = tSQLExprCreate(X, Y, TK_MINUS); } expr(A) ::= expr(X) STAR expr(Y). {A = tSQLExprCreate(X, Y, TK_STAR); } expr(A) ::= expr(X) SLASH expr(Y). {A = tSQLExprCreate(X, Y, TK_DIVIDE);} expr(A) ::= expr(X) REM expr(Y). {A = tSQLExprCreate(X, Y, TK_REM); } -//like expression -expr(A) ::= expr(X) LIKE expr(Y). {A = tSQLExprCreate(X, Y, TK_LIKE); } +// like expression +expr(A) ::= expr(X) LIKE expr(Y). {A = tSQLExprCreate(X, Y, TK_LIKE); } //in expression expr(A) ::= expr(X) IN LP exprlist(Y) RP. {A = tSQLExprCreate(X, (tSQLExpr*)Y, TK_IN); } @@ -625,9 +625,9 @@ expr(A) ::= expr(X) IN LP exprlist(Y) RP. {A = tSQLExprCreate(X, (tSQLExpr*)Y, %destructor expritem {tSQLExprDestroy($$);} exprlist(A) ::= exprlist(X) COMMA expritem(Y). {A = tSQLExprListAppend(X,Y,0);} -exprlist(A) ::= expritem(X). {A = tSQLExprListAppend(0,X,0);} -expritem(A) ::= expr(X). {A = X;} -expritem(A) ::= . {A = 0;} +exprlist(A) ::= expritem(X). {A = tSQLExprListAppend(0,X,0);} +expritem(A) ::= expr(X). {A = X;} +expritem(A) ::= . {A = 0;} ///////////////////////////////////reset query cache////////////////////////////////////// cmd ::= RESET QUERY CACHE. { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} diff --git a/src/query/src/qAst.c b/src/query/src/qAst.c index 634f014d97..63411aaf3f 100644 --- a/src/query/src/qAst.c +++ b/src/query/src/qAst.c @@ -188,6 +188,10 @@ uint8_t getBinaryExprOptr(SStrToken *pToken) { return TSDB_BINARY_OP_REMAINDER; case TK_LIKE: return TSDB_RELATION_LIKE; + case TK_ISNULL: + return TSDB_RELATION_ISNULL; + case TK_NOTNULL: + return TSDB_RELATION_NOTNULL; default: { return 0; } } } @@ -486,29 +490,42 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr } else { int32_t optr = cond.end ? cond.end->optr : TSDB_RELATION_INVALID; if (optr == TSDB_RELATION_LESS || optr == TSDB_RELATION_LESS_EQUAL) { - bool comp = true; + bool comp = true; int32_t ret = 0; - - while(tSkipListIterNext(iter)) { - SSkipListNode* pNode = tSkipListIterGet(iter); - + + while (tSkipListIterNext(iter)) { + SSkipListNode *pNode = tSkipListIterGet(iter); + if (comp) { ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.end->v); assert(ret <= 0); } - + if (ret == 0 && optr == TSDB_RELATION_LESS) { continue; } else { - STableKeyInfo info = {.pTable = *(void**)SL_GET_NODE_DATA(pNode), .lastKey = TSKEY_INITIAL_VAL}; + STableKeyInfo info = {.pTable = *(void **)SL_GET_NODE_DATA(pNode), .lastKey = TSKEY_INITIAL_VAL}; taosArrayPush(result, &info); comp = false; // no need to compare anymore } } + } else { + assert(pQueryInfo->optr == TSDB_RELATION_ISNULL || pQueryInfo->optr == TSDB_RELATION_NOTNULL); + + while (tSkipListIterNext(iter)) { + SSkipListNode *pNode = tSkipListIterGet(iter); + + bool isnull = isNull(SL_GET_NODE_KEY(pSkipList, pNode), pQueryInfo->sch.type); + if ((pQueryInfo->optr == TSDB_RELATION_ISNULL && isnull) || + (pQueryInfo->optr == TSDB_RELATION_NOTNULL && (!isnull))) { + STableKeyInfo info = {.pTable = *(void **)SL_GET_NODE_DATA(pNode), .lastKey = TSKEY_INITIAL_VAL}; + taosArrayPush(result, &info); + } + } } } - free(cond.start); + free(cond.start); free(cond.end); tSkipListDestroyIter(iter); } @@ -683,6 +700,7 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, char * pData = SL_GET_NODE_DATA(pNode); tstr *name = (tstr*) tsdbGetTableName(*(void**) pData); + // todo speed up by using hash if (pQueryInfo->sch.colId == TSDB_TBNAME_COLUMN_INDEX) { if (pQueryInfo->optr == TSDB_RELATION_IN) { @@ -714,7 +732,7 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S // column project if (pLeft->nodeType != TSQL_NODE_EXPR && pRight->nodeType != TSQL_NODE_EXPR) { - assert(pLeft->nodeType == TSQL_NODE_COL && pRight->nodeType == TSQL_NODE_VALUE); + assert(pLeft->nodeType == TSQL_NODE_COL && (pRight->nodeType == TSQL_NODE_VALUE || pRight->nodeType == TSQL_NODE_DUMMY)); param->setupInfoFn(pExpr, param->pExtInfo); if (pSkipList == NULL) { diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 37fe302d43..2ca2545818 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -200,9 +200,6 @@ bool doFilterData(SQuery *pQuery, int32_t elemPos) { SSingleColumnFilterInfo *pFilterInfo = &pQuery->pFilterInfo[k]; char *pElem = (char*)pFilterInfo->pData + pFilterInfo->info.bytes * elemPos; - if (isNull(pElem, pFilterInfo->info.type)) { - return false; - } bool qualified = false; for (int32_t j = 0; j < pFilterInfo->numOfFilters; ++j) { @@ -1002,7 +999,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis * } int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQuery->order.order); - if (QUERY_IS_INTERVAL_QUERY(pQuery)/* && tsCols != NULL*/) { + if (QUERY_IS_INTERVAL_QUERY(pQuery)) { TSKEY ts = TSKEY_INITIAL_VAL; if (tsCols == NULL) { diff --git a/src/query/src/qFilterfunc.c b/src/query/src/qFilterfunc.c index 7e9f5c7da5..6b88171e71 100644 --- a/src/query/src/qFilterfunc.c +++ b/src/query/src/qFilterfunc.c @@ -284,6 +284,71 @@ bool nequal_nchar(SColumnFilterElem *pFilter, char* minval, char *maxval) { return wcsncmp((wchar_t *)pFilter->filterInfo.pz, varDataVal(minval), varDataLen(minval)/TSDB_NCHAR_SIZE) != 0; } +//////////////////////////////////////////////////////////////// +bool isNull_i8(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_TINYINT); +} + +bool isNull_i16(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_SMALLINT); +} + +bool isNull_i32(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_INT); +} + +bool isNull_i64(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_BIGINT); +} + +bool isNull_ds(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_FLOAT); +} + +bool isNull_dd(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_DOUBLE); +} + +bool isNull_binary(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_BINARY); +} + +bool isNull_nchar(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_NCHAR); +} + +//////////////////////////////////////////////////////////////// +bool notNull_i8(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_TINYINT); +} + +bool notNull_i16(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_SMALLINT); +} + +bool notNull_i32(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_INT); +} + +bool notNull_i64(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_BIGINT); +} + +bool notNull_ds(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_FLOAT); +} + +bool notNull_dd(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return isNull(minval, TSDB_DATA_TYPE_DOUBLE); +} + +bool notNull_binary(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_BINARY); +} + +bool notNull_nchar(SColumnFilterElem *pFilter, char* minval, char *maxval) { + return !isNull(minval, TSDB_DATA_TYPE_NCHAR); +} //////////////////////////////////////////////////////////////// @@ -398,6 +463,8 @@ bool (*filterFunc_i8[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_i8, nequal_i8, NULL, + isNull_i8, + notNull_i8, }; bool (*filterFunc_i16[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { @@ -409,6 +476,8 @@ bool (*filterFunc_i16[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_i16, nequal_i16, NULL, + isNull_i16, + notNull_i16, }; bool (*filterFunc_i32[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { @@ -420,6 +489,8 @@ bool (*filterFunc_i32[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_i32, nequal_i32, NULL, + isNull_i32, + notNull_i32, }; bool (*filterFunc_i64[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { @@ -431,6 +502,8 @@ bool (*filterFunc_i64[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_i64, nequal_i64, NULL, + isNull_i64, + notNull_i64, }; bool (*filterFunc_ds[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { @@ -442,6 +515,8 @@ bool (*filterFunc_ds[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_ds, nequal_ds, NULL, + isNull_ds, + notNull_ds, }; bool (*filterFunc_dd[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { @@ -453,6 +528,8 @@ bool (*filterFunc_dd[])(SColumnFilterElem *pFilter, char *minval, char *maxval) largeEqual_dd, nequal_dd, NULL, + isNull_dd, + notNull_dd, }; bool (*filterFunc_str[])(SColumnFilterElem* pFilter, char* minval, char *maxval) = { @@ -464,6 +541,8 @@ bool (*filterFunc_str[])(SColumnFilterElem* pFilter, char* minval, char *maxval) NULL, nequal_str, like_str, + isNull_binary, + notNull_binary, }; bool (*filterFunc_nchar[])(SColumnFilterElem* pFitler, char* minval, char* maxval) = { @@ -475,6 +554,8 @@ bool (*filterFunc_nchar[])(SColumnFilterElem* pFitler, char* minval, char* maxva NULL, nequal_nchar, like_nchar, + isNull_nchar, + notNull_nchar, }; bool (*rangeFilterFunc_i8[])(SColumnFilterElem *pFilter, char *minval, char *maxval) = { diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index 9629f24cc2..1e8ceffae6 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -275,6 +275,11 @@ tSQLExpr *tSQLExprCreate(tSQLExpr *pLeft, tSQLExpr *pRight, int32_t optrType) { } else { pExpr->nSQLOptr = optrType; pExpr->pLeft = pLeft; + + if (pRight == NULL) { + pRight = calloc(1, sizeof(tSQLExpr)); + } + pExpr->pRight = pRight; } diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 373e57963c..35e36032d4 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -126,17 +126,17 @@ typedef union { #define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo #define ParseARG_STORE yypParser->pInfo = pInfo #define YYFALLBACK 1 -#define YYNSTATE 244 -#define YYNRULE 225 +#define YYNSTATE 246 +#define YYNRULE 227 #define YYNTOKEN 206 -#define YY_MAX_SHIFT 243 -#define YY_MIN_SHIFTREDUCE 403 -#define YY_MAX_SHIFTREDUCE 627 -#define YY_ERROR_ACTION 628 -#define YY_ACCEPT_ACTION 629 -#define YY_NO_ACTION 630 -#define YY_MIN_REDUCE 631 -#define YY_MAX_REDUCE 855 +#define YY_MAX_SHIFT 245 +#define YY_MIN_SHIFTREDUCE 407 +#define YY_MAX_SHIFTREDUCE 633 +#define YY_ERROR_ACTION 634 +#define YY_ACCEPT_ACTION 635 +#define YY_NO_ACTION 636 +#define YY_MIN_REDUCE 637 +#define YY_MAX_REDUCE 863 /************* End control #defines *******************************************/ /* Define the yytestcase() macro to be a no-op if is not already defined @@ -202,121 +202,122 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (549) +#define YY_ACTTAB_COUNT (556) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 731, 444, 221, 729, 730, 629, 243, 510, 732, 445, - /* 10 */ 734, 735, 733, 41, 43, 526, 35, 36, 523, 11, - /* 20 */ 524, 29, 525, 444, 199, 39, 37, 40, 38, 155, - /* 30 */ 241, 445, 748, 34, 33, 219, 218, 32, 31, 30, - /* 40 */ 41, 43, 761, 35, 36, 136, 172, 173, 29, 137, - /* 50 */ 21, 199, 39, 37, 40, 38, 184, 141, 160, 843, - /* 60 */ 34, 33, 839, 772, 32, 31, 30, 404, 405, 406, - /* 70 */ 407, 408, 409, 410, 411, 412, 413, 414, 415, 242, - /* 80 */ 41, 43, 230, 35, 36, 746, 62, 137, 29, 137, - /* 90 */ 21, 199, 39, 37, 40, 38, 159, 843, 27, 842, - /* 100 */ 34, 33, 56, 838, 32, 31, 30, 105, 43, 8, - /* 110 */ 35, 36, 63, 115, 769, 29, 761, 527, 199, 39, - /* 120 */ 37, 40, 38, 168, 539, 747, 583, 34, 33, 18, - /* 130 */ 156, 32, 31, 30, 16, 210, 236, 235, 209, 208, - /* 140 */ 207, 234, 206, 233, 232, 231, 205, 727, 105, 715, - /* 150 */ 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, - /* 160 */ 726, 35, 36, 798, 837, 194, 29, 177, 157, 199, - /* 170 */ 39, 37, 40, 38, 181, 180, 21, 21, 34, 33, - /* 180 */ 444, 12, 32, 31, 30, 164, 596, 750, 445, 587, - /* 190 */ 153, 590, 154, 593, 105, 164, 596, 21, 17, 587, - /* 200 */ 150, 590, 196, 593, 60, 26, 90, 89, 144, 169, - /* 210 */ 217, 747, 747, 16, 149, 236, 235, 161, 162, 167, - /* 220 */ 234, 198, 233, 232, 231, 142, 670, 161, 162, 128, - /* 230 */ 222, 542, 747, 164, 596, 17, 143, 587, 750, 590, - /* 240 */ 105, 593, 26, 39, 37, 40, 38, 100, 170, 145, - /* 250 */ 797, 34, 33, 101, 26, 32, 31, 30, 32, 31, - /* 260 */ 30, 78, 183, 564, 565, 161, 162, 230, 589, 152, - /* 270 */ 592, 76, 80, 85, 88, 79, 240, 239, 97, 34, - /* 280 */ 33, 82, 42, 32, 31, 30, 118, 119, 70, 66, - /* 290 */ 69, 237, 42, 595, 679, 163, 61, 128, 132, 130, - /* 300 */ 93, 92, 91, 595, 671, 187, 585, 128, 594, 588, - /* 310 */ 750, 591, 171, 534, 47, 216, 215, 146, 594, 555, - /* 320 */ 186, 147, 556, 46, 613, 148, 14, 597, 13, 139, - /* 330 */ 42, 13, 50, 48, 3, 135, 75, 74, 140, 516, - /* 340 */ 515, 595, 586, 46, 22, 138, 203, 10, 9, 51, - /* 350 */ 22, 852, 530, 528, 531, 529, 594, 87, 86, 749, - /* 360 */ 808, 807, 165, 804, 803, 166, 771, 741, 220, 776, - /* 370 */ 763, 778, 102, 790, 789, 116, 117, 114, 681, 204, - /* 380 */ 133, 24, 213, 678, 214, 851, 72, 850, 848, 26, - /* 390 */ 120, 699, 25, 23, 185, 95, 134, 668, 81, 551, - /* 400 */ 666, 83, 84, 664, 188, 663, 174, 129, 661, 660, - /* 410 */ 659, 658, 657, 649, 131, 655, 653, 192, 52, 651, - /* 420 */ 760, 57, 49, 58, 791, 44, 197, 195, 193, 191, - /* 430 */ 189, 28, 212, 77, 223, 224, 225, 226, 227, 228, - /* 440 */ 229, 238, 627, 176, 175, 626, 201, 178, 179, 53, - /* 450 */ 625, 618, 182, 536, 64, 151, 186, 67, 552, 55, - /* 460 */ 103, 158, 662, 59, 200, 94, 96, 123, 700, 121, - /* 470 */ 126, 106, 107, 122, 124, 125, 127, 112, 108, 109, - /* 480 */ 113, 745, 110, 656, 111, 1, 2, 190, 5, 557, - /* 490 */ 104, 19, 6, 598, 20, 4, 15, 7, 65, 485, - /* 500 */ 202, 481, 479, 478, 477, 474, 448, 211, 68, 45, - /* 510 */ 71, 73, 22, 512, 511, 509, 54, 469, 467, 459, - /* 520 */ 465, 461, 463, 457, 455, 484, 483, 482, 480, 476, - /* 530 */ 475, 46, 446, 419, 417, 631, 630, 630, 630, 630, - /* 540 */ 630, 630, 630, 630, 630, 630, 630, 98, 99, + /* 0 */ 737, 448, 11, 735, 736, 635, 245, 448, 738, 449, + /* 10 */ 740, 741, 739, 35, 36, 449, 37, 38, 155, 243, + /* 20 */ 165, 29, 137, 136, 200, 41, 39, 43, 40, 105, + /* 30 */ 514, 160, 851, 34, 33, 778, 137, 32, 31, 30, + /* 40 */ 35, 36, 767, 37, 38, 159, 851, 165, 29, 767, + /* 50 */ 105, 200, 41, 39, 43, 40, 185, 157, 221, 220, + /* 60 */ 34, 33, 137, 156, 32, 31, 30, 35, 36, 448, + /* 70 */ 37, 38, 850, 141, 165, 29, 756, 449, 200, 41, + /* 80 */ 39, 43, 40, 197, 78, 60, 775, 34, 33, 232, + /* 90 */ 232, 32, 31, 30, 21, 41, 39, 43, 40, 32, + /* 100 */ 31, 30, 56, 34, 33, 847, 803, 32, 31, 30, + /* 110 */ 21, 21, 105, 408, 409, 410, 411, 412, 413, 414, + /* 120 */ 415, 416, 417, 418, 419, 244, 587, 169, 36, 753, + /* 130 */ 37, 38, 223, 50, 165, 29, 21, 62, 200, 41, + /* 140 */ 39, 43, 40, 170, 219, 753, 753, 34, 33, 27, + /* 150 */ 51, 32, 31, 30, 8, 37, 38, 63, 115, 165, + /* 160 */ 29, 101, 754, 200, 41, 39, 43, 40, 804, 224, + /* 170 */ 195, 753, 34, 33, 168, 846, 32, 31, 30, 16, + /* 180 */ 212, 238, 237, 211, 210, 209, 236, 208, 235, 234, + /* 190 */ 233, 207, 733, 756, 721, 722, 723, 724, 725, 726, + /* 200 */ 727, 728, 729, 730, 731, 732, 164, 600, 12, 239, + /* 210 */ 591, 17, 594, 188, 597, 105, 164, 600, 26, 559, + /* 220 */ 591, 845, 594, 46, 597, 34, 33, 150, 756, 32, + /* 230 */ 31, 30, 21, 90, 89, 144, 568, 569, 161, 162, + /* 240 */ 171, 149, 199, 76, 80, 85, 88, 79, 161, 162, + /* 250 */ 164, 600, 546, 82, 591, 589, 594, 100, 597, 242, + /* 260 */ 241, 97, 17, 16, 26, 238, 237, 752, 201, 26, + /* 270 */ 236, 61, 235, 234, 233, 118, 119, 70, 66, 69, + /* 280 */ 538, 676, 161, 162, 128, 530, 178, 187, 527, 184, + /* 290 */ 528, 590, 529, 182, 181, 593, 152, 596, 132, 130, + /* 300 */ 93, 92, 91, 42, 172, 543, 685, 218, 217, 128, + /* 310 */ 18, 163, 677, 42, 599, 128, 173, 174, 560, 619, + /* 320 */ 153, 47, 14, 13, 599, 592, 601, 595, 520, 598, + /* 330 */ 13, 519, 46, 154, 205, 22, 75, 74, 22, 598, + /* 340 */ 48, 10, 9, 534, 532, 535, 533, 42, 87, 86, + /* 350 */ 3, 139, 860, 140, 755, 142, 143, 603, 599, 147, + /* 360 */ 148, 146, 135, 145, 138, 814, 813, 166, 810, 809, + /* 370 */ 167, 777, 747, 598, 222, 769, 782, 784, 102, 796, + /* 380 */ 114, 116, 795, 117, 687, 206, 133, 531, 186, 26, + /* 390 */ 24, 95, 215, 684, 216, 859, 72, 858, 856, 120, + /* 400 */ 705, 25, 555, 23, 134, 674, 81, 672, 83, 189, + /* 410 */ 84, 670, 193, 669, 175, 52, 129, 667, 49, 666, + /* 420 */ 665, 106, 664, 44, 663, 107, 655, 131, 198, 766, + /* 430 */ 196, 661, 659, 657, 194, 57, 58, 797, 192, 190, + /* 440 */ 28, 214, 77, 225, 226, 227, 228, 229, 230, 203, + /* 450 */ 53, 231, 240, 633, 151, 177, 64, 67, 176, 668, + /* 460 */ 632, 179, 180, 631, 624, 187, 123, 183, 122, 706, + /* 470 */ 121, 125, 124, 94, 127, 662, 126, 96, 1, 2, + /* 480 */ 540, 112, 108, 109, 751, 110, 113, 111, 59, 55, + /* 490 */ 556, 103, 158, 19, 191, 20, 561, 104, 5, 602, + /* 500 */ 6, 4, 604, 15, 202, 7, 204, 65, 489, 485, + /* 510 */ 483, 482, 481, 478, 452, 213, 68, 45, 71, 22, + /* 520 */ 516, 515, 513, 54, 473, 471, 463, 469, 465, 467, + /* 530 */ 73, 461, 459, 488, 487, 486, 484, 480, 479, 46, + /* 540 */ 450, 423, 421, 637, 636, 636, 98, 636, 636, 636, + /* 550 */ 636, 636, 636, 636, 636, 99, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 226, 1, 210, 229, 230, 207, 208, 5, 234, 9, - /* 10 */ 236, 237, 238, 13, 14, 2, 16, 17, 5, 260, - /* 20 */ 7, 21, 9, 1, 24, 25, 26, 27, 28, 209, - /* 30 */ 210, 9, 240, 33, 34, 33, 34, 37, 38, 39, - /* 40 */ 13, 14, 244, 16, 17, 260, 33, 34, 21, 260, - /* 50 */ 210, 24, 25, 26, 27, 28, 258, 260, 269, 270, - /* 60 */ 33, 34, 260, 210, 37, 38, 39, 45, 46, 47, - /* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 80 */ 13, 14, 78, 16, 17, 245, 247, 260, 21, 260, - /* 90 */ 210, 24, 25, 26, 27, 28, 269, 270, 259, 270, - /* 100 */ 33, 34, 102, 260, 37, 38, 39, 210, 14, 98, - /* 110 */ 16, 17, 101, 102, 261, 21, 244, 104, 24, 25, - /* 120 */ 26, 27, 28, 243, 103, 245, 99, 33, 34, 108, - /* 130 */ 258, 37, 38, 39, 85, 86, 87, 88, 89, 90, - /* 140 */ 91, 92, 93, 94, 95, 96, 97, 226, 210, 228, - /* 150 */ 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - /* 160 */ 239, 16, 17, 266, 260, 268, 21, 126, 227, 24, - /* 170 */ 25, 26, 27, 28, 133, 134, 210, 210, 33, 34, - /* 180 */ 1, 44, 37, 38, 39, 1, 2, 246, 9, 5, - /* 190 */ 260, 7, 260, 9, 210, 1, 2, 210, 98, 5, - /* 200 */ 63, 7, 264, 9, 266, 105, 69, 70, 71, 243, - /* 210 */ 243, 245, 245, 85, 77, 87, 88, 33, 34, 227, - /* 220 */ 92, 37, 94, 95, 96, 260, 214, 33, 34, 217, - /* 230 */ 243, 37, 245, 1, 2, 98, 260, 5, 246, 7, - /* 240 */ 210, 9, 105, 25, 26, 27, 28, 98, 63, 260, - /* 250 */ 266, 33, 34, 210, 105, 37, 38, 39, 37, 38, - /* 260 */ 39, 72, 125, 115, 116, 33, 34, 78, 5, 132, - /* 270 */ 7, 64, 65, 66, 67, 68, 60, 61, 62, 33, - /* 280 */ 34, 74, 98, 37, 38, 39, 64, 65, 66, 67, - /* 290 */ 68, 227, 98, 109, 214, 59, 266, 217, 64, 65, - /* 300 */ 66, 67, 68, 109, 214, 262, 1, 217, 124, 5, - /* 310 */ 246, 7, 127, 99, 103, 130, 131, 260, 124, 99, - /* 320 */ 106, 260, 99, 103, 99, 260, 103, 99, 103, 260, - /* 330 */ 98, 103, 103, 122, 98, 260, 128, 129, 260, 99, - /* 340 */ 99, 109, 37, 103, 103, 260, 99, 128, 129, 120, - /* 350 */ 103, 246, 5, 5, 7, 7, 124, 72, 73, 246, - /* 360 */ 241, 241, 241, 241, 241, 241, 210, 242, 241, 210, - /* 370 */ 244, 210, 210, 267, 267, 210, 210, 248, 210, 210, - /* 380 */ 210, 210, 210, 210, 210, 210, 210, 210, 210, 105, - /* 390 */ 210, 210, 210, 210, 244, 59, 210, 210, 210, 109, - /* 400 */ 210, 210, 210, 210, 263, 210, 210, 210, 210, 210, - /* 410 */ 210, 210, 210, 210, 210, 210, 210, 263, 119, 210, - /* 420 */ 257, 211, 121, 211, 211, 118, 113, 117, 112, 111, - /* 430 */ 110, 123, 75, 84, 83, 49, 80, 82, 53, 81, - /* 440 */ 79, 75, 5, 5, 135, 5, 211, 135, 5, 211, - /* 450 */ 5, 86, 126, 99, 215, 211, 106, 215, 99, 107, - /* 460 */ 98, 1, 211, 103, 100, 212, 212, 219, 225, 224, - /* 470 */ 221, 256, 255, 223, 222, 220, 218, 250, 254, 253, - /* 480 */ 249, 244, 252, 211, 251, 216, 213, 98, 114, 99, - /* 490 */ 98, 103, 114, 99, 103, 98, 98, 98, 72, 9, - /* 500 */ 100, 5, 5, 5, 5, 5, 76, 15, 72, 16, - /* 510 */ 129, 129, 103, 5, 5, 99, 98, 5, 5, 5, - /* 520 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - /* 530 */ 5, 103, 76, 59, 58, 0, 271, 271, 271, 271, - /* 540 */ 271, 271, 271, 271, 271, 271, 271, 21, 21, 271, - /* 550 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 0 */ 226, 1, 260, 229, 230, 207, 208, 1, 234, 9, + /* 10 */ 236, 237, 238, 13, 14, 9, 16, 17, 209, 210, + /* 20 */ 20, 21, 260, 260, 24, 25, 26, 27, 28, 210, + /* 30 */ 5, 269, 270, 33, 34, 210, 260, 37, 38, 39, + /* 40 */ 13, 14, 244, 16, 17, 269, 270, 20, 21, 244, + /* 50 */ 210, 24, 25, 26, 27, 28, 258, 227, 33, 34, + /* 60 */ 33, 34, 260, 258, 37, 38, 39, 13, 14, 1, + /* 70 */ 16, 17, 270, 260, 20, 21, 246, 9, 24, 25, + /* 80 */ 26, 27, 28, 264, 72, 266, 261, 33, 34, 78, + /* 90 */ 78, 37, 38, 39, 210, 25, 26, 27, 28, 37, + /* 100 */ 38, 39, 102, 33, 34, 260, 266, 37, 38, 39, + /* 110 */ 210, 210, 210, 45, 46, 47, 48, 49, 50, 51, + /* 120 */ 52, 53, 54, 55, 56, 57, 99, 243, 14, 245, + /* 130 */ 16, 17, 210, 103, 20, 21, 210, 247, 24, 25, + /* 140 */ 26, 27, 28, 243, 243, 245, 245, 33, 34, 259, + /* 150 */ 120, 37, 38, 39, 98, 16, 17, 101, 102, 20, + /* 160 */ 21, 210, 240, 24, 25, 26, 27, 28, 266, 243, + /* 170 */ 268, 245, 33, 34, 227, 260, 37, 38, 39, 85, + /* 180 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + /* 190 */ 96, 97, 226, 246, 228, 229, 230, 231, 232, 233, + /* 200 */ 234, 235, 236, 237, 238, 239, 1, 2, 44, 227, + /* 210 */ 5, 98, 7, 262, 9, 210, 1, 2, 105, 99, + /* 220 */ 5, 260, 7, 103, 9, 33, 34, 63, 246, 37, + /* 230 */ 38, 39, 210, 69, 70, 71, 115, 116, 33, 34, + /* 240 */ 63, 77, 37, 64, 65, 66, 67, 68, 33, 34, + /* 250 */ 1, 2, 37, 74, 5, 1, 7, 98, 9, 60, + /* 260 */ 61, 62, 98, 85, 105, 87, 88, 245, 15, 105, + /* 270 */ 92, 266, 94, 95, 96, 64, 65, 66, 67, 68, + /* 280 */ 99, 214, 33, 34, 217, 2, 126, 106, 5, 125, + /* 290 */ 7, 37, 9, 133, 134, 5, 132, 7, 64, 65, + /* 300 */ 66, 67, 68, 98, 127, 103, 214, 130, 131, 217, + /* 310 */ 108, 59, 214, 98, 109, 217, 33, 34, 99, 99, + /* 320 */ 260, 103, 103, 103, 109, 5, 99, 7, 99, 124, + /* 330 */ 103, 99, 103, 260, 99, 103, 128, 129, 103, 124, + /* 340 */ 122, 128, 129, 5, 5, 7, 7, 98, 72, 73, + /* 350 */ 98, 260, 246, 260, 246, 260, 260, 104, 109, 260, + /* 360 */ 260, 260, 260, 260, 260, 241, 241, 241, 241, 241, + /* 370 */ 241, 210, 242, 124, 241, 244, 210, 210, 210, 267, + /* 380 */ 248, 210, 267, 210, 210, 210, 210, 104, 244, 105, + /* 390 */ 210, 59, 210, 210, 210, 210, 210, 210, 210, 210, + /* 400 */ 210, 210, 109, 210, 210, 210, 210, 210, 210, 263, + /* 410 */ 210, 210, 263, 210, 210, 119, 210, 210, 121, 210, + /* 420 */ 210, 256, 210, 118, 210, 255, 210, 210, 113, 257, + /* 430 */ 117, 210, 210, 210, 112, 211, 211, 211, 111, 110, + /* 440 */ 123, 75, 84, 83, 49, 80, 82, 53, 81, 211, + /* 450 */ 211, 79, 75, 5, 211, 5, 215, 215, 135, 211, + /* 460 */ 5, 135, 5, 5, 86, 106, 219, 126, 223, 225, + /* 470 */ 224, 220, 222, 212, 218, 211, 221, 212, 216, 213, + /* 480 */ 99, 250, 254, 253, 244, 252, 249, 251, 103, 107, + /* 490 */ 99, 98, 1, 103, 98, 103, 99, 98, 114, 99, + /* 500 */ 114, 98, 104, 98, 100, 98, 100, 72, 9, 5, + /* 510 */ 5, 5, 5, 5, 76, 15, 72, 16, 129, 103, + /* 520 */ 5, 5, 99, 98, 5, 5, 5, 5, 5, 5, + /* 530 */ 129, 5, 5, 5, 5, 5, 5, 5, 5, 103, + /* 540 */ 76, 59, 58, 0, 271, 271, 21, 271, 271, 271, + /* 550 */ 271, 271, 271, 271, 271, 21, 271, 271, 271, 271, /* 560 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, /* 570 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, /* 580 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, @@ -336,83 +337,84 @@ static const YYCODETYPE yy_lookahead[] = { /* 720 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, /* 730 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, /* 740 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, - /* 750 */ 271, 271, 271, 271, 271, + /* 750 */ 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + /* 760 */ 271, 271, }; -#define YY_SHIFT_COUNT (243) +#define YY_SHIFT_COUNT (245) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (535) +#define YY_SHIFT_MAX (543) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 137, 49, 128, 184, 232, 179, 179, 179, 179, 179, - /* 10 */ 179, 0, 22, 232, 13, 13, 13, 100, 179, 179, - /* 20 */ 179, 179, 179, 189, 4, 4, 549, 194, 232, 232, - /* 30 */ 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, - /* 40 */ 232, 232, 232, 232, 232, 13, 13, 2, 2, 2, - /* 50 */ 2, 2, 2, 11, 2, 149, 179, 179, 179, 179, - /* 60 */ 148, 148, 21, 179, 179, 179, 179, 179, 179, 179, - /* 70 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - /* 80 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - /* 90 */ 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - /* 100 */ 284, 336, 336, 290, 290, 336, 299, 301, 307, 313, - /* 110 */ 310, 316, 318, 320, 308, 284, 336, 336, 357, 357, - /* 120 */ 336, 349, 351, 386, 356, 355, 385, 358, 361, 336, - /* 130 */ 366, 336, 366, 549, 549, 27, 67, 67, 67, 94, - /* 140 */ 145, 218, 218, 218, 207, 246, 246, 246, 246, 222, - /* 150 */ 234, 185, 41, 221, 221, 216, 214, 220, 223, 225, - /* 160 */ 228, 263, 304, 305, 236, 211, 229, 240, 241, 247, - /* 170 */ 208, 219, 347, 348, 285, 437, 309, 438, 440, 312, - /* 180 */ 443, 445, 365, 326, 350, 354, 352, 360, 359, 362, - /* 190 */ 460, 389, 390, 392, 388, 374, 391, 378, 394, 397, - /* 200 */ 398, 364, 399, 400, 426, 490, 496, 497, 498, 499, - /* 210 */ 500, 430, 492, 436, 493, 381, 382, 409, 508, 509, - /* 220 */ 416, 418, 409, 512, 513, 514, 515, 516, 517, 518, - /* 230 */ 519, 520, 521, 522, 523, 524, 525, 428, 456, 526, - /* 240 */ 527, 474, 476, 535, + /* 0 */ 164, 94, 178, 205, 249, 6, 6, 6, 6, 6, + /* 10 */ 6, 0, 68, 249, 283, 283, 283, 113, 6, 6, + /* 20 */ 6, 6, 6, 12, 11, 11, 556, 215, 249, 249, + /* 30 */ 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, + /* 40 */ 249, 249, 249, 249, 249, 283, 283, 25, 25, 25, + /* 50 */ 25, 25, 25, 56, 25, 159, 6, 6, 6, 6, + /* 60 */ 121, 121, 202, 6, 6, 6, 6, 6, 6, 6, + /* 70 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + /* 80 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + /* 90 */ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + /* 100 */ 284, 332, 332, 293, 293, 332, 296, 297, 305, 315, + /* 110 */ 313, 322, 327, 329, 317, 284, 332, 332, 366, 366, + /* 120 */ 332, 358, 360, 395, 365, 364, 394, 367, 372, 332, + /* 130 */ 377, 332, 377, 556, 556, 27, 54, 54, 54, 114, + /* 140 */ 139, 70, 70, 70, 179, 192, 192, 192, 192, 211, + /* 150 */ 234, 177, 160, 62, 62, 199, 181, 120, 219, 220, + /* 160 */ 227, 290, 320, 254, 252, 253, 218, 30, 229, 232, + /* 170 */ 235, 208, 213, 338, 339, 276, 448, 323, 450, 455, + /* 180 */ 326, 457, 458, 378, 341, 359, 381, 382, 385, 391, + /* 190 */ 393, 491, 396, 397, 399, 390, 384, 392, 386, 400, + /* 200 */ 403, 398, 405, 404, 407, 406, 435, 499, 504, 505, + /* 210 */ 506, 507, 508, 438, 500, 444, 501, 389, 401, 416, + /* 220 */ 515, 516, 423, 425, 416, 519, 520, 521, 522, 523, + /* 230 */ 524, 526, 527, 528, 529, 530, 531, 532, 533, 436, + /* 240 */ 464, 525, 534, 482, 484, 543, }; #define YY_REDUCE_COUNT (134) -#define YY_REDUCE_MIN (-241) -#define YY_REDUCE_MAX (273) +#define YY_REDUCE_MIN (-258) +#define YY_REDUCE_MAX (266) static const short yy_reduce_ofst[] = { - /* 0 */ -202, -79, -226, -211, -173, -103, -62, -120, -34, -33, - /* 10 */ -13, -147, -180, -171, -59, -8, 64, -128, 43, -16, - /* 20 */ 30, -208, -160, 12, 80, 90, -161, -241, -215, -203, - /* 30 */ -198, -157, -96, -70, -68, -35, -24, -11, 57, 61, - /* 40 */ 65, 69, 75, 78, 85, 105, 113, 119, 120, 121, - /* 50 */ 122, 123, 124, 125, 127, 126, 156, 159, 161, 162, - /* 60 */ 106, 107, 129, 165, 166, 168, 169, 170, 171, 172, - /* 70 */ 173, 174, 175, 176, 177, 178, 180, 181, 182, 183, - /* 80 */ 186, 187, 188, 190, 191, 192, 193, 195, 196, 197, - /* 90 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 209, - /* 100 */ 150, 210, 212, 141, 154, 213, 163, 215, 217, 224, - /* 110 */ 226, 230, 233, 227, 231, 237, 235, 238, 239, 242, - /* 120 */ 244, 243, 245, 250, 248, 252, 255, 249, 258, 251, - /* 130 */ 253, 272, 254, 269, 273, + /* 0 */ -202, -34, -226, -238, -224, -98, -181, -116, -100, -99, + /* 10 */ -74, -175, -191, -198, -170, -53, -18, -195, -49, -160, + /* 20 */ 5, -78, 22, 67, 92, 98, -110, -258, -237, -187, + /* 30 */ -155, -85, -39, 60, 73, 91, 93, 95, 96, 99, + /* 40 */ 100, 101, 102, 103, 104, 106, 108, 124, 125, 126, + /* 50 */ 127, 128, 129, 130, 133, 131, 161, 166, 167, 168, + /* 60 */ 112, 115, 132, 171, 173, 174, 175, 176, 180, 182, + /* 70 */ 183, 184, 185, 186, 187, 188, 189, 190, 191, 193, + /* 80 */ 194, 195, 196, 197, 198, 200, 201, 203, 204, 206, + /* 90 */ 207, 209, 210, 212, 214, 216, 217, 221, 222, 223, + /* 100 */ 144, 224, 225, 146, 149, 226, 172, 165, 170, 228, + /* 110 */ 230, 233, 236, 231, 237, 240, 238, 239, 241, 242, + /* 120 */ 243, 244, 246, 245, 247, 250, 251, 255, 256, 248, + /* 130 */ 261, 264, 265, 262, 266, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 628, 680, 669, 845, 845, 628, 628, 628, 628, 628, - /* 10 */ 628, 773, 646, 845, 628, 628, 628, 628, 628, 628, - /* 20 */ 628, 628, 628, 682, 682, 682, 768, 628, 628, 628, - /* 30 */ 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, - /* 40 */ 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, - /* 50 */ 628, 628, 628, 628, 628, 628, 628, 775, 777, 628, - /* 60 */ 794, 794, 766, 628, 628, 628, 628, 628, 628, 628, - /* 70 */ 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, - /* 80 */ 628, 667, 628, 665, 628, 628, 628, 628, 628, 628, - /* 90 */ 628, 628, 628, 628, 628, 628, 628, 654, 628, 628, - /* 100 */ 628, 648, 648, 628, 628, 648, 801, 805, 799, 787, - /* 110 */ 795, 786, 782, 781, 809, 628, 648, 648, 677, 677, - /* 120 */ 648, 698, 696, 694, 686, 692, 688, 690, 684, 648, - /* 130 */ 675, 648, 675, 714, 728, 628, 810, 844, 800, 828, - /* 140 */ 827, 840, 834, 833, 628, 832, 831, 830, 829, 628, - /* 150 */ 628, 628, 628, 836, 835, 628, 628, 628, 628, 628, - /* 160 */ 628, 628, 628, 628, 812, 806, 802, 628, 628, 628, - /* 170 */ 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, - /* 180 */ 628, 628, 628, 628, 765, 628, 628, 774, 628, 628, - /* 190 */ 628, 628, 628, 628, 796, 628, 788, 628, 628, 628, - /* 200 */ 628, 628, 628, 742, 628, 628, 628, 628, 628, 628, - /* 210 */ 628, 628, 628, 628, 628, 628, 628, 849, 628, 628, - /* 220 */ 628, 736, 847, 628, 628, 628, 628, 628, 628, 628, - /* 230 */ 628, 628, 628, 628, 628, 628, 628, 701, 628, 652, - /* 240 */ 650, 628, 644, 628, + /* 0 */ 634, 686, 675, 853, 853, 634, 634, 634, 634, 634, + /* 10 */ 634, 779, 652, 853, 634, 634, 634, 634, 634, 634, + /* 20 */ 634, 634, 634, 688, 688, 688, 774, 634, 634, 634, + /* 30 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, + /* 40 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, + /* 50 */ 634, 634, 634, 634, 634, 634, 634, 781, 783, 634, + /* 60 */ 800, 800, 772, 634, 634, 634, 634, 634, 634, 634, + /* 70 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, + /* 80 */ 634, 673, 634, 671, 634, 634, 634, 634, 634, 634, + /* 90 */ 634, 634, 634, 634, 634, 634, 634, 660, 634, 634, + /* 100 */ 634, 654, 654, 634, 634, 654, 807, 811, 805, 793, + /* 110 */ 801, 792, 788, 787, 815, 634, 654, 654, 683, 683, + /* 120 */ 654, 704, 702, 700, 692, 698, 694, 696, 690, 654, + /* 130 */ 681, 654, 681, 720, 734, 634, 816, 852, 806, 842, + /* 140 */ 841, 848, 840, 839, 634, 835, 836, 838, 837, 634, + /* 150 */ 634, 634, 634, 844, 843, 634, 634, 634, 634, 634, + /* 160 */ 634, 634, 634, 634, 818, 634, 812, 808, 634, 634, + /* 170 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, + /* 180 */ 634, 634, 634, 634, 634, 771, 634, 634, 780, 634, + /* 190 */ 634, 634, 634, 634, 634, 802, 634, 794, 634, 634, + /* 200 */ 634, 634, 634, 634, 634, 748, 634, 634, 634, 634, + /* 210 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 857, + /* 220 */ 634, 634, 634, 742, 855, 634, 634, 634, 634, 634, + /* 230 */ 634, 634, 634, 634, 634, 634, 634, 634, 634, 707, + /* 240 */ 634, 658, 656, 634, 650, 634, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1198,35 +1200,37 @@ static const char *const yyRuleName[] = { /* 193 */ "expr ::= BOOL", /* 194 */ "expr ::= ID LP exprlist RP", /* 195 */ "expr ::= ID LP STAR RP", - /* 196 */ "expr ::= expr AND expr", - /* 197 */ "expr ::= expr OR expr", + /* 196 */ "expr ::= expr IS NULL", + /* 197 */ "expr ::= expr IS NOT NULL", /* 198 */ "expr ::= expr LT expr", /* 199 */ "expr ::= expr GT expr", /* 200 */ "expr ::= expr LE expr", /* 201 */ "expr ::= expr GE expr", /* 202 */ "expr ::= expr NE expr", /* 203 */ "expr ::= expr EQ expr", - /* 204 */ "expr ::= expr PLUS expr", - /* 205 */ "expr ::= expr MINUS expr", - /* 206 */ "expr ::= expr STAR expr", - /* 207 */ "expr ::= expr SLASH expr", - /* 208 */ "expr ::= expr REM expr", - /* 209 */ "expr ::= expr LIKE expr", - /* 210 */ "expr ::= expr IN LP exprlist RP", - /* 211 */ "exprlist ::= exprlist COMMA expritem", - /* 212 */ "exprlist ::= expritem", - /* 213 */ "expritem ::= expr", - /* 214 */ "expritem ::=", - /* 215 */ "cmd ::= RESET QUERY CACHE", - /* 216 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", - /* 217 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", - /* 218 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", - /* 219 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", - /* 220 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", - /* 221 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", - /* 222 */ "cmd ::= KILL CONNECTION INTEGER", - /* 223 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", - /* 224 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", + /* 204 */ "expr ::= expr AND expr", + /* 205 */ "expr ::= expr OR expr", + /* 206 */ "expr ::= expr PLUS expr", + /* 207 */ "expr ::= expr MINUS expr", + /* 208 */ "expr ::= expr STAR expr", + /* 209 */ "expr ::= expr SLASH expr", + /* 210 */ "expr ::= expr REM expr", + /* 211 */ "expr ::= expr LIKE expr", + /* 212 */ "expr ::= expr IN LP exprlist RP", + /* 213 */ "exprlist ::= exprlist COMMA expritem", + /* 214 */ "exprlist ::= expritem", + /* 215 */ "expritem ::= expr", + /* 216 */ "expritem ::=", + /* 217 */ "cmd ::= RESET QUERY CACHE", + /* 218 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", + /* 219 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", + /* 220 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", + /* 221 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", + /* 222 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", + /* 223 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", + /* 224 */ "cmd ::= KILL CONNECTION INTEGER", + /* 225 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", + /* 226 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", }; #endif /* NDEBUG */ @@ -1880,35 +1884,37 @@ static const struct { { 260, -1 }, /* (193) expr ::= BOOL */ { 260, -4 }, /* (194) expr ::= ID LP exprlist RP */ { 260, -4 }, /* (195) expr ::= ID LP STAR RP */ - { 260, -3 }, /* (196) expr ::= expr AND expr */ - { 260, -3 }, /* (197) expr ::= expr OR expr */ + { 260, -3 }, /* (196) expr ::= expr IS NULL */ + { 260, -4 }, /* (197) expr ::= expr IS NOT NULL */ { 260, -3 }, /* (198) expr ::= expr LT expr */ { 260, -3 }, /* (199) expr ::= expr GT expr */ { 260, -3 }, /* (200) expr ::= expr LE expr */ { 260, -3 }, /* (201) expr ::= expr GE expr */ { 260, -3 }, /* (202) expr ::= expr NE expr */ { 260, -3 }, /* (203) expr ::= expr EQ expr */ - { 260, -3 }, /* (204) expr ::= expr PLUS expr */ - { 260, -3 }, /* (205) expr ::= expr MINUS expr */ - { 260, -3 }, /* (206) expr ::= expr STAR expr */ - { 260, -3 }, /* (207) expr ::= expr SLASH expr */ - { 260, -3 }, /* (208) expr ::= expr REM expr */ - { 260, -3 }, /* (209) expr ::= expr LIKE expr */ - { 260, -5 }, /* (210) expr ::= expr IN LP exprlist RP */ - { 269, -3 }, /* (211) exprlist ::= exprlist COMMA expritem */ - { 269, -1 }, /* (212) exprlist ::= expritem */ - { 270, -1 }, /* (213) expritem ::= expr */ - { 270, 0 }, /* (214) expritem ::= */ - { 208, -3 }, /* (215) cmd ::= RESET QUERY CACHE */ - { 208, -7 }, /* (216) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ - { 208, -7 }, /* (217) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ - { 208, -7 }, /* (218) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ - { 208, -7 }, /* (219) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ - { 208, -8 }, /* (220) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ - { 208, -9 }, /* (221) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ - { 208, -3 }, /* (222) cmd ::= KILL CONNECTION INTEGER */ - { 208, -5 }, /* (223) cmd ::= KILL STREAM INTEGER COLON INTEGER */ - { 208, -5 }, /* (224) cmd ::= KILL QUERY INTEGER COLON INTEGER */ + { 260, -3 }, /* (204) expr ::= expr AND expr */ + { 260, -3 }, /* (205) expr ::= expr OR expr */ + { 260, -3 }, /* (206) expr ::= expr PLUS expr */ + { 260, -3 }, /* (207) expr ::= expr MINUS expr */ + { 260, -3 }, /* (208) expr ::= expr STAR expr */ + { 260, -3 }, /* (209) expr ::= expr SLASH expr */ + { 260, -3 }, /* (210) expr ::= expr REM expr */ + { 260, -3 }, /* (211) expr ::= expr LIKE expr */ + { 260, -5 }, /* (212) expr ::= expr IN LP exprlist RP */ + { 269, -3 }, /* (213) exprlist ::= exprlist COMMA expritem */ + { 269, -1 }, /* (214) exprlist ::= expritem */ + { 270, -1 }, /* (215) expritem ::= expr */ + { 270, 0 }, /* (216) expritem ::= */ + { 208, -3 }, /* (217) cmd ::= RESET QUERY CACHE */ + { 208, -7 }, /* (218) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + { 208, -7 }, /* (219) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + { 208, -7 }, /* (220) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + { 208, -7 }, /* (221) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + { 208, -8 }, /* (222) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + { 208, -9 }, /* (223) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + { 208, -3 }, /* (224) cmd ::= KILL CONNECTION INTEGER */ + { 208, -5 }, /* (225) cmd ::= KILL STREAM INTEGER COLON INTEGER */ + { 208, -5 }, /* (226) cmd ::= KILL QUERY INTEGER COLON INTEGER */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2570,7 +2576,7 @@ static void yy_reduce( break; case 168: /* having_opt ::= */ case 178: /* where_opt ::= */ yytestcase(yyruleno==178); - case 214: /* expritem ::= */ yytestcase(yyruleno==214); + case 216: /* expritem ::= */ yytestcase(yyruleno==216); {yymsp[1].minor.yy66 = 0;} break; case 169: /* having_opt ::= HAVING expr */ @@ -2643,24 +2649,20 @@ static void yy_reduce( yymsp[0].minor.yy66 = yylhsminor.yy66; break; case 194: /* expr ::= ID LP exprlist RP */ -{ - yylhsminor.yy66 = tSQLExprCreateFunction(yymsp[-1].minor.yy224, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); -} +{ yylhsminor.yy66 = tSQLExprCreateFunction(yymsp[-1].minor.yy224, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy66 = yylhsminor.yy66; break; case 195: /* expr ::= ID LP STAR RP */ -{ - yylhsminor.yy66 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); -} +{ yylhsminor.yy66 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } yymsp[-3].minor.yy66 = yylhsminor.yy66; break; - case 196: /* expr ::= expr AND expr */ -{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_AND);} + case 196: /* expr ::= expr IS NULL */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, NULL, TK_ISNULL);} yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 197: /* expr ::= expr OR expr */ -{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_OR); } - yymsp[-2].minor.yy66 = yylhsminor.yy66; + case 197: /* expr ::= expr IS NOT NULL */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-3].minor.yy66, NULL, TK_NOTNULL);} + yymsp[-3].minor.yy66 = yylhsminor.yy66; break; case 198: /* expr ::= expr LT expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LT);} @@ -2686,57 +2688,65 @@ static void yy_reduce( {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_EQ);} yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 204: /* expr ::= expr PLUS expr */ + case 204: /* expr ::= expr AND expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_AND);} + yymsp[-2].minor.yy66 = yylhsminor.yy66; + break; + case 205: /* expr ::= expr OR expr */ +{yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_OR); } + yymsp[-2].minor.yy66 = yylhsminor.yy66; + break; + case 206: /* expr ::= expr PLUS expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_PLUS); } yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 205: /* expr ::= expr MINUS expr */ + case 207: /* expr ::= expr MINUS expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_MINUS); } yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 206: /* expr ::= expr STAR expr */ + case 208: /* expr ::= expr STAR expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_STAR); } yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 207: /* expr ::= expr SLASH expr */ + case 209: /* expr ::= expr SLASH expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_DIVIDE);} yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 208: /* expr ::= expr REM expr */ + case 210: /* expr ::= expr REM expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_REM); } yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 209: /* expr ::= expr LIKE expr */ + case 211: /* expr ::= expr LIKE expr */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-2].minor.yy66, yymsp[0].minor.yy66, TK_LIKE); } yymsp[-2].minor.yy66 = yylhsminor.yy66; break; - case 210: /* expr ::= expr IN LP exprlist RP */ + case 212: /* expr ::= expr IN LP exprlist RP */ {yylhsminor.yy66 = tSQLExprCreate(yymsp[-4].minor.yy66, (tSQLExpr*)yymsp[-1].minor.yy224, TK_IN); } yymsp[-4].minor.yy66 = yylhsminor.yy66; break; - case 211: /* exprlist ::= exprlist COMMA expritem */ + case 213: /* exprlist ::= exprlist COMMA expritem */ {yylhsminor.yy224 = tSQLExprListAppend(yymsp[-2].minor.yy224,yymsp[0].minor.yy66,0);} yymsp[-2].minor.yy224 = yylhsminor.yy224; break; - case 212: /* exprlist ::= expritem */ + case 214: /* exprlist ::= expritem */ {yylhsminor.yy224 = tSQLExprListAppend(0,yymsp[0].minor.yy66,0);} yymsp[0].minor.yy224 = yylhsminor.yy224; break; - case 213: /* expritem ::= expr */ + case 215: /* expritem ::= expr */ {yylhsminor.yy66 = yymsp[0].minor.yy66;} yymsp[0].minor.yy66 = yylhsminor.yy66; break; - case 215: /* cmd ::= RESET QUERY CACHE */ + case 217: /* cmd ::= RESET QUERY CACHE */ { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} break; - case 216: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ + case 218: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 217: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ + case 219: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2747,14 +2757,14 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 218: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ + case 220: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy449, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN); setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 219: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ + case 221: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; @@ -2765,7 +2775,7 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 220: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ + case 222: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; @@ -2779,7 +2789,7 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 221: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ + case 223: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; @@ -2791,13 +2801,13 @@ static void yy_reduce( setSQLInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); } break; - case 222: /* cmd ::= KILL CONNECTION INTEGER */ + case 224: /* cmd ::= KILL CONNECTION INTEGER */ {setKillSQL(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} break; - case 223: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ + case 225: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} break; - case 224: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ + case 226: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSQL(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} break; default: diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index d829a85754..5fece58ef7 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -2071,13 +2071,17 @@ STimeWindow changeTableGroupByLastrow(STableGroupInfo *groupList) { if (keyInfo.pTable != NULL) { totalNumOfTable++; taosArrayPush(pGroup, &keyInfo); + } else { + taosArrayRemove(groupList->pGroupList, j); + numOfGroups -= 1; + j -= 1; } } // window does not being updated, so set the original if (window.skey == INT64_MAX && window.ekey == INT64_MIN) { window = TSWINDOW_INITIALIZER; - assert(totalNumOfTable == 0); + assert(totalNumOfTable == 0 && taosArrayGetSize(groupList->pGroupList) == 0); } groupList->numOfTables = totalNumOfTable; @@ -2398,6 +2402,14 @@ static bool indexedNodeFilterFp(const void* pNode, void* param) { val = tdGetKVRowValOfCol(pTable->tagVal, pInfo->sch.colId); } + if (pInfo->optr == TSDB_RELATION_ISNULL || pInfo->optr == TSDB_RELATION_NOTNULL) { + if (pInfo->optr == TSDB_RELATION_ISNULL) { + return (val == NULL) || isNull(val, pInfo->sch.type); + } else if (pInfo->optr == TSDB_RELATION_NOTNULL) { + return (val != NULL) && (!isNull(val, pInfo->sch.type)); + } + } + int32_t ret = 0; if (val == NULL) { //the val is possible to be null, so check it out carefully ret = -1; // val is missing in table tags value pairs -- GitLab