Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9d4b925d
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看板
提交
9d4b925d
编写于
2月 24, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor code.
上级
faea042f
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
243 addition
and
266 deletion
+243
-266
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+5
-5
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+18
-30
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+220
-229
src/query/src/qFill.c
src/query/src/qFill.c
+0
-2
未找到文件。
src/client/src/tscLocalMerge.c
浏览文件 @
9d4b925d
...
...
@@ -951,14 +951,14 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
// todo extract function
int64_t
actualETime
=
(
pQueryInfo
->
order
.
order
==
TSDB_ORDER_ASC
)
?
pQueryInfo
->
window
.
ekey
:
pQueryInfo
->
window
.
skey
;
tFilePage
**
pResPages
=
malloc
(
POINTER_BYTES
*
pQueryInfo
->
fieldsInfo
.
numOfOutput
);
void
**
pResPages
=
malloc
(
POINTER_BYTES
*
pQueryInfo
->
fieldsInfo
.
numOfOutput
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
pResPages
[
i
]
=
calloc
(
1
,
sizeof
(
tFilePage
)
+
pField
->
bytes
*
pLocalMerge
->
resColModel
->
capacity
);
pResPages
[
i
]
=
calloc
(
1
,
pField
->
bytes
*
pLocalMerge
->
resColModel
->
capacity
);
}
while
(
1
)
{
int64_t
newRows
=
taosFillResultDataBlock
(
pFillInfo
,
(
void
**
)
pResPages
,
pLocalMerge
->
resColModel
->
capacity
);
int64_t
newRows
=
taosFillResultDataBlock
(
pFillInfo
,
pResPages
,
pLocalMerge
->
resColModel
->
capacity
);
if
(
pQueryInfo
->
limit
.
offset
<
newRows
)
{
newRows
-=
pQueryInfo
->
limit
.
offset
;
...
...
@@ -966,7 +966,7 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
if
(
pQueryInfo
->
limit
.
offset
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
memmove
(
pResPages
[
i
]
->
data
,
pResPages
[
i
]
->
data
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
memmove
(
pResPages
[
i
]
,
pResPages
[
i
]
+
pField
->
bytes
*
pQueryInfo
->
limit
.
offset
,
(
size_t
)(
newRows
*
pField
->
bytes
));
}
}
...
...
@@ -1010,7 +1010,7 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp
int32_t
offset
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
i
);
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
]
->
data
,
(
size_t
)(
pField
->
bytes
*
pRes
->
numOfRows
));
memcpy
(
pRes
->
data
+
offset
*
pRes
->
numOfRows
,
pResPages
[
i
],
(
size_t
)(
pField
->
bytes
*
pRes
->
numOfRows
));
offset
+=
pField
->
bytes
;
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
9d4b925d
...
...
@@ -241,27 +241,12 @@ typedef struct SQuery {
typedef
SSDataBlock
*
(
*
__operator_fn_t
)(
void
*
param
);
typedef
struct
SOperatorInfo
{
char
*
name
;
bool
blockingOptr
;
bool
completed
;
void
*
optInfo
;
SExprInfo
*
pExpr
;
int32_t
*
rowCellInfoOffset
;
int32_t
numOfOutput
;
__operator_fn_t
exec
;
__operator_fn_t
cleanup
;
struct
SOperatorInfo
*
upstream
;
}
SOperatorInfo
;
struct
SOperatorInfo
;
typedef
struct
SQueryRuntimeEnv
{
jmp_buf
env
;
SQuery
*
pQuery
;
void
*
qinfo
;
// int32_t numOfRowsPerPage;
// uint16_t* offset;
uint16_t
scanFlag
;
// denotes reversed scan of data or not
SFillInfo
*
pFillInfo
;
void
*
pQueryHandle
;
...
...
@@ -282,16 +267,31 @@ typedef struct SQueryRuntimeEnv {
char
*
tagVal
;
// tag value of current data block
SArithmeticSupport
*
sasArray
;
SOperatorInfo
*
pi
;
struct
SOperatorInfo
*
pi
;
SSDataBlock
*
outputBuf
;
int32_t
groupIndex
;
int32_t
tableIndex
;
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
SOperatorInfo
*
proot
;
struct
SOperatorInfo
*
proot
;
SGroupResInfo
groupResInfo
;
}
SQueryRuntimeEnv
;
typedef
struct
SOperatorInfo
{
char
*
name
;
bool
blockingOptr
;
bool
completed
;
void
*
info
;
SExprInfo
*
pExpr
;
int32_t
numOfOutput
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
__operator_fn_t
exec
;
__operator_fn_t
cleanup
;
struct
SOperatorInfo
*
upstream
;
}
SOperatorInfo
;
enum
{
QUERY_RESULT_NOT_READY
=
1
,
QUERY_RESULT_READY
=
2
,
...
...
@@ -363,23 +363,18 @@ typedef struct STableScanInfo {
}
STableScanInfo
;
typedef
struct
STagScanInfo
{
SQueryRuntimeEnv
*
pRuntimeEnv
;
SColumnInfo
*
pCols
;
SSDataBlock
*
pRes
;
}
STagScanInfo
;
typedef
struct
SAggOperatorInfo
{
SResultRowInfo
resultRowInfo
;
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
int32_t
*
rowCellInfoOffset
;
SSDataBlock
*
pRes
;
}
SAggOperatorInfo
;
typedef
struct
SArithOperatorInfo
{
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
int32_t
*
rowCellInfoOffset
;
SResultRowInfo
resultRowInfo
;
...
...
@@ -390,18 +385,14 @@ typedef struct SArithOperatorInfo {
typedef
struct
SLimitOperatorInfo
{
int64_t
limit
;
int64_t
total
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
}
SLimitOperatorInfo
;
typedef
struct
SOffsetOperatorInfo
{
int64_t
offset
;
int64_t
currentOffset
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
}
SOffsetOperatorInfo
;
typedef
struct
SHashIntervalOperatorInfo
{
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
int32_t
*
rowCellInfoOffset
;
SResultRowInfo
resultRowInfo
;
...
...
@@ -409,13 +400,10 @@ typedef struct SHashIntervalOperatorInfo {
}
SHashIntervalOperatorInfo
;
typedef
struct
SFillOperatorInfo
{
SQueryRuntimeEnv
*
pRuntimeEnv
;
SSDataBlock
*
pRes
;
}
SFillOperatorInfo
;
typedef
struct
SHashGroupbyOperatorInfo
{
STableQueryInfo
*
pTableQueryInfo
;
SQueryRuntimeEnv
*
pRuntimeEnv
;
SQLFunctionCtx
*
pCtx
;
int32_t
*
rowCellInfoOffset
;
SResultRowInfo
resultRowInfo
;
...
...
src/query/src/qExecutor.c
浏览文件 @
9d4b925d
此差异已折叠。
点击以展开。
src/query/src/qFill.c
浏览文件 @
9d4b925d
...
...
@@ -425,8 +425,6 @@ void taosFillSetInputDataBlock(SFillInfo* pFillInfo, const SSDataBlock* pInput)
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColData
=
taosArrayGet
(
pInput
->
pDataBlock
,
i
);
pFillInfo
->
pData
[
i
]
=
pColData
->
pData
;
// memcpy(pFillInfo->pData[i], pInput[i]->data, pFillInfo->numOfRows * pFillInfo->pFillCol[i].col.bytes);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录