Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/client/src/clientTmq.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "tdatablock.h"
#include "tdef.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tqueue.h"
#include "tref.h"
#include "ttimer.h"
Expand Down Expand Up @@ -1838,7 +1839,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
}

// init connection
code = taos_connect_internal(conf->ip, user, pass, NULL, NULL, conf->port, CONN_TYPE__TMQ, &pTmq->pTscObj);
code = taos_connect_internal(conf->ip, user, pass, NULL, NULL, conf->port, CONN_TYPE__QUERY, &pTmq->pTscObj);
if (code) {
terrno = code;
tqErrorC("consumer:0x%" PRIx64 " setup failed since %s, groupId:%s", pTmq->consumerId, terrstr(), pTmq->groupId);
Expand Down
1 change: 1 addition & 0 deletions source/dnode/vnode/src/meta/metaTable2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ int32_t metaDropTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, S
metaError("vgId:%d, %s failed at %s:%d since %s, uid:%" PRId64 " name:%s version:%" PRId64, TD_VID(pMeta->pVnode),
__func__, __FILE__, __LINE__, tstrerror(code), pEntry->uid, pReq->tbName, version);
metaFetchEntryFree(&pEntry);
TAOS_RETURN(code);
} else {
metaInfo("vgId:%d, table %s uid %" PRId64 " is updated, version:%" PRId64, TD_VID(pMeta->pVnode), pReq->tbName,
pEntry->uid, version);
Expand Down
2 changes: 1 addition & 1 deletion source/libs/executor/src/virtualtablescanoperator.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int32_t virtualScanloadNextDataBlock(void* param, SSDataBlock** ppBlock) {

return code;
_return:
qError("failed to load data block from downstream, %s code:%s", __func__, tstrerror(code));
qError("failed to load data block from downstream, %s code:%s, line:%d", __func__, tstrerror(code), line);
return code;
}

Expand Down
9 changes: 9 additions & 0 deletions source/libs/parser/src/parTranslater.c
Original file line number Diff line number Diff line change
Expand Up @@ -5909,6 +5909,15 @@ static int32_t translateVirtualNormalChildTable(STranslateContext* pCxt, SNode**
}
pCxt->refTable = false;
pCxt->pParseCxt->async = tmpAsync;
if (taosHashGetSize(pTableNameHash) == 1 && pRTNode != NULL) {
if (pMeta->numOfColRefs > 0 && pMeta->colRef != NULL && pMeta->tableInfo.numOfColumns > 0 &&
pRTNode->pMeta != NULL && pRTNode->pMeta->tableInfo.numOfColumns > 0) {
const SSchema* pTsSchema = &pMeta->schema[0];
const SSchema* pRefTsSchema = &pRTNode->pMeta->schema[0];
PAR_ERR_JRET(setColRef(&pMeta->colRef[0], pTsSchema->colId, (char*)pRefTsSchema->name, pRTNode->table.tableName,
pRTNode->table.dbName));
}
}
nodesDestroyNode(*pTable);
*pTable = (SNode*)pVTable;

Expand Down
3 changes: 2 additions & 1 deletion source/libs/planner/src/planLogicCreater.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ static int32_t createRefScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSel

SNode *pTsCol = nodesListGetNode(pScan->pScanCols, 0);
((SColumnNode*)pTsCol)->hasDep = true;
tstrncpy(((SColumnNode*)pTsCol)->dbName, pRealTable->table.dbName, TSDB_DB_NAME_LEN);
*pLogicNode = (SLogicNode*)pScan;
// pCxt->hasScan = true;

Expand Down Expand Up @@ -1238,7 +1239,7 @@ static int32_t createVirtualNormalChildTableLogicNode(SLogicPlanContext* pCxt, S
int32_t schemaIndex = findSchemaIndex(pVirtualTable->pMeta->schema, pVirtualTable->pMeta->tableInfo.numOfColumns, pCol->colId);
if (colRefIndex != -1 && pVirtualTable->pMeta->colRef[colRefIndex].hasRef) {
if (pCol->isPrimTs || pCol->colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
PLAN_ERR_JRET(TSDB_CODE_VTABLE_PRIMTS_HAS_REF);
continue;
}
scanAllCols &= false;
PLAN_ERR_JRET(addSubScanNode(pCxt, pSelect, pVirtualTable, colRefIndex, schemaIndex, pRefTablesMap));
Expand Down
9 changes: 9 additions & 0 deletions source/libs/planner/src/planOptimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define OPTIMIZE_FLAG_JOIN_COND OPTIMIZE_FLAG_MASK(4)
#define OPTIMIZE_FLAG_VTB_WINDOW OPTIMIZE_FLAG_MASK(5)
#define OPTIMIZE_FLAG_VTB_AGG OPTIMIZE_FLAG_MASK(6)
#define OPTIMIZE_FLAG_ELIMINATE_VSCAN OPTIMIZE_FLAG_MASK(5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The new flag OPTIMIZE_FLAG_ELIMINATE_VSCAN is defined with the same value as the existing OPTIMIZE_FLAG_VTB_WINDOW flag (OPTIMIZE_FLAG_MASK(5)). Reusing flag values will cause conflicts and unpredictable behavior in the query optimizer, as operations on one flag will unintentionally affect the other. Optimizer flags must have unique bit values to function correctly. Please assign a unique bit to OPTIMIZE_FLAG_ELIMINATE_VSCAN.

#define OPTIMIZE_FLAG_ELIMINATE_VSCAN OPTIMIZE_FLAG_MASK(7)


#define OPTIMIZE_FLAG_SET_MASK(val, mask) (val) |= (mask)
#define OPTIMIZE_FLAG_CLEAR_MASK(val, mask) (val) &= (~(mask))
Expand Down Expand Up @@ -3947,6 +3948,13 @@ static bool eliminateProjOptMayBeOptimized(SLogicNode* pNode, void* pCtx) {
return false;
}

if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(nodesListGetNode(pNode->pChildren, 0))) {
SScanLogicNode* pChild = (SScanLogicNode*)nodesListGetNode(pNode->pChildren, 0);
if (pChild && OPTIMIZE_FLAG_TEST_MASK(pChild->node.optimizedFlag, OPTIMIZE_FLAG_ELIMINATE_VSCAN)) {
return false;
}
}

if (QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL == nodeType(nodesListGetNode(pNode->pChildren, 0))) {
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pNode->pChildren, 0);
if (LIST_LENGTH(pChild->pTargets) != LIST_LENGTH(pNode->pTargets)) {
Expand Down Expand Up @@ -8240,6 +8248,7 @@ static int32_t eliminateVirtualScanOptimizeImpl(SOptimizeContext* pCxt, SLogicSu
FOREACH(pChild, pVirtualScanNode->pChildren) {
// clear the mask to try scanPathOptimize again.
OPTIMIZE_FLAG_CLEAR_MASK(((SScanLogicNode*)pChild)->node.optimizedFlag, OPTIMIZE_FLAG_SCAN_PATH);
OPTIMIZE_FLAG_SET_MASK(((SScanLogicNode*)pChild)->node.optimizedFlag, OPTIMIZE_FLAG_ELIMINATE_VSCAN);
((SLogicNode*)pChild)->pParent = pVirtualScanNode->pParent;
}
INSERT_LIST(pVirtualScanNode->pParent->pChildren, pVirtualScanNode->pChildren);
Expand Down
Loading
Loading