From ee41fe5690584a45474a6e4f0787663f789a0002 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 14 Dec 2021 09:16:16 +0800 Subject: [PATCH] modify the tSqlExpr node type to expr for jsontag->key --- src/client/src/tscSQLParser.c | 9 +++------ src/query/src/qSqlParser.c | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index bbe148a3ed..2f800339b7 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2196,7 +2196,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS } int32_t type = pItem->pNode->type; - if (type == SQL_NODE_EXPR) { + if (type == SQL_NODE_EXPR && pItem->pNode->tokenId != TK_ARROW) { int32_t code = handleSQLExprItem(pCmd, pQueryInfo, i, pItem); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2236,7 +2236,8 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS return TSDB_CODE_TSC_INVALID_OPERATION; } } - } else if (type == SQL_NODE_TABLE_COLUMN || type == SQL_NODE_VALUE) { + } else if (type == SQL_NODE_TABLE_COLUMN || type == SQL_NODE_VALUE || + (type == SQL_NODE_EXPR && pItem->pNode->tokenId == TK_ARROW)) { // use the dynamic array list to decide if the function is valid or not // select table_name1.field_name1, table_name2.field_name2 from table_name1, table_name2 if (addProjectionExprAndResultField(pCmd, pQueryInfo, pItem, outerQuery) != TSDB_CODE_SUCCESS) { @@ -4671,10 +4672,6 @@ static int32_t validateSQLExprItem(SSqlCmd* pCmd, tSqlExpr* pExpr, } else if (pExpr->type == SQL_NODE_TABLE_COLUMN) { SColumnIndex index = COLUMN_INDEX_INITIALIZER; - if (pExpr->tokenId == TK_ARROW) { - pExpr = pExpr->pLeft; - } - if (getColumnIndexByName(&pExpr->columnName, pQueryInfo, &index, tscGetErrorMsgPayload(pCmd)) != TSDB_CODE_SUCCESS) { return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); diff --git a/src/query/src/qSqlParser.c b/src/query/src/qSqlParser.c index 1cbec22c01..f34f54710d 100644 --- a/src/query/src/qSqlParser.c +++ b/src/query/src/qSqlParser.c @@ -418,7 +418,7 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) { pExpr->tokenId = optrType; pExpr->pLeft = pLeft; pExpr->pRight = pRight; - pExpr->type = SQL_NODE_TABLE_COLUMN; + pExpr->type = SQL_NODE_EXPR; } else { pExpr->tokenId = optrType; pExpr->pLeft = pLeft; -- GitLab