Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0321b8c0
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看板
提交
0321b8c0
编写于
9月 22, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: avg function data scan optimization
上级
7ecda770
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
7 deletion
+24
-7
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+2
-4
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+14
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+5
-2
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+1
-1
source/libs/planner/test/planGroupByTest.cpp
source/libs/planner/test/planGroupByTest.cpp
+2
-0
未找到文件。
source/libs/function/src/builtins.c
浏览文件 @
0321b8c0
...
...
@@ -207,7 +207,6 @@ static int32_t countTrailingSpaces(const SValueNode* pVal, bool isLtrim) {
}
return
numOfSpaces
;
}
void
static
addTimezoneParam
(
SNodeList
*
pList
)
{
...
...
@@ -322,7 +321,7 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
}
int32_t
numOfSpaces
=
0
;
SNode
*
pParamNode1
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
SNode
*
pParamNode1
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
// for select trim functions with constant value from table,
// need to set the proper result result schema bytes to avoid
// trailing garbage characters
...
...
@@ -331,7 +330,6 @@ static int32_t translateTrimStr(SFunctionNode* pFunc, char* pErrBuf, int32_t len
numOfSpaces
=
countTrailingSpaces
(
pValue
,
isLtrim
);
}
int32_t
resBytes
=
pPara1
->
resType
.
bytes
-
numOfSpaces
;
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
resBytes
,
.
type
=
pPara1
->
resType
.
type
};
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2141,7 +2139,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"avg"
,
.
type
=
FUNCTION_TYPE_AVG
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SPECIAL_DATA_REQUIRED
,
.
translateFunc
=
translateInNumOutDou
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getAvgFuncEnv
,
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
0321b8c0
...
...
@@ -559,6 +559,8 @@ static const char* jkScanLogicPlanStableId = "StableId";
static
const
char
*
jkScanLogicPlanScanType
=
"ScanType"
;
static
const
char
*
jkScanLogicPlanScanCount
=
"ScanCount"
;
static
const
char
*
jkScanLogicPlanReverseScanCount
=
"ReverseScanCount"
;
static
const
char
*
jkScanLogicPlanDynamicScanFuncs
=
"DynamicScanFuncs"
;
static
const
char
*
jkScanLogicPlanDataRequired
=
"DataRequired"
;
static
const
char
*
jkScanLogicPlanTagCond
=
"TagCond"
;
static
const
char
*
jkScanLogicPlanGroupTags
=
"GroupTags"
;
...
...
@@ -590,6 +592,12 @@ static int32_t logicScanNodeToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkScanLogicPlanReverseScanCount
,
pNode
->
scanSeq
[
1
]);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkScanLogicPlanDynamicScanFuncs
,
nodeToJson
,
pNode
->
pDynamicScanFuncs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkScanLogicPlanDataRequired
,
pNode
->
dataRequired
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkScanLogicPlanTagCond
,
nodeToJson
,
pNode
->
pTagCond
);
}
...
...
@@ -629,6 +637,12 @@ static int32_t jsonToLogicScanNode(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetUTinyIntValue
(
pJson
,
jkScanLogicPlanReverseScanCount
,
&
pNode
->
scanSeq
[
1
]);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkScanLogicPlanDynamicScanFuncs
,
&
pNode
->
pDynamicScanFuncs
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkScanLogicPlanDataRequired
,
&
pNode
->
dataRequired
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkScanLogicPlanTagCond
,
&
pNode
->
pTagCond
);
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
0321b8c0
...
...
@@ -1537,6 +1537,9 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
autoCreateTbl
=
true
;
}
else
if
(
!
existedUsing
)
{
CHECK_CODE
(
getTableMeta
(
pCxt
,
tbNum
,
&
name
,
dbFName
));
if
(
TSDB_SUPER_TABLE
==
pCxt
->
pTableMeta
->
tableType
)
{
return
buildInvalidOperationMsg
(
&
pCxt
->
msg
,
"insert data into super table is not supported"
);
}
}
STableDataBlocks
*
dataBuf
=
NULL
;
...
...
@@ -2534,7 +2537,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
if
(
p
)
kv
=
*
p
;
}
if
(
kv
){
if
(
kv
)
{
int32_t
colLen
=
kv
->
length
;
if
(
pColSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
// uError("SML:data before:%" PRId64 ", precision:%d", kv->i, pTableMeta->tableInfo.precision);
...
...
@@ -2547,7 +2550,7 @@ int32_t smlBindData(void* handle, SArray* tags, SArray* colsSchema, SArray* cols
}
else
{
MemRowAppend
(
&
pBuf
,
&
(
kv
->
value
),
colLen
,
&
param
);
}
}
else
{
}
else
{
pBuilder
->
hasNone
=
true
;
}
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
0321b8c0
...
...
@@ -617,7 +617,7 @@ static bool pushDownCondOptIsPriKey(SNode* pNode, SNodeList* pTableCols) {
return
false
;
}
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
PRIMARYKEY_TIMESTAMP_COL_ID
!=
pCol
->
colId
)
{
if
(
PRIMARYKEY_TIMESTAMP_COL_ID
!=
pCol
->
colId
||
TSDB_SYSTEM_TABLE
==
pCol
->
tableType
)
{
return
false
;
}
return
pushDownCondOptBelongThisTable
(
pNode
,
pTableCols
);
...
...
source/libs/planner/test/planGroupByTest.cpp
浏览文件 @
0321b8c0
...
...
@@ -40,6 +40,8 @@ TEST_F(PlanGroupByTest, basic) {
run
(
"SELECT COUNT(*) FROM st1 GROUP BY c1"
);
run
(
"SELECT SUM(c1) FROM st1 GROUP BY c2 HAVING SUM(c1) IS NOT NULL"
);
run
(
"SELECT AVG(c1) FROM st1"
);
}
TEST_F
(
PlanGroupByTest
,
withPartitionBy
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录