Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a260707c
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看板
提交
a260707c
编写于
3月 03, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
75a45e3f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
17 deletion
+46
-17
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+7
-7
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+37
-7
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-3
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
a260707c
...
...
@@ -265,13 +265,13 @@ typedef struct SQueryRuntimeEnv {
char
*
tagVal
;
// tag value of current data block
SArithmeticSupport
*
sasArray
;
SSDataBlock
*
outputBuf
;
int32_t
tableIndex
;
//TODO remove it
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
struct
SOperatorInfo
*
proot
;
struct
SOperatorInfo
*
pTableScanner
;
// table scan operator
SGroupResInfo
groupResInfo
;
int64_t
currentOffset
;
// dynamic offset value
SSDataBlock
*
outputBuf
;
int32_t
tableIndex
;
//TODO remove it
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
struct
SOperatorInfo
*
proot
;
struct
SOperatorInfo
*
pTableScanner
;
// table scan operator
SGroupResInfo
groupResInfo
;
int64_t
currentOffset
;
// dynamic offset value
SRspResultInfo
resultInfo
;
}
SQueryRuntimeEnv
;
...
...
src/query/src/qAggMain.c
浏览文件 @
a260707c
...
...
@@ -4092,17 +4092,49 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) {
tVariantDump
(
&
pCtx
->
param
[
1
],
pCtx
->
pOutput
,
pCtx
->
inputType
,
true
);
}
else
{
if
(
pCtx
->
start
.
key
!=
INT64_MIN
&&
pCtx
->
start
.
key
<
pCtx
->
startTs
&&
pCtx
->
end
.
key
>
pCtx
->
startTs
)
{
// the value of prev/next/linear interpolation is placed in pCtx->start
if
(
IS_NUMERIC_TYPE
(
pCtx
->
inputType
)
||
pCtx
->
inputType
==
TSDB_DATA_TYPE_BOOL
)
{
SET_TYPED_DATA
(
pCtx
->
pOutput
,
pCtx
->
inputType
,
pCtx
->
start
.
val
);
}
else
{
assignVal
(
pCtx
->
pOutput
,
pCtx
->
start
.
ptr
,
pCtx
->
outputBytes
,
pCtx
->
inputType
);
if
(
type
==
TSDB_FILL_PREV
)
{
if
(
IS_NUMERIC_TYPE
(
pCtx
->
inputType
)
||
pCtx
->
inputType
==
TSDB_DATA_TYPE_BOOL
)
{
SET_TYPED_DATA
(
pCtx
->
pOutput
,
pCtx
->
inputType
,
pCtx
->
start
.
val
);
}
else
{
assignVal
(
pCtx
->
pOutput
,
pCtx
->
start
.
ptr
,
pCtx
->
outputBytes
,
pCtx
->
inputType
);
}
}
else
if
(
type
==
TSDB_FILL_NEXT
)
{
if
(
IS_NUMERIC_TYPE
(
pCtx
->
inputType
)
||
pCtx
->
inputType
==
TSDB_DATA_TYPE_BOOL
)
{
SET_TYPED_DATA
(
pCtx
->
pOutput
,
pCtx
->
inputType
,
pCtx
->
end
.
val
);
}
else
{
assignVal
(
pCtx
->
pOutput
,
pCtx
->
end
.
ptr
,
pCtx
->
outputBytes
,
pCtx
->
inputType
);
}
}
else
if
(
type
==
TSDB_FILL_LINEAR
)
{
SPoint
point1
=
{.
key
=
pCtx
->
start
.
key
,
.
val
=
&
pCtx
->
start
.
val
};
SPoint
point2
=
{.
key
=
pCtx
->
end
.
key
,
.
val
=
&
pCtx
->
end
.
val
};
SPoint
point
=
{.
key
=
pCtx
->
startTs
,
.
val
=
pCtx
->
pOutput
};
int32_t
srcType
=
pCtx
->
inputType
;
if
(
IS_NUMERIC_TYPE
(
srcType
))
{
// TODO should find the not null data?
if
(
isNull
((
char
*
)
&
pCtx
->
start
.
val
,
srcType
)
||
isNull
((
char
*
)
&
pCtx
->
end
.
val
,
srcType
))
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
}
else
{
taosGetLinearInterpolationVal
(
&
point
,
pCtx
->
outputType
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
);
}
}
else
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
}
}
}
else
{
// no data generated yet
if
(
pCtx
->
size
==
1
)
{
return
;
}
// check the timestamp in input buffer
TSKEY
skey
=
GET_TS_DATA
(
pCtx
,
0
);
TSKEY
ekey
=
GET_TS_DATA
(
pCtx
,
1
);
// no data generated yet
if
(
!
(
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
))
{
return
;
}
assert
(
pCtx
->
start
.
key
==
INT64_MIN
&&
skey
<
pCtx
->
startTs
&&
ekey
>
pCtx
->
startTs
);
if
(
type
==
TSDB_FILL_PREV
)
{
...
...
@@ -4114,8 +4146,6 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) {
char
*
start
=
GET_INPUT_DATA
(
pCtx
,
0
);
char
*
end
=
GET_INPUT_DATA
(
pCtx
,
1
);
SPoint
point1
=
{.
key
=
skey
,
.
val
=
start
};
SPoint
point2
=
{.
key
=
ekey
,
.
val
=
end
};
SPoint
point
=
{.
key
=
pCtx
->
startTs
,
.
val
=
pCtx
->
pOutput
};
...
...
src/query/src/qExecutor.c
浏览文件 @
a260707c
...
...
@@ -1894,8 +1894,7 @@ _clean:
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
static
void
doFreeQueryHandle
(
SQInfo
*
pQInfo
)
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
static
void
doFreeQueryHandle
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
tsdbCleanupQueryHandle
(
pRuntimeEnv
->
pQueryHandle
);
...
...
@@ -1923,7 +1922,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
pRuntimeEnv
->
pFillInfo
=
taosDestroyFillInfo
(
pRuntimeEnv
->
pFillInfo
);
destroyResultBuf
(
pRuntimeEnv
->
pResultBuf
);
doFreeQueryHandle
(
p
QInfo
);
doFreeQueryHandle
(
p
RuntimeEnv
);
pRuntimeEnv
->
pTsBuf
=
tsBufDestroy
(
pRuntimeEnv
->
pTsBuf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录