From 9887c63c5de481cac3bbf0a52069742806b17837 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 13 Jul 2022 19:03:40 +0800 Subject: [PATCH] feat: support pseudo columns such as _qstart, _qend and _qduration --- source/libs/nodes/src/nodesUtilFuncs.c | 2 +- source/libs/parser/src/parTranslater.c | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 051cdf9a94..b00b08a66d 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1777,7 +1777,7 @@ static EDealRes classifyConditionImpl(SNode* pNode, void* pContext) { SClassifyConditionCxt* pCxt = (SClassifyConditionCxt*)pContext; if (QUERY_NODE_COLUMN == nodeType(pNode)) { SColumnNode* pCol = (SColumnNode*)pNode; - if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { + if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId && TSDB_SYSTEM_TABLE != pCol->tableType) { pCxt->hasPrimaryKey = true; } else if (pCol->hasIndex) { pCxt->hasTagIndexCol = true; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ec8aadf827..653451a7a6 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -916,8 +916,6 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD } if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { - // TODO - // pVal->node.resType = targetDt; pVal->translate = true; pVal->isNull = true; return DEAL_RES_CONTINUE; @@ -2409,21 +2407,10 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SNodeList* pPartiti return translateExprList(pCxt, pPartitionByList); } -static bool isDataTable(int8_t tableType) { - return TSDB_SUPER_TABLE == tableType || TSDB_CHILD_TABLE == tableType || TSDB_NORMAL_TABLE == tableType; -} - -static bool needCalcTimeRange(SSelectStmt* pSelect) { - if (QUERY_NODE_REAL_TABLE != nodeType(pSelect->pFromTable)) { - return false; - } - return isDataTable(((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType); -} - static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) { pCxt->currClause = SQL_CLAUSE_WHERE; int32_t code = translateExpr(pCxt, &pSelect->pWhere); - if (TSDB_CODE_SUCCESS == code && needCalcTimeRange(pSelect)) { + if (TSDB_CODE_SUCCESS == code) { code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange); } return code;