提交 3544c878 编写于 作者: X Xiaoyu Wang

create/drop/show bnode/snode/mnode frontend implement

上级 a6b5dd8e
......@@ -728,10 +728,7 @@ select_list(A) ::= select_sublist(B).
select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); }
select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); }
select_item(A) ::= common_expression(B). {
SToken t = getTokenFromRawExprNode(pCxt, B);
A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &t);
}
select_item(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); }
select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); }
select_item(A) ::= table_name(B) NK_DOT NK_STAR(C). { A = createColumnNode(pCxt, &B, &C); }
......
......@@ -205,9 +205,11 @@ SNode* createRawExprNodeExt(SAstCreateContext* pCxt, const SToken* pStart, const
SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
CHECK_RAW_EXPR_NODE(pNode);
SNode* tmp = ((SRawExprNode*)pNode)->pNode;
SRawExprNode* pRawExpr = (SRawExprNode*)pNode;
SNode* pExpr = pRawExpr->pNode;
strncpy(((SExprNode*)pExpr)->aliasName, pRawExpr->p, pRawExpr->n);
taosMemoryFreeClear(pNode);
return tmp;
return pExpr;
}
SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
......
......@@ -3415,6 +3415,7 @@ static YYACTIONTYPE yy_reduce(
{ yymsp[-1].minor.yy564 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
case 260: /* signed_literal ::= duration_literal */
case 354: /* select_item ::= common_expression */ yytestcase(yyruleno==354);
case 398: /* search_condition ::= common_expression */ yytestcase(yyruleno==398);
{ yylhsminor.yy564 = releaseRawExprNode(pCxt, yymsp[0].minor.yy564); }
yymsp[0].minor.yy564 = yylhsminor.yy564;
......@@ -3679,13 +3680,6 @@ static YYACTIONTYPE yy_reduce(
case 350: /* select_list ::= NK_STAR */
{ yymsp[0].minor.yy476 = NULL; }
break;
case 354: /* select_item ::= common_expression */
{
SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy564);
yylhsminor.yy564 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy564), &t);
}
yymsp[0].minor.yy564 = yylhsminor.yy564;
break;
case 355: /* select_item ::= common_expression column_alias */
{ yylhsminor.yy564 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy564), &yymsp[0].minor.yy21); }
yymsp[-1].minor.yy564 = yylhsminor.yy564;
......
......@@ -72,7 +72,9 @@ static EDealRes doNameExpr(SNode* pNode, void* pContext) {
case QUERY_NODE_OPERATOR:
case QUERY_NODE_LOGIC_CONDITION:
case QUERY_NODE_FUNCTION: {
sprintf(((SExprNode*)pNode)->aliasName, "#expr_%p", pNode);
if ('\0' == ((SExprNode*)pNode)->aliasName[0]) {
sprintf(((SExprNode*)pNode)->aliasName, "#expr_%p", pNode);
}
return DEAL_RES_IGNORE_CHILD;
}
default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册