Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
276b7a6d
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
276b7a6d
编写于
11月 09, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1978]
上级
7314a0dd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
89 addition
and
45 deletion
+89
-45
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+1
-1
src/inc/ttype.h
src/inc/ttype.h
+36
-0
src/query/inc/qFill.h
src/query/inc/qFill.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qFill.c
src/query/src/qFill.c
+50
-42
未找到文件。
src/client/src/tscLocalMerge.c
浏览文件 @
276b7a6d
...
...
@@ -370,7 +370,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
SFillColInfo
*
pFillCol
=
createFillColInfo
(
pQueryInfo
);
pReducer
->
pFillInfo
=
taosInitFillInfo
(
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
4096
,
(
int32_t
)
numOfCols
,
pQueryInfo
->
interval
.
sliding
,
pQueryInfo
->
interval
.
slidingUnit
,
tinfo
.
precision
,
pQueryInfo
->
fillType
,
pFillCol
);
tinfo
.
precision
,
pQueryInfo
->
fillType
,
pFillCol
,
pSql
);
}
}
...
...
src/inc/ttype.h
0 → 100644
浏览文件 @
276b7a6d
#ifndef TDENGINE_TTYPE_H
#define TDENGINE_TTYPE_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "taosdef.h"
#define GET_TYPED_DATA(_v, _type, _data) \
switch (_type) { \
case TSDB_DATA_TYPE_TINYINT: \
(_v) = GET_INT8_VAL(_data); \
break; \
case TSDB_DATA_TYPE_SMALLINT: \
(_v) = GET_INT16_VAL(_data); \
break; \
case TSDB_DATA_TYPE_BIGINT: \
(_v) = (GET_INT64_VAL(_data)); \
break; \
case TSDB_DATA_TYPE_FLOAT: \
(_v) = GET_FLOAT_VAL(_data); \
break; \
case TSDB_DATA_TYPE_DOUBLE: \
(_v) = GET_DOUBLE_VAL(_data); \
break; \
default: \
(_v) = GET_INT32_VAL(_data); \
break; \
};
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_TTYPE_H
src/query/inc/qFill.h
浏览文件 @
276b7a6d
...
...
@@ -70,7 +70,7 @@ typedef struct SPoint {
SFillInfo
*
taosInitFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
SFillColInfo
*
pFillCol
);
SFillColInfo
*
pFillCol
,
void
*
handle
);
void
taosResetFillInfo
(
SFillInfo
*
pFillInfo
,
TSKEY
startTimestamp
);
...
...
src/query/src/qExecutor.c
浏览文件 @
276b7a6d
...
...
@@ -4628,7 +4628,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
pRuntimeEnv
->
pFillInfo
=
taosInitFillInfo
(
pQuery
->
order
.
order
,
w
.
skey
,
0
,
(
int32_t
)
pQuery
->
rec
.
capacity
,
pQuery
->
numOfOutput
,
pQuery
->
interval
.
sliding
,
pQuery
->
interval
.
slidingUnit
,
(
int8_t
)
pQuery
->
precision
,
pQuery
->
fillType
,
pColInfo
);
pQuery
->
fillType
,
pColInfo
,
pQInfo
);
}
setQueryStatus
(
pQuery
,
QUERY_NOT_COMPLETED
);
...
...
src/query/src/qFill.c
浏览文件 @
276b7a6d
...
...
@@ -26,9 +26,43 @@
#define FILL_IS_ASC_FILL(_f) ((_f)->order == TSDB_ORDER_ASC)
// there are no duplicated tags in the SFillTagColInfo list
static
int32_t
setTagColumnInfo
(
SFillInfo
*
pFillInfo
,
int32_t
numOfCols
,
int32_t
capacity
)
{
int32_t
rowsize
=
0
;
int32_t
k
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SFillColInfo
*
pColInfo
=
&
pFillInfo
->
pFillCol
[
i
];
pFillInfo
->
pData
[
i
]
=
calloc
(
1
,
pColInfo
->
col
.
bytes
*
capacity
);
if
(
TSDB_COL_IS_TAG
(
pColInfo
->
flag
))
{
bool
exists
=
false
;
for
(
int32_t
j
=
0
;
j
<
k
;
++
j
)
{
if
(
pFillInfo
->
pTags
[
j
].
col
.
colId
==
pColInfo
->
col
.
colId
)
{
exists
=
true
;
break
;
}
}
if
(
!
exists
)
{
pFillInfo
->
pTags
[
k
].
col
.
colId
=
pColInfo
->
col
.
colId
;
pFillInfo
->
pTags
[
k
].
tagVal
=
calloc
(
1
,
pColInfo
->
col
.
bytes
);
pColInfo
->
tagIndex
=
k
;
k
+=
1
;
}
}
rowsize
+=
pColInfo
->
col
.
bytes
;
}
assert
(
k
<
pFillInfo
->
numOfTags
);
return
rowsize
;
}
SFillInfo
*
taosInitFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
SFillColInfo
*
pCol
)
{
SFillColInfo
*
pCol
,
void
*
handle
)
{
if
(
fillType
==
TSDB_FILL_NONE
)
{
return
NULL
;
}
...
...
@@ -37,12 +71,14 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
taosResetFillInfo
(
pFillInfo
,
skey
);
pFillInfo
->
order
=
order
;
pFillInfo
->
type
=
fillType
;
pFillInfo
->
order
=
order
;
pFillInfo
->
type
=
fillType
;
pFillInfo
->
pFillCol
=
pCol
;
pFillInfo
->
numOfTags
=
numOfTags
;
pFillInfo
->
numOfCols
=
numOfCols
;
pFillInfo
->
precision
=
precision
;
pFillInfo
->
alloc
=
capacity
;
pFillInfo
->
handle
=
handle
;
pFillInfo
->
interval
.
interval
=
slidingTime
;
pFillInfo
->
interval
.
intervalUnit
=
slidingUnit
;
...
...
@@ -57,35 +93,8 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
}
}
// there are no duplicated tags in the SFillTagColInfo list
int32_t
rowsize
=
0
;
int32_t
k
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SFillColInfo
*
pColInfo
=
&
pFillInfo
->
pFillCol
[
i
];
pFillInfo
->
pData
[
i
]
=
calloc
(
1
,
pColInfo
->
col
.
bytes
*
capacity
);
if
(
TSDB_COL_IS_TAG
(
pColInfo
->
flag
))
{
bool
exists
=
false
;
for
(
int32_t
j
=
0
;
j
<
k
;
++
j
)
{
if
(
pFillInfo
->
pTags
[
j
].
col
.
colId
==
pColInfo
->
col
.
colId
)
{
exists
=
true
;
break
;
}
}
if
(
!
exists
)
{
pFillInfo
->
pTags
[
k
].
col
.
colId
=
pColInfo
->
col
.
colId
;
pFillInfo
->
pTags
[
k
].
tagVal
=
calloc
(
1
,
pColInfo
->
col
.
bytes
);
pColInfo
->
tagIndex
=
k
;
k
+=
1
;
}
}
rowsize
+=
pColInfo
->
col
.
bytes
;
}
pFillInfo
->
rowSize
=
rowsize
;
pFillInfo
->
alloc
=
capacity
;
pFillInfo
->
rowSize
=
setTagColumnInfo
(
pFillInfo
,
pFillInfo
->
numOfCols
,
pFillInfo
->
alloc
);
assert
(
pFillInfo
->
rowSize
>
0
);
return
pFillInfo
;
}
...
...
@@ -350,7 +359,7 @@ static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** next) {
}
}
static
void
copyCurrentRowIntoBuf
(
SFillInfo
*
pFillInfo
,
char
**
srcData
,
int32_t
numOfTags
,
char
*
buf
)
{
static
void
copyCurrentRowIntoBuf
(
SFillInfo
*
pFillInfo
,
char
**
srcData
,
char
*
buf
)
{
int32_t
rowIndex
=
pFillInfo
->
index
;
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
...
...
@@ -365,7 +374,6 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t ou
char
**
prev
=
&
pFillInfo
->
prevValues
;
char
**
next
=
&
pFillInfo
->
nextValues
;
int32_t
numOfTags
=
pFillInfo
->
numOfTags
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pFillInfo
->
order
);
if
(
FILL_IS_ASC_FILL
(
pFillInfo
))
{
...
...
@@ -381,7 +389,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t ou
(
pFillInfo
->
currentKey
>
ts
&&
!
FILL_IS_ASC_FILL
(
pFillInfo
)))
{
/* set the next value for interpolation */
initBeforeAfterDataBuf
(
pFillInfo
,
next
);
copyCurrentRowIntoBuf
(
pFillInfo
,
srcData
,
numOfTags
,
*
next
);
copyCurrentRowIntoBuf
(
pFillInfo
,
srcData
,
*
next
);
}
if
(((
pFillInfo
->
currentKey
<
ts
&&
FILL_IS_ASC_FILL
(
pFillInfo
))
||
(
pFillInfo
->
currentKey
>
ts
&&
!
FILL_IS_ASC_FILL
(
pFillInfo
)))
&&
...
...
@@ -476,15 +484,15 @@ int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_
// no data existed for fill operation now, append result according to the fill strategy
if
(
remain
==
0
)
{
return
fillExternalResults
(
pFillInfo
,
output
,
numOfRes
);
fillExternalResults
(
pFillInfo
,
output
,
numOfRes
);
}
else
{
fillResultImpl
(
pFillInfo
,
output
,
numOfRes
);
assert
(
numOfRes
==
pFillInfo
->
numOfCurrent
);
}
fillResultImpl
(
pFillInfo
,
output
,
numOfRes
);
assert
(
numOfRes
==
pFillInfo
->
numOfCurrent
);
qDebug
(
"generated fill result, src block:%d, index:%d, startKey:%"
PRId64
", currentKey:%"
PRId64
", current:%d, total:%d"
,
pFillInfo
->
numOfRows
,
pFillInfo
->
index
,
pFillInfo
->
start
,
pFillInfo
->
currentKey
,
pFillInfo
->
numOfCurrent
,
pFillInfo
->
numOfTotal
);
qDebug
(
"fill:%p, generated fill result, src block:%d, index:%d, brange:%"
PRId64
"-%"
PRId64
", currentKey:%"
PRId64
", current:%d, total:%d, %p"
,
pFillInfo
,
pFillInfo
->
numOfRows
,
pFillInfo
->
index
,
pFillInfo
->
start
,
pFillInfo
->
end
,
pFillInfo
->
currentKey
,
pFillInfo
->
numOfCurrent
,
pFillInfo
->
numOfTotal
,
pFillInfo
->
handle
);
return
numOfRes
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录