Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: cols function #29880

Open
wants to merge 44 commits into
base: 3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7964e5e
cols function
facetosea Dec 9, 2024
20f8d17
cols func
facetosea Dec 19, 2024
e26a356
cols function
facetosea Dec 25, 2024
504a8af
fix: select_value function slotid
facetosea Dec 25, 2024
c371fb2
fix: bindTupleFuncindex
facetosea Dec 25, 2024
983431b
cols
facetosea Dec 26, 2024
465f195
fix: cols func
facetosea Dec 27, 2024
de80108
enh: cols func
facetosea Dec 27, 2024
2611eef
fix: mem leak
facetosea Dec 29, 2024
d3fa16b
test
facetosea Dec 29, 2024
d3e86d9
cols
facetosea Dec 30, 2024
772c37b
fix: empty block
facetosea Jan 1, 2025
cb1ed29
error desc in doc
facetosea Jan 2, 2025
9a34af9
build on win
facetosea Jan 2, 2025
908d69f
fxi: alias name is too long
facetosea Jan 3, 2025
8d45b04
test case
facetosea Jan 3, 2025
fa3cd81
parerlog
facetosea Jan 3, 2025
65e0990
merge 3.0
facetosea Jan 23, 2025
b1f1c2e
test case: test cols name
facetosea Jan 23, 2025
7e553f7
fxi: use the same agg func outside of cols
facetosea Jan 23, 2025
fbe345a
fix: cols funcs, sub query
facetosea Feb 5, 2025
b461ec0
fix: ts in subquery
facetosea Feb 5, 2025
6ba3edf
test case
facetosea Feb 6, 2025
3c0121e
unused code
facetosea Feb 11, 2025
fa203ca
cols in stream
facetosea Feb 11, 2025
44f6859
unused code
facetosea Feb 12, 2025
e16b96d
enh: translate cols in clauses
facetosea Feb 13, 2025
a391cc4
cols in order clause
facetosea Feb 13, 2025
26fb867
cols test
facetosea Feb 14, 2025
c4cc51b
cols: use aggfunc
facetosea Feb 15, 2025
9d86f48
fix: select_value node name
facetosea Feb 17, 2025
8a7b633
fix: alias name length
facetosea Feb 17, 2025
00473a9
fix: aliasName too long
facetosea Feb 18, 2025
bd3a36b
rewrite aliasname
facetosea Feb 18, 2025
5c64684
fix: select tbname when use multi select function
facetosea Feb 18, 2025
a29ddcc
fix: rewirte to groupkey func
facetosea Feb 18, 2025
01518aa
fix: result error
facetosea Feb 19, 2025
4a3343a
enh: cols in having clause
facetosea Feb 19, 2025
71bdb6f
nullTuple pos
facetosea Feb 20, 2025
75984e6
fix: group const value
facetosea Feb 20, 2025
d6f05d4
return code
facetosea Feb 20, 2025
d9bbe0d
return code
facetosea Feb 20, 2025
fa61c13
fix: _group_key not select
facetosea Feb 20, 2025
0f951ae
delete nulltuplepos
facetosea Feb 21, 2025
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
Prev Previous commit
Next Next commit
return code
  • Loading branch information
