Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f4964243
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f4964243
编写于
3月 26, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
3月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11028 from taosdata/feature/3.0_wxy
bugfix
上级
549bce34
ad11ba93
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
28 deletion
+25
-28
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+13
-18
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+10
-1
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+2
-9
未找到文件。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
f4964243
...
...
@@ -851,9 +851,7 @@ static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
int32_t
val
;
code
=
tjsonGetIntValue
(
pJson
,
jkJoinPhysiPlanJoinType
,
&
val
);
pNode
->
joinType
=
val
;
code
=
tjsonGetNumberValue
(
pJson
,
jkJoinPhysiPlanJoinType
,
pNode
->
joinType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkJoinPhysiPlanOnConditions
,
&
pNode
->
pOnConditions
);
...
...
@@ -1216,9 +1214,7 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
int32_t
code
=
tjsonToObject
(
pJson
,
jkSubplanId
,
jsonToSubplanId
,
&
pNode
->
id
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
int32_t
val
;
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanType
,
&
val
);
pNode
->
subplanType
=
val
;
code
=
tjsonGetNumberValue
(
pJson
,
jkSubplanType
,
pNode
->
subplanType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanMsgType
,
&
pNode
->
msgType
);
...
...
@@ -1408,9 +1404,7 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetSmallIntValue
(
pJson
,
jkColumnColId
,
&
pNode
->
colId
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
int32_t
tmp
;
code
=
tjsonGetIntValue
(
pJson
,
jkColumnColType
,
&
tmp
);
pNode
->
colType
=
tmp
;
code
=
tjsonGetNumberValue
(
pJson
,
jkColumnColType
,
pNode
->
colType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkColumnDbName
,
pNode
->
dbName
);
...
...
@@ -1598,9 +1592,7 @@ static int32_t jsonToOperatorNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
int32_t
val
;
code
=
tjsonGetIntValue
(
pJson
,
jkOperatorType
,
&
val
);
pNode
->
opType
=
val
;
code
=
tjsonGetNumberValue
(
pJson
,
jkOperatorType
,
pNode
->
opType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkOperatorLeft
,
&
pNode
->
pLeft
);
...
...
@@ -1634,9 +1626,7 @@ static int32_t jsonToLogicConditionNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
int32_t
val
;
code
=
tjsonGetIntValue
(
pJson
,
jkLogicCondType
,
&
val
);
pNode
->
condType
=
val
;
code
=
tjsonGetNumberValue
(
pJson
,
jkLogicCondType
,
pNode
->
condType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkLogicCondParameters
,
&
pNode
->
pParameterList
);
...
...
@@ -1895,6 +1885,7 @@ static const char* jkIntervalWindowInterval = "Interval";
static
const
char
*
jkIntervalWindowOffset
=
"Offset"
;
static
const
char
*
jkIntervalWindowSliding
=
"Sliding"
;
static
const
char
*
jkIntervalWindowFill
=
"Fill"
;
static
const
char
*
jkIntervalWindowTsPk
=
"TsPk"
;
static
int32_t
intervalWindowNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SIntervalWindowNode
*
pNode
=
(
const
SIntervalWindowNode
*
)
pObj
;
...
...
@@ -1909,6 +1900,9 @@ static int32_t intervalWindowNodeToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkIntervalWindowFill
,
nodeToJson
,
pNode
->
pFill
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkIntervalWindowTsPk
,
nodeToJson
,
pNode
->
pCol
);
}
return
code
;
}
...
...
@@ -1926,6 +1920,9 @@ static int32_t jsonToIntervalWindowNode(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkIntervalWindowFill
,
&
pNode
->
pFill
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkIntervalWindowTsPk
,
&
pNode
->
pCol
);
}
return
code
;
}
...
...
@@ -2436,9 +2433,7 @@ static int32_t nodeToJson(const void* pObj, SJson* pJson) {
static
int32_t
jsonToNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
SNode
*
pNode
=
(
SNode
*
)
pObj
;
int32_t
val
=
0
;
int32_t
code
=
tjsonGetIntValue
(
pJson
,
jkNodeType
,
&
val
);
pNode
->
type
=
val
;
int32_t
code
=
tjsonGetNumberValue
(
pJson
,
jkNodeType
,
pNode
->
type
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonToObject
(
pJson
,
nodesNodeName
(
pNode
->
type
),
jsonToSpecificNode
,
pNode
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
f4964243
...
...
@@ -1452,6 +1452,7 @@ static int32_t getSmaIndexBuildAst(STranslateContext* pCxt, SCreateIndexStmt* pS
if
(
NULL
==
pSelect
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
sprintf
(
pSelect
->
stmtName
,
"%p"
,
pSelect
);
SRealTableNode
*
pTable
=
nodesMakeNode
(
QUERY_NODE_REAL_TABLE
);
if
(
NULL
==
pTable
)
{
...
...
@@ -1467,6 +1468,10 @@ static int32_t getSmaIndexBuildAst(STranslateContext* pCxt, SCreateIndexStmt* pS
nodesDestroyNode
(
pSelect
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SNode
*
pProject
=
NULL
;
FOREACH
(
pProject
,
pSelect
->
pProjectionList
)
{
sprintf
(((
SExprNode
*
)
pProject
)
->
aliasName
,
"#sma_%p"
,
pProject
);
}
SIntervalWindowNode
*
pInterval
=
nodesMakeNode
(
QUERY_NODE_INTERVAL_WINDOW
);
if
(
NULL
==
pInterval
)
{
...
...
@@ -1474,14 +1479,18 @@ static int32_t getSmaIndexBuildAst(STranslateContext* pCxt, SCreateIndexStmt* pS
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pSelect
->
pWindow
=
(
SNode
*
)
pInterval
;
pInterval
->
pCol
=
nodesMakeNode
(
QUERY_NODE_COLUMN
);
pInterval
->
pInterval
=
nodesCloneNode
(
pStmt
->
pOptions
->
pInterval
);
pInterval
->
pOffset
=
nodesCloneNode
(
pStmt
->
pOptions
->
pOffset
);
pInterval
->
pSliding
=
nodesCloneNode
(
pStmt
->
pOptions
->
pSliding
);
if
(
NULL
==
pInterval
->
pInterval
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
NULL
==
pInterval
->
pOffset
)
||
if
(
NULL
==
pInterval
->
pCol
||
NULL
==
pInterval
->
pInterval
||
(
NULL
!=
pStmt
->
pOptions
->
pOffset
&&
NULL
==
pInterval
->
pOffset
)
||
(
NULL
!=
pStmt
->
pOptions
->
pSliding
&&
NULL
==
pInterval
->
pSliding
))
{
nodesDestroyNode
(
pSelect
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
((
SColumnNode
*
)
pInterval
->
pCol
)
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
strcpy
(((
SColumnNode
*
)
pInterval
->
pCol
)
->
colName
,
PK_TS_COL_INTERNAL_NAME
);
int32_t
code
=
translateQuery
(
pCxt
,
(
SNode
*
)
pSelect
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
f4964243
...
...
@@ -67,17 +67,12 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) {
return
DEAL_RES_CONTINUE
;
}
typedef
struct
SNameExprCxt
{
int32_t
rewriteId
;
}
SNameExprCxt
;
static
EDealRes
doNameExpr
(
SNode
*
pNode
,
void
*
pContext
)
{
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_OPERATOR
:
case
QUERY_NODE_LOGIC_CONDITION
:
case
QUERY_NODE_FUNCTION
:
{
SNameExprCxt
*
pCxt
=
(
SNameExprCxt
*
)
pContext
;
sprintf
(((
SExprNode
*
)
pNode
)
->
aliasName
,
"#expr_%d"
,
pCxt
->
rewriteId
++
);
sprintf
(((
SExprNode
*
)
pNode
)
->
aliasName
,
"#expr_%p"
,
pNode
);
return
DEAL_RES_IGNORE_CHILD
;
}
default:
...
...
@@ -88,9 +83,7 @@ static EDealRes doNameExpr(SNode* pNode, void* pContext) {
}
static
int32_t
rewriteExpr
(
SNodeList
*
pExprs
,
SSelectStmt
*
pSelect
,
ESqlClause
clause
)
{
static
int32_t
rewriteId
=
1
;
// todo modify
SNameExprCxt
nameCxt
=
{
.
rewriteId
=
rewriteId
};
nodesWalkList
(
pExprs
,
doNameExpr
,
&
nameCxt
);
nodesWalkList
(
pExprs
,
doNameExpr
,
NULL
);
SRewriteExprCxt
cxt
=
{
.
errCode
=
TSDB_CODE_SUCCESS
,
.
pExprs
=
pExprs
};
nodesRewriteSelectStmt
(
pSelect
,
clause
,
doRewriteExpr
,
&
cxt
);
return
cxt
.
errCode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录