Merge pull request #15333 from taosdata/feature/3.0_debug_wxy
fix: semantic check when last(*) and column are together
This commit is contained in:
commit
8a7d8147f9
|
@ -442,7 +442,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
|
|||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
if (taosArrayGetSize(tbUids) == 0){
|
||||
if (taosArrayGetSize(tbUids) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -811,6 +811,9 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
|
|||
for (int32_t i = 0; i < pTagSchema->nCols; i++) {
|
||||
SSchema *pCol = &pTagSchema->pSchema[i];
|
||||
if (iCol == i) {
|
||||
if (pAlterTbReq->isNull) {
|
||||
continue;
|
||||
}
|
||||
STagVal val = {0};
|
||||
val.type = pCol->type;
|
||||
val.cid = pCol->colId;
|
||||
|
|
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
//newline area
|
||||
#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s"
|
||||
#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s"
|
||||
#define EXPLAIN_TBL_MERGE_SCAN_FORMAT "Table Merge Scan on %s"
|
||||
#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s"
|
||||
#define EXPLAIN_DISTBLK_SCAN_FORMAT "Block Dist Scan on %s"
|
||||
#define EXPLAIN_LASTROW_SCAN_FORMAT "Last Row Scan on %s"
|
||||
|
|
|
@ -433,7 +433,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
|||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN:
|
||||
case QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN: {
|
||||
STableScanPhysiNode *pTblScanNode = (STableScanPhysiNode *)pNode;
|
||||
EXPLAIN_ROW_NEW(level, EXPLAIN_TBL_SCAN_FORMAT, pTblScanNode->scan.tableName.tname);
|
||||
EXPLAIN_ROW_NEW(level,
|
||||
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN == pNode->type ? EXPLAIN_TBL_MERGE_SCAN_FORMAT : EXPLAIN_TBL_SCAN_FORMAT,
|
||||
pTblScanNode->scan.tableName.tname);
|
||||
EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT);
|
||||
if (pResNode->pExecInfo) {
|
||||
QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen));
|
||||
|
|
|
@ -523,7 +523,7 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok
|
|||
if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) {
|
||||
COPY_STRING_FORM_ID_TOKEN(tempTable->table.tableAlias, pTableAlias);
|
||||
} else {
|
||||
sprintf(tempTable->table.tableAlias, "%p", tempTable);
|
||||
taosRandStr(tempTable->table.tableAlias, 8);
|
||||
}
|
||||
if (QUERY_NODE_SELECT_STMT == nodeType(pSubquery)) {
|
||||
strcpy(((SSelectStmt*)pSubquery)->stmtName, tempTable->table.tableAlias);
|
||||
|
|
|
@ -1220,6 +1220,14 @@ static int32_t translateMultiResFunc(STranslateContext* pCxt, SFunctionNode* pFu
|
|||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t getMultiResFuncNum(SNodeList* pParameterList) {
|
||||
if (1 == LIST_LENGTH(pParameterList)) {
|
||||
return isStar(nodesListGetNode(pParameterList, 0)) ? 2 : 1;
|
||||
}
|
||||
return LIST_LENGTH(pParameterList);
|
||||
}
|
||||
|
||||
static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
||||
if (NULL != pCurrStmt && QUERY_NODE_SELECT_STMT == nodeType(pCurrStmt)) {
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pCurrStmt;
|
||||
|
@ -1229,7 +1237,9 @@ static void setFuncClassification(SNode* pCurrStmt, SFunctionNode* pFunc) {
|
|||
pSelect->hasMultiRowsFunc = pSelect->hasMultiRowsFunc ? true : fmIsMultiRowsFunc(pFunc->funcId);
|
||||
if (fmIsSelectFunc(pFunc->funcId)) {
|
||||
pSelect->hasSelectFunc = true;
|
||||
++(pSelect->selectFuncNum);
|
||||
pSelect->selectFuncNum += (fmIsMultiResFunc(pFunc->funcId) && !fmIsLastRowFunc(pFunc->funcId))
|
||||
? getMultiResFuncNum(pFunc->pParameterList)
|
||||
: 1;
|
||||
} else if (fmIsVectorFunc(pFunc->funcId)) {
|
||||
pSelect->hasOtherVectorFunc = true;
|
||||
}
|
||||
|
@ -2134,6 +2144,15 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t translateFillValues(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||
if (NULL == pSelect->pWindow || QUERY_NODE_INTERVAL_WINDOW != nodeType(pSelect->pWindow) ||
|
||||
NULL == ((SIntervalWindowNode*)pSelect->pWindow)->pFill) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
SFillNode* pFill = (SFillNode*)((SIntervalWindowNode*)pSelect->pWindow)->pFill;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||
pCxt->currClause = SQL_CLAUSE_SELECT;
|
||||
int32_t code = translateExprList(pCxt, pSelect->pProjectionList);
|
||||
|
@ -2143,6 +2162,9 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect
|
|||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = checkExprListForGroupBy(pCxt, pSelect, pSelect->pProjectionList);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = translateFillValues(pCxt, pSelect);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -6053,7 +6075,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS
|
|||
pReq->pTagVal = (uint8_t*)pTag;
|
||||
pStmt->pVal->datum.p = (char*)pTag; // for free
|
||||
} else {
|
||||
pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type);
|
||||
pReq->isNull = pStmt->pVal->isNull;
|
||||
pReq->nTagVal = pStmt->pVal->node.resType.bytes;
|
||||
pReq->pTagVal = nodesGetValueFromNode(pStmt->pVal);
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SInterva
|
|||
(NULL != pInterval->pSliding ? ((SValueNode*)pInterval->pSliding)->unit : pWindow->intervalUnit);
|
||||
pWindow->windowAlgo = pCxt->pPlanCxt->streamQuery ? INTERVAL_ALGO_STREAM_SINGLE : INTERVAL_ALGO_HASH;
|
||||
pWindow->node.groupAction = GROUP_ACTION_KEEP;
|
||||
pWindow->node.requireDataOrder = DATA_ORDER_LEVEL_IN_BLOCK;
|
||||
pWindow->node.requireDataOrder = pSelect->hasTimeLineFunc ? DATA_ORDER_LEVEL_IN_GROUP : DATA_ORDER_LEVEL_IN_BLOCK;
|
||||
pWindow->node.resultDataOrder = DATA_ORDER_LEVEL_IN_GROUP;
|
||||
|
||||
pWindow->pTspk = nodesCloneNode(pInterval->pCol);
|
||||
|
|
Loading…
Reference in New Issue