Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e5d25f46
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
e5d25f46
编写于
6月 21, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): set correct ts column index in interp executor.
上级
1bf7fbbc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
49 deletion
+63
-49
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+46
-43
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+12
-4
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+5
-2
未找到文件。
source/client/test/clientTests.cpp
浏览文件 @
e5d25f46
...
...
@@ -43,6 +43,26 @@ void showDB(TAOS* pConn) {
}
}
void
printResult
(
TAOS_RES
*
pRes
)
{
TAOS_ROW
pRow
=
NULL
;
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
int32_t
n
=
0
;
char
str
[
512
]
=
{
0
};
while
((
pRow
=
taos_fetch_row
(
pRes
))
!=
NULL
)
{
int32_t
*
length
=
taos_fetch_lengths
(
pRes
);
for
(
int32_t
i
=
0
;
i
<
numOfFields
;
++
i
)
{
printf
(
"(%d):%d "
,
i
,
length
[
i
]);
}
printf
(
"
\n
"
);
int32_t
code
=
taos_print_row
(
str
,
pRow
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
str
);
memset
(
str
,
0
,
sizeof
(
str
));
}
}
void
fetchCallback
(
void
*
param
,
void
*
res
,
int32_t
numOfRow
)
{
#if 0
printf("numOfRow = %d \n", numOfRow);
...
...
@@ -729,48 +749,31 @@ TEST(testCase, projection_query_tables) {
// taos_close(pConn);
//}
//TEST(testCase, agg_query_tables) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// ASSERT_NE(pConn, nullptr);
//
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
// if (taos_errno(pRes) != 0) {
// printf("failed to use db, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "show stables");
// if (taos_errno(pRes) != 0) {
// printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
//
// TAOS_ROW pRow = NULL;
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// int32_t numOfFields = taos_num_fields(pRes);
//
// int32_t n = 0;
// char str[512] = {0};
// while ((pRow = taos_fetch_row(pRes)) != NULL) {
// int32_t* length = taos_fetch_lengths(pRes);
// for(int32_t i = 0; i < numOfFields; ++i) {
// printf("(%d):%d " , i, length[i]);
// }
// printf("\n");
//
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
// printf("%s\n", str);
// memset(str, 0, sizeof(str));
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
#endif
TEST(testCase, agg_query_tables) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr);
TAOS_RES* pRes = taos_query(pConn, "use abc1");
if (taos_errno(pRes) != 0) {
printf("failed to use db, reason:%s\n", taos_errstr(pRes));
taos_free_result(pRes);
ASSERT_TRUE(false);
}
taos_free_result(pRes);
pRes = taos_query(pConn, "show table distributed st1");
if (taos_errno(pRes) != 0) {
printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
taos_free_result(pRes);
ASSERT_TRUE(false);
}
printResult(pRes);
taos_free_result(pRes);
taos_close(pConn);
}
#endif
/*
--- copy the following script in the shell to setup the environment ---
...
...
@@ -786,7 +789,7 @@ TEST(testCase, async_api_test) {
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
ASSERT_NE
(
pConn
,
nullptr
);
taos_query
(
pConn
,
"use
table_alltype_hyperloglog
"
);
taos_query
(
pConn
,
"use
abc1
"
);
#if 0
TAOS_RES* pRes = taos_query(pConn, "insert into tu(ts) values('2022-02-27 12:12:61')");
if (taos_errno(pRes) != 0) {
...
...
@@ -812,7 +815,7 @@ TEST(testCase, async_api_test) {
}
#endif
taos_query_a
(
pConn
,
"select
HYPERLOGLOG(q_ts) from stable_1_2 where ts between 1630000001000 and 1630100001000 interval(19d) Fill(NONE);
"
,
queryCallback
,
pConn
);
taos_query_a
(
pConn
,
"select
count(*) from tu
"
,
queryCallback
,
pConn
);
getchar
();
taos_close
(
pConn
);
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
e5d25f46
...
...
@@ -1888,13 +1888,13 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
int32_t
srcSlot
=
pExprInfo
->
base
.
pParam
[
0
].
pCol
->
slotId
;
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pBlock
->
pDataBlock
,
srcSlot
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlot
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
p
Res
Block
->
pDataBlock
,
dstSlot
);
char
*
v
=
colDataGetData
(
pSrc
,
i
);
colDataAppend
(
pDst
,
numOfRows
,
v
,
false
);
}
numOfR
ows
+=
1
;
pResBlock
->
info
.
r
ows
+=
1
;
doKeepPrevRows
(
pSliceInfo
,
pBlock
,
i
);
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
...
...
@@ -1902,15 +1902,21 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
break
;
}
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
else
if
(
ts
<
pSliceInfo
->
current
)
{
if
(
i
<
pBlock
->
info
.
rows
-
1
)
{
int64_t
nextTs
=
*
(
int64_t
*
)
colDataGetData
(
pTsCol
,
i
+
1
);
if
(
nextTs
>
pSliceInfo
->
current
)
{
while
(
pSliceInfo
->
current
<
nextTs
&&
pSliceInfo
->
current
<=
pSliceInfo
->
win
.
ekey
)
{
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pBlock
,
i
,
pResBlock
);
numOfRows
+=
1
;
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
...
@@ -1926,9 +1932,11 @@ static SSDataBlock* doTimeslice(SOperatorInfo* pOperator) {
}
else
{
// ts > pSliceInfo->current
while
(
pSliceInfo
->
current
<
ts
&&
pSliceInfo
->
current
<=
pSliceInfo
->
win
.
ekey
)
{
genInterpolationResult
(
pSliceInfo
,
&
pOperator
->
exprSupp
,
pBlock
,
i
,
pResBlock
);
numOfRows
+=
1
;
pSliceInfo
->
current
=
taosTimeAdd
(
pSliceInfo
->
current
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
pInterval
->
precision
);
if
(
pResBlock
->
info
.
rows
>=
pResBlock
->
info
.
capacity
)
{
break
;
}
}
if
(
pSliceInfo
->
current
>
pSliceInfo
->
win
.
ekey
)
{
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
e5d25f46
...
...
@@ -879,12 +879,15 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh
pInterpFunc
->
interval
=
pFuncLogicNode
->
interval
;
pInterpFunc
->
fillMode
=
pFuncLogicNode
->
fillMode
;
pInterpFunc
->
pFillValues
=
nodesCloneNode
(
pFuncLogicNode
->
pFillValues
);
pInterpFunc
->
pTimeSeries
=
nodesCloneNode
(
pFuncLogicNode
->
pTimeSeries
);
if
(
NULL
==
pInterpFunc
->
pTimeSeries
||
(
NULL
!=
pFuncLogicNode
->
pFillValues
&&
NULL
==
pInterpFunc
->
pFillValues
))
{
if
(
NULL
!=
pFuncLogicNode
->
pFillValues
&&
NULL
==
pInterpFunc
->
pFillValues
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
setNodeSlotId
(
pCxt
,
pChildTupe
->
dataBlockId
,
-
1
,
pFuncLogicNode
->
pTimeSeries
,
&
pInterpFunc
->
pTimeSeries
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pPhyNode
=
(
SPhysiNode
*
)
pInterpFunc
;
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录