Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a7fc925f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
a7fc925f
编写于
2月 27, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs founded in regression test(reverse scan failed).
上级
3932d0ac
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
48 addition
and
49 deletion
+48
-49
src/inc/tsqlfunction.h
src/inc/tsqlfunction.h
+3
-3
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+13
-13
src/system/detail/src/vnodeQueryProcess.c
src/system/detail/src/vnodeQueryProcess.c
+2
-2
src/util/src/tinterpolation.c
src/util/src/tinterpolation.c
+30
-31
未找到文件。
src/inc/tsqlfunction.h
浏览文件 @
a7fc925f
...
...
@@ -171,7 +171,7 @@ typedef struct SExtTagsInfo {
typedef
struct
SQLFunctionCtx
{
int32_t
startOffset
;
int32_t
size
;
// number of rows
int32_t
order
;
// asc|desc
u
int32_t
order
;
// asc|desc
uint32_t
scanFlag
;
// TODO merge with currentStage
int16_t
inputType
;
...
...
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
a7fc925f
...
...
@@ -1861,7 +1861,7 @@ static int32_t blockwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t
}
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pQuery
->
order
.
order
);
if
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
)
{
if
(
isIntervalQuery
(
pQuery
))
{
int32_t
offset
=
GET_COL_DATA_POS
(
pQuery
,
0
,
step
);
TSKEY
ts
=
primaryKeyCol
[
offset
];
...
...
@@ -2423,7 +2423,7 @@ static int32_t rowwiseApplyAllFunctions(SQueryRuntimeEnv *pRuntimeEnv, int32_t *
* because the results of group by normal column is put into intermediate buffer.
*/
int32_t
num
=
0
;
if
(
!
groupbyStateValue
&&
!
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
if
(
!
groupbyStateValue
&&
!
isIntervalQuery
(
pQuery
))
{
num
=
getNumOfResult
(
pRuntimeEnv
)
-
prevNumOfRes
;
}
...
...
@@ -4588,7 +4588,7 @@ int32_t vnodeQueryTablePrepare(SQInfo *pQInfo, SMeterObj *pMeterObj, STableQuery
vnodeRecordAllFiles
(
pQInfo
,
pMeterObj
->
vnode
);
pRuntimeEnv
->
numOfRowsPerPage
=
getNumOfRowsInResultPage
(
pQuery
,
false
);
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
)
||
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
)
||
isIntervalQuery
(
pQuery
))
{
int32_t
rows
=
getInitialPageNum
(
pSupporter
);
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
rows
,
pQuery
->
rowSize
);
...
...
@@ -4731,9 +4731,9 @@ void vnodeQueryFreeQInfoEx(SQInfo *pQInfo) {
}
if
(
pSupporter
->
pSidSet
!=
NULL
||
isGroupbyNormalCol
(
pQInfo
->
query
.
pGroupbyExpr
)
||
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
isIntervalQuery
(
pQuery
))
{
int32_t
size
=
0
;
if
(
isGroupbyNormalCol
(
pQInfo
->
query
.
pGroupbyExpr
)
||
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
if
(
isGroupbyNormalCol
(
pQInfo
->
query
.
pGroupbyExpr
)
||
isIntervalQuery
(
pQuery
))
{
size
=
10000
;
}
else
if
(
pSupporter
->
pSidSet
!=
NULL
)
{
size
=
pSupporter
->
pSidSet
->
numOfSubSet
;
...
...
@@ -5890,6 +5890,10 @@ void disableFunctForSuppleScan(STableQuerySupportObj *pSupporter, int32_t order)
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pSupporter
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutputCols
;
++
i
)
{
pRuntimeEnv
->
pCtx
[
i
].
order
=
(
pRuntimeEnv
->
pCtx
[
i
].
order
)
^
1u
;
}
if
(
isIntervalQuery
(
pQuery
))
{
for
(
int32_t
i
=
0
;
i
<
pSupporter
->
numOfMeters
;
++
i
)
{
SMeterQueryInfo
*
pMeterQueryInfo
=
pSupporter
->
pMeterDataInfo
[
i
].
pMeterQInfo
;
...
...
@@ -5898,10 +5902,6 @@ void disableFunctForSuppleScan(STableQuerySupportObj *pSupporter, int32_t order)
doDisableFunctsForSupplementaryScan
(
pQuery
,
pWindowResInfo
,
order
);
}
}
else
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutputCols
;
++
i
)
{
pRuntimeEnv
->
pCtx
[
i
].
order
=
(
pRuntimeEnv
->
pCtx
[
i
].
order
)
^
1u
;
}
SWindowResInfo
*
pWindowResInfo
=
&
pRuntimeEnv
->
windowResInfo
;
doDisableFunctsForSupplementaryScan
(
pQuery
,
pWindowResInfo
,
order
);
}
...
...
@@ -6193,7 +6193,7 @@ bool needScanDataBlocksAgain(SQueryRuntimeEnv *pRuntimeEnv) {
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
bool
toContinue
=
false
;
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
)
||
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
if
(
isGroupbyNormalCol
(
pQuery
->
pGroupbyExpr
)
||
isIntervalQuery
(
pQuery
))
{
// for each group result, call the finalize function for each column
SWindowResInfo
*
pWindowResInfo
=
&
pRuntimeEnv
->
windowResInfo
;
...
...
@@ -6530,7 +6530,7 @@ void changeMeterQueryInfoForSuppleQuery(SQuery *pQuery, SMeterQueryInfo *pMeterQ
SWAP
(
pMeterQueryInfo
->
skey
,
pMeterQueryInfo
->
ekey
,
TSKEY
);
pMeterQueryInfo
->
lastKey
=
pMeterQueryInfo
->
skey
;
pMeterQueryInfo
->
cur
.
order
=
pMeterQueryInfo
->
cur
.
order
^
1
;
pMeterQueryInfo
->
cur
.
order
=
pMeterQueryInfo
->
cur
.
order
^
1
u
;
pMeterQueryInfo
->
cur
.
vnodeIndex
=
-
1
;
}
...
...
@@ -7115,7 +7115,7 @@ int32_t LoadDatablockOnDemand(SCompBlock *pBlock, SField **pFields, uint8_t *blk
pQuery
->
pSelectExpr
[
i
].
pBase
.
colInfo
.
colId
,
*
blkStatus
);
}
if
(
pRuntimeEnv
->
pTSBuf
>
0
||
(
isIntervalQuery
(
pQuery
)
&&
pQuery
->
slidingTime
>
0
))
{
if
(
pRuntimeEnv
->
pTSBuf
>
0
||
isIntervalQuery
(
pQuery
))
{
req
|=
BLK_DATA_ALL_NEEDED
;
}
}
...
...
src/system/detail/src/vnodeQueryProcess.c
浏览文件 @
a7fc925f
...
...
@@ -872,7 +872,7 @@ static void doMultiMeterSupplementaryScan(SQInfo *pQInfo) {
disableFunctForSuppleScan
(
pSupporter
,
pQuery
->
order
.
order
);
if
(
pRuntimeEnv
->
pTSBuf
!=
NULL
)
{
pRuntimeEnv
->
pTSBuf
->
cur
.
order
=
pRuntimeEnv
->
pTSBuf
->
cur
.
order
^
1
;
pRuntimeEnv
->
pTSBuf
->
cur
.
order
=
pRuntimeEnv
->
pTSBuf
->
cur
.
order
^
1
u
;
}
SWAP
(
pSupporter
->
rawSKey
,
pSupporter
->
rawEKey
,
TSKEY
);
...
...
@@ -945,7 +945,7 @@ static void vnodeMultiMeterQueryProcessor(SQInfo *pQInfo) {
doOrderedScan
(
pQInfo
);
int64_t
et
=
taosGetTimestampMs
();
dTrace
(
"QInfo:%p main scan completed, elapsed time: %lldms, supplementary scan start, order:%d"
,
pQInfo
,
et
-
st
,
pQuery
->
order
.
order
^
1
);
pQuery
->
order
.
order
^
1
u
);
if
(
pQuery
->
intervalTime
>
0
)
{
for
(
int32_t
i
=
0
;
i
<
pSupporter
->
numOfMeters
;
++
i
)
{
...
...
src/util/src/tinterpolation.c
浏览文件 @
a7fc925f
...
...
@@ -91,7 +91,7 @@ void taosInterpoSetStartInfo(SInterpolationInfo* pInterpoInfo, int32_t numOfRawD
return
;
}
pInterpoInfo
->
rowIdx
=
0
;
// INTERPOL_IS_ASC_INTERPOL(pInterpoInfo) ? 0 : numOfRawDataInRows - 1;
pInterpoInfo
->
rowIdx
=
0
;
pInterpoInfo
->
numOfRawDataInRows
=
numOfRawDataInRows
;
}
...
...
@@ -295,6 +295,20 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
(
*
num
)
+=
1
;
}
static
void
initBeforeAfterDataBuf
(
SColumnModel
*
pModel
,
char
**
nextValues
)
{
if
(
*
nextValues
!=
NULL
)
{
return
;
}
*
nextValues
=
calloc
(
1
,
pModel
->
rowSize
);
for
(
int
i
=
1
;
i
<
pModel
->
numOfCols
;
i
++
)
{
int16_t
offset
=
getColumnModelOffset
(
pModel
,
i
);
SSchema
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
setNull
(
*
nextValues
+
offset
,
pSchema
->
type
,
pSchema
->
bytes
);
}
}
int32_t
taosDoInterpoResult
(
SInterpolationInfo
*
pInterpoInfo
,
int16_t
interpoType
,
tFilePage
**
data
,
int32_t
numOfRawDataInRows
,
int32_t
outputRows
,
int64_t
nInterval
,
const
int64_t
*
pPrimaryKeyArray
,
SColumnModel
*
pModel
,
char
**
srcData
,
int64_t
*
defaultVal
,
...
...
@@ -329,15 +343,7 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
if
((
pInterpoInfo
->
startTimestamp
<
currentTimestamp
&&
INTERPOL_IS_ASC_INTERPOL
(
pInterpoInfo
))
||
(
pInterpoInfo
->
startTimestamp
>
currentTimestamp
&&
!
INTERPOL_IS_ASC_INTERPOL
(
pInterpoInfo
)))
{
/* set the next value for interpolation */
if
(
*
nextValues
==
NULL
)
{
*
nextValues
=
calloc
(
1
,
pModel
->
rowSize
);
for
(
int
i
=
1
;
i
<
pModel
->
numOfCols
;
i
++
)
{
int16_t
offset
=
getColumnModelOffset
(
pModel
,
i
);
SSchema
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
setNull
(
*
nextValues
+
offset
,
pSchema
->
type
,
pSchema
->
bytes
);
}
}
initBeforeAfterDataBuf
(
pModel
,
nextValues
);
int32_t
offset
=
pInterpoInfo
->
rowIdx
;
for
(
int32_t
tlen
=
0
,
i
=
0
;
i
<
pModel
->
numOfCols
-
numOfTags
;
++
i
)
{
...
...
@@ -365,16 +371,9 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
return
outputRows
;
}
}
else
{
// if (pInterpoInfo->startTimestamp == currentTimestamp) {
if
(
*
prevValues
==
NULL
)
{
*
prevValues
=
calloc
(
1
,
pModel
->
rowSize
);
for
(
int
i
=
1
;
i
<
pModel
->
numOfCols
;
i
++
)
{
int16_t
offset
=
getColumnModelOffset
(
pModel
,
i
);
SSchema
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
assert
(
pInterpoInfo
->
startTimestamp
==
currentTimestamp
);
setNull
(
*
prevValues
+
offset
,
pSchema
->
type
,
pSchema
->
bytes
);
}
}
initBeforeAfterDataBuf
(
pModel
,
prevValues
);
// assign rows to dst buffer
int32_t
i
=
0
;
...
...
@@ -383,19 +382,19 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
SSchema
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
char
*
val1
=
getPos
(
data
[
i
]
->
data
,
pSchema
->
bytes
,
num
);
char
*
src
=
srcData
[
i
]
+
pInterpoInfo
->
rowIdx
*
pSchema
->
bytes
;
if
(
i
==
0
||
(
functionIDs
[
i
]
!=
TSDB_FUNC_COUNT
&&
!
isNull
(
srcData
[
i
]
+
pInterpoInfo
->
rowIdx
*
pSchema
->
bytes
,
pSchema
->
type
))
||
(
functionIDs
[
i
]
==
TSDB_FUNC_COUNT
&&
*
(
int64_t
*
)(
srcData
[
i
]
+
pInterpoInfo
->
rowIdx
*
pSchema
->
bytes
)
!=
0
))
{
assignVal
(
val1
,
srcData
[
i
]
+
pInterpoInfo
->
rowIdx
*
pSchema
->
bytes
,
pSchema
->
bytes
,
pSchema
->
type
);
memcpy
(
*
prevValues
+
tlen
,
srcData
[
i
]
+
pInterpoInfo
->
rowIdx
*
pSchema
->
bytes
,
pSchema
->
bytes
);
}
else
{
// i > 0 and isNULL, do interpolation
(
functionIDs
[
i
]
!=
TSDB_FUNC_COUNT
&&
!
isNull
(
src
,
pSchema
->
type
))
||
(
functionIDs
[
i
]
==
TSDB_FUNC_COUNT
&&
*
(
int64_t
*
)(
src
)
!=
0
))
{
assignVal
(
val1
,
src
,
pSchema
->
bytes
,
pSchema
->
type
);
memcpy
(
*
prevValues
+
tlen
,
src
,
pSchema
->
bytes
);
}
else
{
// i > 0 and data is null , do interpolation
if
(
interpoType
==
TSDB_INTERPO_PREV
)
{
assignVal
(
val1
,
*
prevValues
+
offset
,
pSchema
->
bytes
,
pSchema
->
type
);
}
else
if
(
interpoType
==
TSDB_INTERPO_LINEAR
)
{
// TODO:
assignVal
(
val1
,
src
,
pSchema
->
bytes
,
pSchema
->
type
);
memcpy
(
*
prevValues
+
tlen
,
src
,
pSchema
->
bytes
);
}
else
{
assignVal
(
val1
,
(
char
*
)
&
defaultVal
[
i
],
pSchema
->
bytes
,
pSchema
->
type
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录