From 999de65e7362c51df4ff1dc0fd53cdde3d801708 Mon Sep 17 00:00:00 2001 From: xywang Date: Thu, 19 May 2022 22:52:15 +0800 Subject: [PATCH] feat(query): added bitwise operations --- src/common/src/texpr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 9b5a0a2fb5..ce24fa5c2b 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -216,15 +216,21 @@ int32_t exprTreeValidateExprNode(tExprNode *pExpr) { } } - // colx bitwise_op (coly logic_op n) + // colx logic_op n bitwise_op coly + if (pLeft->resultType == TSDB_DATA_TYPE_DOUBLE) { + pLeft->resultType = TSDB_DATA_TYPE_BIGINT; + pLeft->resultBytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; + } + + // colx bitwise_op coly logic_op n if (pRight->resultType == TSDB_DATA_TYPE_DOUBLE) { pRight->resultType = TSDB_DATA_TYPE_BIGINT; pRight->resultBytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; } if (pExpr->_node.optr == TSDB_BINARY_OP_LSHIFT || pExpr->_node.optr == TSDB_BINARY_OP_RSHIFT) { - pExpr->resultType = leftType; - pExpr->resultBytes = tDataTypes[leftType].bytes; + pExpr->resultType = pLeft->resultType; + pExpr->resultBytes = tDataTypes[pLeft->resultType].bytes; } else { pExpr->resultType = TSDB_DATA_TYPE_BIGINT; pExpr->resultBytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes; -- GitLab