Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d223a662
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d223a662
编写于
7月 05, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: execution plan problem in the mode of using qnode as much as possible
上级
f3bf7572
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
41 addition
and
27 deletion
+41
-27
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+3
-0
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+3
-19
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+7
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+2
-1
source/libs/planner/test/planBasicTest.cpp
source/libs/planner/test/planBasicTest.cpp
+2
-0
source/libs/planner/test/planOtherTest.cpp
source/libs/planner/test/planOtherTest.cpp
+0
-7
source/libs/planner/test/planTestMain.cpp
source/libs/planner/test/planTestMain.cpp
+4
-0
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+19
-0
source/libs/planner/test/planTestUtil.h
source/libs/planner/test/planTestUtil.h
+1
-0
未找到文件。
source/libs/parser/src/parTranslater.c
浏览文件 @
d223a662
...
...
@@ -1333,6 +1333,9 @@ static int32_t rewriteSystemInfoFuncImpl(STranslateContext* pCxt, char* pLiteral
pVal
->
isNull
=
true
;
}
else
{
pVal
->
literal
=
pLiteral
;
if
(
IS_VAR_DATA_TYPE
(
pVal
->
node
.
resType
.
type
))
{
pVal
->
node
.
resType
.
bytes
=
strlen
(
pLiteral
);
}
}
if
(
DEAL_RES_ERROR
!=
translateValue
(
pCxt
,
pVal
))
{
*
pNode
=
(
SNode
*
)
pVal
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
d223a662
...
...
@@ -236,7 +236,6 @@ int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char*
const
char
*
prefix
=
"syntax error"
;
if
(
sourceStr
==
NULL
)
{
assert
(
additionalInfo
!=
NULL
);
snprintf
(
pBuf
->
buf
,
pBuf
->
len
,
msgFormat1
,
additionalInfo
);
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
...
...
@@ -254,40 +253,25 @@ int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char*
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
}
SSchema
*
getTableColumnSchema
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
return
(
SSchema
*
)
pTableMeta
->
schema
;
}
SSchema
*
getTableColumnSchema
(
const
STableMeta
*
pTableMeta
)
{
return
(
SSchema
*
)
pTableMeta
->
schema
;
}
static
SSchema
*
getOneColumnSchema
(
const
STableMeta
*
pTableMeta
,
int32_t
colIndex
)
{
assert
(
pTableMeta
!=
NULL
&&
pTableMeta
->
schema
!=
NULL
&&
colIndex
>=
0
&&
colIndex
<
(
getNumOfColumns
(
pTableMeta
)
+
getNumOfTags
(
pTableMeta
)));
SSchema
*
pSchema
=
(
SSchema
*
)
pTableMeta
->
schema
;
return
&
pSchema
[
colIndex
];
}
SSchema
*
getTableTagSchema
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
&&
(
pTableMeta
->
tableType
==
TSDB_SUPER_TABLE
||
pTableMeta
->
tableType
==
TSDB_CHILD_TABLE
));
return
getOneColumnSchema
(
pTableMeta
,
getTableInfo
(
pTableMeta
).
numOfColumns
);
}
int32_t
getNumOfColumns
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
// table created according to super table, use data from super table
return
getTableInfo
(
pTableMeta
).
numOfColumns
;
}
int32_t
getNumOfTags
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
return
getTableInfo
(
pTableMeta
).
numOfTags
;
}
int32_t
getNumOfTags
(
const
STableMeta
*
pTableMeta
)
{
return
getTableInfo
(
pTableMeta
).
numOfTags
;
}
STableComInfo
getTableInfo
(
const
STableMeta
*
pTableMeta
)
{
assert
(
pTableMeta
!=
NULL
);
return
pTableMeta
->
tableInfo
;
}
STableComInfo
getTableInfo
(
const
STableMeta
*
pTableMeta
)
{
return
pTableMeta
->
tableInfo
;
}
STableMeta
*
tableMetaDup
(
const
STableMeta
*
pTableMeta
)
{
size_t
size
=
TABLE_META_SIZE
(
pTableMeta
);
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
d223a662
...
...
@@ -75,6 +75,11 @@ static SLogicNode* optFindPossibleNode(SLogicNode* pNode, FMayBeOptimized func)
return
NULL
;
}
static
void
optResetParent
(
SLogicNode
*
pNode
)
{
SNode
*
pChild
=
NULL
;
FOREACH
(
pChild
,
pNode
->
pChildren
)
{
((
SLogicNode
*
)
pChild
)
->
pParent
=
pNode
;
}
}
EDealRes
scanPathOptHaveNormalColImpl
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
// *((bool*)pContext) = (COLUMN_TYPE_TAG != ((SColumnNode*)pNode)->colType);
...
...
@@ -1460,6 +1465,7 @@ static int32_t rewriteTailOptCreateSort(SIndefRowsFuncLogicNode* pIndef, SLogicN
pSort
->
groupSort
=
rewriteTailOptNeedGroupSort
(
pIndef
);
TSWAP
(
pSort
->
node
.
pChildren
,
pIndef
->
node
.
pChildren
);
optResetParent
((
SLogicNode
*
)
pSort
);
pSort
->
node
.
precision
=
pIndef
->
node
.
precision
;
SFunctionNode
*
pTail
=
NULL
;
...
...
@@ -1667,6 +1673,7 @@ static int32_t rewriteUniqueOptCreateAgg(SIndefRowsFuncLogicNode* pIndef, SLogic
}
TSWAP
(
pAgg
->
node
.
pChildren
,
pIndef
->
node
.
pChildren
);
optResetParent
((
SLogicNode
*
)
pAgg
);
pAgg
->
node
.
precision
=
pIndef
->
node
.
precision
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
d223a662
...
...
@@ -1203,7 +1203,8 @@ typedef struct SQnodeSplitInfo {
static
bool
qndSplFindSplitNode
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
SLogicNode
*
pNode
,
SQnodeSplitInfo
*
pInfo
)
{
if
(
QUERY_NODE_LOGIC_PLAN_SCAN
==
nodeType
(
pNode
)
&&
NULL
!=
pNode
->
pParent
)
{
if
(
QUERY_NODE_LOGIC_PLAN_SCAN
==
nodeType
(
pNode
)
&&
NULL
!=
pNode
->
pParent
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
0
]
<
1
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
1
]
<
1
)
{
pInfo
->
pSplitNode
=
pNode
;
pInfo
->
pSubplan
=
pSubplan
;
return
true
;
...
...
source/libs/planner/test/planBasicTest.cpp
浏览文件 @
d223a662
...
...
@@ -81,6 +81,8 @@ TEST_F(PlanBasicTest, tailFunc) {
run
(
"SELECT TAIL(c2 + 10, 10, 80) FROM t1 WHERE c1 > 10 PARTITION BY c1 LIMIT 5"
);
run
(
"SELECT TAIL(c1, 2, 1) FROM st1s1 UNION ALL SELECT c1 FROM st1s2"
);
run
(
"SELECT TAIL(c1, 1) FROM st2 WHERE jtag->'tag1' > 10"
);
}
TEST_F
(
PlanBasicTest
,
interpFunc
)
{
...
...
source/libs/planner/test/planOtherTest.cpp
浏览文件 @
d223a662
...
...
@@ -91,10 +91,3 @@ TEST_F(PlanOtherTest, delete) {
run
(
"DELETE FROM st1 WHERE ts > now - 2d and ts < now - 1d AND tag1 = 10"
);
}
TEST_F
(
PlanOtherTest
,
queryPolicy
)
{
useDb
(
"root"
,
"test"
);
tsQueryPolicy
=
QUERY_POLICY_QNODE
;
run
(
"SELECT COUNT(*) FROM st1"
);
}
source/libs/planner/test/planTestMain.cpp
浏览文件 @
d223a662
...
...
@@ -78,6 +78,7 @@ static void parseArg(int argc, char* argv[]) {
{
"skipSql"
,
required_argument
,
NULL
,
's'
},
{
"limitSql"
,
required_argument
,
NULL
,
'i'
},
{
"log"
,
required_argument
,
NULL
,
'l'
},
{
"queryPolicy"
,
required_argument
,
NULL
,
'q'
},
{
0
,
0
,
0
,
0
}
};
// clang-format on
...
...
@@ -95,6 +96,9 @@ static void parseArg(int argc, char* argv[]) {
case
'l'
:
setLogLevel
(
optarg
);
break
;
case
'q'
:
setQueryPolicy
(
optarg
);
break
;
default:
break
;
}
...
...
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
d223a662
...
...
@@ -24,6 +24,7 @@
#include "mockCatalogService.h"
#include "parser.h"
#include "planInt.h"
#include "tglobal.h"
using
namespace
std
;
using
namespace
testing
;
...
...
@@ -53,6 +54,7 @@ DumpModule g_dumpModule = DUMP_MODULE_NOTHING;
int32_t
g_skipSql
=
0
;
int32_t
g_limitSql
=
0
;
int32_t
g_logLevel
=
131
;
int32_t
g_queryPolicy
=
QUERY_POLICY_VNODE
;
void
setDumpModule
(
const
char
*
pModule
)
{
if
(
NULL
==
pModule
)
{
...
...
@@ -79,6 +81,7 @@ void setDumpModule(const char* pModule) {
void
setSkipSqlNum
(
const
char
*
pNum
)
{
g_skipSql
=
stoi
(
pNum
);
}
void
setLimitSqlNum
(
const
char
*
pNum
)
{
g_limitSql
=
stoi
(
pNum
);
}
void
setLogLevel
(
const
char
*
pLogLevel
)
{
g_logLevel
=
stoi
(
pLogLevel
);
}
void
setQueryPolicy
(
const
char
*
pQueryPolicy
)
{
g_queryPolicy
=
stoi
(
pQueryPolicy
);
}
int32_t
getLogLevel
()
{
return
g_logLevel
;
}
...
...
@@ -105,7 +108,23 @@ class PlannerTestBaseImpl {
}
++
sqlNum_
;
switch
(
g_queryPolicy
)
{
case
QUERY_POLICY_VNODE
:
case
QUERY_POLICY_HYBRID
:
case
QUERY_POLICY_QNODE
:
runImpl
(
sql
,
g_queryPolicy
);
break
;
default:
runImpl
(
sql
,
QUERY_POLICY_VNODE
);
runImpl
(
sql
,
QUERY_POLICY_HYBRID
);
runImpl
(
sql
,
QUERY_POLICY_QNODE
);
break
;
}
}
void
runImpl
(
const
string
&
sql
,
int32_t
queryPolicy
)
{
reset
();
tsQueryPolicy
=
queryPolicy
;
try
{
SQuery
*
pQuery
=
nullptr
;
doParseSql
(
sql
,
&
pQuery
);
...
...
source/libs/planner/test/planTestUtil.h
浏览文件 @
d223a662
...
...
@@ -45,6 +45,7 @@ extern void setDumpModule(const char* pModule);
extern
void
setSkipSqlNum
(
const
char
*
pNum
);
extern
void
setLimitSqlNum
(
const
char
*
pNum
);
extern
void
setLogLevel
(
const
char
*
pLogLevel
);
extern
void
setQueryPolicy
(
const
char
*
pQueryPolicy
);
extern
int32_t
getLogLevel
();
#endif // PLAN_TEST_UTIL_H
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录