fix: the problem of creating a stream without partition by clause
This commit is contained in:
parent
fa43fc455a
commit
637195ce94
|
@ -3281,9 +3281,6 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
|||
}
|
||||
|
||||
static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||
if (NULL == pSelect->pPartitionByList) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
pCxt->currClause = SQL_CLAUSE_PARTITION_BY;
|
||||
int32_t code = translateExprList(pCxt, pSelect->pPartitionByList);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
@ -5733,12 +5730,13 @@ static int32_t addSubtableNameToCreateStreamQuery(STranslateContext* pCxt, SCrea
|
|||
|
||||
static int32_t addSubtableInfoToCreateStreamQuery(STranslateContext* pCxt, STableMeta* pMeta,
|
||||
SCreateStreamStmt* pStmt) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
|
||||
if (NULL == pSelect->pPartitionByList) {
|
||||
return addNullTagsForExistTable(pCxt, pMeta, pSelect);
|
||||
code = addNullTagsForExistTable(pCxt, pMeta, pSelect);
|
||||
} else {
|
||||
code = addTagsToCreateStreamQuery(pCxt, pStmt, pSelect);
|
||||
}
|
||||
|
||||
int32_t code = addTagsToCreateStreamQuery(pCxt, pStmt, pSelect);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = addSubtableNameToCreateStreamQuery(pCxt, pStmt, pSelect);
|
||||
}
|
||||
|
|
|
@ -374,6 +374,20 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
|
|||
code = addDefaultScanCol(pRealTable->pMeta, &pScan->pScanCols);
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pTags && NULL == pSelect->pPartitionByList) {
|
||||
pScan->pTags = nodesCloneList(pSelect->pTags);
|
||||
if (NULL == pScan->pTags) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
if (TSDB_CODE_SUCCESS == code && NULL != pSelect->pSubtable && NULL == pSelect->pPartitionByList) {
|
||||
pScan->pSubtable = nodesCloneNode(pSelect->pSubtable);
|
||||
if (NULL == pScan->pSubtable) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
// set output
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = createColumnByRewriteExprs(pScan->pScanCols, &pScan->node.pTargets);
|
||||
|
|
Loading…
Reference in New Issue