facetosea committed Feb 20, 2025
commit d9bbe0d888205e2635ee2f73227690f6b6ebe687
4 changes: 1 addition & 3 deletions source/libs/executor/src/executil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,6 +1955,7 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
QUERY_CHECK_CODE(code, lino, _end);
}
}
pExp->pExpr->_function.bindExprID = ((SExprNode*)pNode)->bindExprID;
} else if (type == QUERY_NODE_OPERATOR) {
pExp->pExpr->nodeType = QUERY_NODE_OPERATOR;
SOperatorNode* pOpNode = (SOperatorNode*)pNode;
Expand Down Expand Up @@ -1992,9 +1993,6 @@ int32_t createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
QUERY_CHECK_CODE(code, lino, _end);
}
if (type == QUERY_NODE_FUNCTION) {
pExp->pExpr->_function.bindExprID = ((SExprNode*)pNode)->bindExprID;
}
pExp->pExpr->relatedTo = ((SExprNode*)pNode)->relatedTo;
_end:
if (code != TSDB_CODE_SUCCESS) {
Expand Down
2 changes: 1 addition & 1 deletion source/libs/nodes/src/nodesUtilFuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3241,7 +3241,7 @@ int32_t nodesListDeduplicate(SNodeList** ppList) {
}

void rewriteExprAliasName(SExprNode* pNode, int64_t num) {
tsnprintf(pNode->aliasName, TSDB_COL_NAME_LEN, "expr_%x", num);
(void)tsnprintf(pNode->aliasName, TSDB_COL_NAME_LEN, "expr_%x", num);
return;
}

Expand Down
13 changes: 10 additions & 3 deletions source/libs/parser/src/parTranslater.c
Original file line number Diff line number Diff line change
Expand Up @@ -7428,8 +7428,11 @@ static EDealRes pushDownBindSelectFunc(SNode** pNode, void* pContext) {
if (nodesIsExprNode(*pNode)) {
SExprNode* pExpr = (SExprNode*)*pNode;
pExpr->relatedTo = pCxt->bindExprID;
if (nodeType(*pNode) != QUERY_NODE_COLUMN) {
return DEAL_RES_CONTINUE;
}

if (isRelatedToOtherExpr(pExpr) && *pNode != pCxt->root) {
if (*pNode != pCxt->root) {
int len = strlen(pExpr->aliasName);
if (len + TSDB_COL_NAME_EXLEN >= TSDB_COL_NAME_LEN) {
char buffer[TSDB_COL_NAME_EXLEN + TSDB_COL_NAME_LEN + 1] = {0};
Expand Down Expand Up @@ -7609,6 +7612,7 @@ static int32_t rewriteColsFunction(STranslateContext* pCxt, SNodeList** nodeList
}

SNodeList* pNewNodeList = NULL;
SNode* pNewNode = NULL;
if (needRewrite) {
if (pCxt->createStream) {
return TSDB_CODE_PAR_INVALID_COLS_FUNCTION;
Expand All @@ -7625,7 +7629,6 @@ static int32_t rewriteColsFunction(STranslateContext* pCxt, SNodeList** nodeList
}
}

SNode* pNewNode = NULL;
int32_t nums = 0;
int32_t selectFuncCount = (*selectFuncList)->length;
SNode* pTmpNode = NULL;
Expand All @@ -7649,14 +7652,17 @@ static int32_t rewriteColsFunction(STranslateContext* pCxt, SNodeList** nodeList
++selectFuncCount;
selectFuncIndex = selectFuncCount;
code = nodesCloneNode(pSelectFunc, &pNewNode);
if(TSDB_CODE_SUCCESS != code) goto _end;
((SExprNode*)pNewNode)->bindExprID = selectFuncIndex;
nodesListMakeStrictAppend(selectFuncList, pNewNode);
code = nodesListMakeStrictAppend(selectFuncList, pNewNode);
if(TSDB_CODE_SUCCESS != code) goto _end;
}
// start from index 1, because the first parameter is select function which needn't to output.
for (int i = 1; i < pFunc->pParameterList->length; ++i) {
SNode* pExpr = nodesListGetNode(pFunc->pParameterList, i);

code = nodesCloneNode(pExpr, &pNewNode);
if(TSDB_CODE_SUCCESS != code) goto _end;
if (nodesIsExprNode(pNewNode)) {
SBindTupleFuncCxt pCxt = {pNewNode, selectFuncIndex};
nodesRewriteExpr(&pNewNode, pushDownBindSelectFunc, &pCxt);
Expand All @@ -7683,6 +7689,7 @@ static int32_t rewriteColsFunction(STranslateContext* pCxt, SNodeList** nodeList
}
_end:
if (TSDB_CODE_SUCCESS != code) {
nodesDestroyNode(pNewNode);
nodesDestroyList(pNewNodeList);
}
return code;
Expand Down
Loading