Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1be41435
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看板
提交
1be41435
编写于
7月 22, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: plan problem when functions that requires a timeline is used directly in a super table
上级
ba0518e2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
23 deletion
+35
-23
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+8
-2
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+13
-19
source/libs/planner/test/planPartByTest.cpp
source/libs/planner/test/planPartByTest.cpp
+13
-1
tests/system-test/2-query/csum.py
tests/system-test/2-query/csum.py
+1
-1
未找到文件。
source/libs/executor/src/scanoperator.c
浏览文件 @
1be41435
...
@@ -2895,6 +2895,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
...
@@ -2895,6 +2895,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
int32_t
tableEndIdx
=
pInfo
->
tableEndIndex
;
int32_t
tableEndIdx
=
pInfo
->
tableEndIndex
;
STableListInfo
*
tableListInfo
=
pInfo
->
tableListInfo
;
STableListInfo
*
tableListInfo
=
pInfo
->
tableListInfo
;
pInfo
->
dataReaders
=
taosArrayInit
(
64
,
POINTER_BYTES
);
createMultipleDataReaders
(
&
pInfo
->
cond
,
&
pInfo
->
readHandle
,
tableListInfo
,
tableStartIdx
,
tableEndIdx
,
createMultipleDataReaders
(
&
pInfo
->
cond
,
&
pInfo
->
readHandle
,
tableListInfo
,
tableStartIdx
,
tableEndIdx
,
pInfo
->
dataReaders
,
GET_TASKID
(
pTaskInfo
));
pInfo
->
dataReaders
,
GET_TASKID
(
pTaskInfo
));
...
@@ -3067,7 +3068,13 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla
...
@@ -3067,7 +3068,13 @@ int32_t getTableMergeScanExplainExecInfo(SOperatorInfo* pOptr, void** pOptrExpla
int32_t
compareTableKeyInfoByGid
(
const
void
*
p1
,
const
void
*
p2
)
{
int32_t
compareTableKeyInfoByGid
(
const
void
*
p1
,
const
void
*
p2
)
{
const
STableKeyInfo
*
info1
=
p1
;
const
STableKeyInfo
*
info1
=
p1
;
const
STableKeyInfo
*
info2
=
p2
;
const
STableKeyInfo
*
info2
=
p2
;
return
info1
->
groupId
-
info2
->
groupId
;
if
(
info1
->
groupId
<
info2
->
groupId
)
{
return
-
1
;
}
else
if
(
info1
->
groupId
>
info2
->
groupId
)
{
return
1
;
}
else
{
return
0
;
}
}
}
SOperatorInfo
*
createTableMergeScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
STableListInfo
*
pTableListInfo
,
SOperatorInfo
*
createTableMergeScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
STableListInfo
*
pTableListInfo
,
...
@@ -3109,7 +3116,6 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
...
@@ -3109,7 +3116,6 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
pInfo
->
pColMatchInfo
=
pColList
;
pInfo
->
pColMatchInfo
=
pColList
;
pInfo
->
pResBlock
=
createResDataBlock
(
pDescNode
);
pInfo
->
pResBlock
=
createResDataBlock
(
pDescNode
);
pInfo
->
dataReaders
=
taosArrayInit
(
64
,
POINTER_BYTES
);
pInfo
->
sortSourceParams
=
taosArrayInit
(
64
,
sizeof
(
STableMergeScanSortSourceParam
));
pInfo
->
sortSourceParams
=
taosArrayInit
(
64
,
sizeof
(
STableMergeScanSortSourceParam
));
pInfo
->
pSortInfo
=
generateSortByTsInfo
(
pInfo
->
pColMatchInfo
,
pInfo
->
cond
.
order
);
pInfo
->
pSortInfo
=
generateSortByTsInfo
(
pInfo
->
pColMatchInfo
,
pInfo
->
cond
.
order
);
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
1be41435
...
@@ -2465,8 +2465,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
...
@@ -2465,8 +2465,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
}
}
int32_t
apercentileFunction
(
SqlFunctionCtx
*
pCtx
)
{
int32_t
apercentileFunction
(
SqlFunctionCtx
*
pCtx
)
{
int32_t
numOfElems
=
0
;
int32_t
numOfElems
=
0
;
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SColumnInfoData
*
pCol
=
pInput
->
pData
[
0
];
SColumnInfoData
*
pCol
=
pInput
->
pData
[
0
];
...
@@ -2502,7 +2502,7 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
...
@@ -2502,7 +2502,7 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
}
}
qDebug
(
"add %d elements into histogram, total:%d, numOfEntry:%d, %p"
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
qDebug
(
"add %d elements into histogram, total:%d, numOfEntry:%d, %p"
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
}
}
SET_VAL
(
pResInfo
,
numOfElems
,
1
);
SET_VAL
(
pResInfo
,
numOfElems
,
1
);
...
@@ -2542,18 +2542,17 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
...
@@ -2542,18 +2542,17 @@ static void apercentileTransferInfo(SAPercentileInfo* pInput, SAPercentileInfo*
memcpy
(
pHisto
,
pInput
->
pHisto
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
memcpy
(
pHisto
,
pInput
->
pHisto
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
}
else
{
}
else
{
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"input histogram, elem:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
qDebug
(
"input histogram, elem:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pInput
->
pHisto
);
pInput
->
pHisto
);
SHistogramInfo
*
pRes
=
tHistogramMerge
(
pHisto
,
pInput
->
pHisto
,
MAX_HISTOGRAM_BIN
);
SHistogramInfo
*
pRes
=
tHistogramMerge
(
pHisto
,
pInput
->
pHisto
,
MAX_HISTOGRAM_BIN
);
memcpy
(
pHisto
,
pRes
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
MAX_HISTOGRAM_BIN
);
memcpy
(
pHisto
,
pRes
,
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
MAX_HISTOGRAM_BIN
);
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
pHisto
->
elems
=
(
SHistBin
*
)((
char
*
)
pHisto
+
sizeof
(
SHistogramInfo
));
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
qDebug
(
"merge histo, total:%"
PRId64
", entry:%d, %p"
,
pHisto
->
numOfElems
,
pHisto
->
numOfEntries
,
pHisto
);
pHisto
);
tHistogramDestroy
(
&
pRes
);
tHistogramDestroy
(
&
pRes
);
}
}
}
}
...
@@ -2580,7 +2579,8 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
...
@@ -2580,7 +2579,8 @@ int32_t apercentileFunctionMerge(SqlFunctionCtx* pCtx) {
}
}
if
(
pInfo
->
algo
!=
APERCT_ALGO_TDIGEST
)
{
if
(
pInfo
->
algo
!=
APERCT_ALGO_TDIGEST
)
{
qDebug
(
"after merge, total:%d, numOfEntry:%d, %p"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
qDebug
(
"after merge, total:%d, numOfEntry:%d, %p"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
);
}
}
SET_VAL
(
pResInfo
,
1
,
1
);
SET_VAL
(
pResInfo
,
1
,
1
);
...
@@ -2602,7 +2602,8 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -2602,7 +2602,8 @@ int32_t apercentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
else
{
}
else
{
buildHistogramInfo
(
pInfo
);
buildHistogramInfo
(
pInfo
);
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
if
(
pInfo
->
pHisto
->
numOfElems
>
0
)
{
qDebug
(
"get the final res:%d, elements:%"
PRId64
", entry:%d"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
);
qDebug
(
"get the final res:%d, elements:%"
PRId64
", entry:%d"
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
);
double
ratio
[]
=
{
pInfo
->
percent
};
double
ratio
[]
=
{
pInfo
->
percent
};
double
*
res
=
tHistogramUniform
(
pInfo
->
pHisto
,
ratio
,
1
);
double
*
res
=
tHistogramUniform
(
pInfo
->
pHisto
,
ratio
,
1
);
...
@@ -4665,10 +4666,8 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
...
@@ -4665,10 +4666,8 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
SSumRes
*
pSumRes
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
SSumRes
*
pSumRes
=
GET_ROWCELL_INTERBUF
(
pResInfo
);
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
SInputColumnInfoData
*
pInput
=
&
pCtx
->
input
;
TSKEY
*
tsList
=
(
int64_t
*
)
pInput
->
pPTS
->
pData
;
SColumnInfoData
*
pInputCol
=
pInput
->
pData
[
0
];
SColumnInfoData
*
pInputCol
=
pInput
->
pData
[
0
];
SColumnInfoData
*
pTsOutput
=
pCtx
->
pTsOutput
;
SColumnInfoData
*
pOutput
=
(
SColumnInfoData
*
)
pCtx
->
pOutput
;
SColumnInfoData
*
pOutput
=
(
SColumnInfoData
*
)
pCtx
->
pOutput
;
int32_t
numOfElems
=
0
;
int32_t
numOfElems
=
0
;
...
@@ -4704,11 +4703,6 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
...
@@ -4704,11 +4703,6 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
}
}
}
}
// TODO: remove this after pTsOutput is handled
if
(
pTsOutput
!=
NULL
)
{
colDataAppendInt64
(
pTsOutput
,
pos
,
&
tsList
[
i
]);
}
numOfElems
++
;
numOfElems
++
;
}
}
...
@@ -5205,8 +5199,8 @@ bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) {
...
@@ -5205,8 +5199,8 @@ bool twaFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo) {
STwaInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
STwaInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
GET_RES_INFO
(
pCtx
));
pInfo
->
isNull
=
false
;
pInfo
->
isNull
=
false
;
pInfo
->
p
.
key
=
INT64_MIN
;
pInfo
->
p
.
key
=
INT64_MIN
;
pInfo
->
win
=
TSWINDOW_INITIALIZER
;
pInfo
->
win
=
TSWINDOW_INITIALIZER
;
return
true
;
return
true
;
}
}
...
...
source/libs/planner/test/planPartByTest.cpp
浏览文件 @
1be41435
...
@@ -58,7 +58,19 @@ TEST_F(PlanPartitionByTest, withInterval) {
...
@@ -58,7 +58,19 @@ TEST_F(PlanPartitionByTest, withInterval) {
TEST_F
(
PlanPartitionByTest
,
withGroupBy
)
{
TEST_F
(
PlanPartitionByTest
,
withGroupBy
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"
select count(*) from t1 partition by c1 group by
c2"
);
run
(
"
SELECT COUNT(*) FROM t1 PARTITION BY c1 GROUP BY
c2"
);
run
(
"SELECT TBNAME, c1 FROM st1 PARTITION BY TBNAME GROUP BY c1"
);
run
(
"SELECT TBNAME, c1 FROM st1 PARTITION BY TBNAME GROUP BY c1"
);
}
}
TEST_F
(
PlanPartitionByTest
,
withTimeLineFunc
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT TWA(c1) FROM st1 PARTITION BY c1"
);
}
TEST_F
(
PlanPartitionByTest
,
withSlimit
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT CSUM(c1) FROM st1 PARTITION BY TBNAME SLIMIT 1"
);
}
tests/system-test/2-query/csum.py
浏览文件 @
1be41435
...
@@ -28,7 +28,7 @@ from util.dnodes import *
...
@@ -28,7 +28,7 @@ from util.dnodes import *
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
()
,
logSql
)
def
csum_query_form
(
self
,
col
=
"c1"
,
alias
=
""
,
table_expr
=
"t1"
,
condition
=
""
):
def
csum_query_form
(
self
,
col
=
"c1"
,
alias
=
""
,
table_expr
=
"t1"
,
condition
=
""
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录