Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
TDengine
提交
2e789723
T
TDengine
项目概览
jobily
/
TDengine
9 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2e789723
编写于
8月 30, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: trim block and partition by constant function issue
上级
255de5c2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
0 deletion
+51
-0
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-0
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+17
-0
source/libs/executor/src/executorInt.c
source/libs/executor/src/executorInt.c
+1
-0
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+10
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+22
-0
未找到文件。
include/libs/function/functionMgt.h
浏览文件 @
2e789723
...
...
@@ -235,6 +235,7 @@ bool fmIsCumulativeFunc(int32_t funcId);
bool
fmIsInterpPseudoColumnFunc
(
int32_t
funcId
);
bool
fmIsGroupKeyFunc
(
int32_t
funcId
);
bool
fmIsBlockDistFunc
(
int32_t
funcId
);
bool
fmIsConstantResFunc
(
SFunctionNode
*
pFunc
);
void
getLastCacheDataType
(
SDataType
*
pType
);
SFunctionNode
*
createFunction
(
const
char
*
pName
,
SNodeList
*
pParameterList
);
...
...
source/common/src/tdatablock.c
浏览文件 @
2e789723
...
...
@@ -2359,6 +2359,23 @@ void trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList
int32_t
maxRows
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
// it is a reserved column for scalar function, and no data in this column yet.
if
(
pDst
->
pData
==
NULL
)
{
continue
;
}
int32_t
numOfRows
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pDst
->
info
.
type
))
{
pDst
->
varmeta
.
length
=
0
;
}
}
if
(
NULL
==
pBoolList
)
{
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
// it is a reserved column for scalar function, and no data in this column yet.
...
...
source/libs/executor/src/executorInt.c
浏览文件 @
2e789723
...
...
@@ -547,6 +547,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoD
if
(
status
==
FILTER_RESULT_ALL_QUALIFIED
)
{
// here nothing needs to be done
}
else
if
(
status
==
FILTER_RESULT_NONE_QUALIFIED
)
{
trimDataBlock
(
pBlock
,
pBlock
->
info
.
rows
,
NULL
);
pBlock
->
info
.
rows
=
0
;
}
else
if
(
status
==
FILTER_RESULT_PARTIAL_QUALIFIED
)
{
trimDataBlock
(
pBlock
,
pBlock
->
info
.
rows
,
(
bool
*
)
pIndicator
);
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
2e789723
...
...
@@ -336,6 +336,16 @@ bool fmIsSameInOutType(int32_t funcId) {
return
res
;
}
bool
fmIsConstantResFunc
(
SFunctionNode
*
pFunc
)
{
SNode
*
pNode
;
FOREACH
(
pNode
,
pFunc
->
pParameterList
)
{
if
(
nodeType
(
pNode
)
!=
QUERY_NODE_VALUE
)
{
return
false
;
}
}
return
true
;
}
void
getLastCacheDataType
(
SDataType
*
pType
)
{
pType
->
bytes
=
getFirstLastInfoSize
(
pType
->
bytes
)
+
VARSTR_HEADER_SIZE
;
pType
->
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
2e789723
...
...
@@ -3727,11 +3727,33 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
return
code
;
}
static
int32_t
removeConstantValueFromList
(
SNodeList
**
pList
)
{
SNode
*
pNode
=
NULL
;
WHERE_EACH
(
pNode
,
*
pList
)
{
if
(
nodeType
(
pNode
)
==
QUERY_NODE_VALUE
||
(
nodeType
(
pNode
)
==
QUERY_NODE_FUNCTION
&&
fmIsConstantResFunc
((
SFunctionNode
*
)
pNode
)))
{
ERASE_NODE
(
*
pList
);
continue
;
}
WHERE_NEXT
;
}
if
(
*
pList
&&
(
*
pList
)
->
length
<=
0
)
{
nodesDestroyList
(
*
pList
);
*
pList
=
NULL
;
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translatePartitionBy
(
STranslateContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
pCxt
->
currClause
=
SQL_CLAUSE_PARTITION_BY
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
pSelect
->
pPartitionByList
)
{
code
=
removeConstantValueFromList
(
&
pSelect
->
pPartitionByList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
pSelect
->
pPartitionByList
)
{
int8_t
typeType
=
getTableTypeFromTableNode
(
pSelect
->
pFromTable
);
SNode
*
pPar
=
nodesListGetNode
(
pSelect
->
pPartitionByList
,
0
);
if
(
!
((
TSDB_NORMAL_TABLE
==
typeType
||
TSDB_CHILD_TABLE
==
typeType
)
&&
1
==
pSelect
->
pPartitionByList
->
length
&&
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录