Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
7221f5a6
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7221f5a6
编写于
5月 23, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-227]
上级
7f514df7
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
159 addition
and
150 deletion
+159
-150
src/inc/taosdef.h
src/inc/taosdef.h
+1
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+20
-20
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+138
-128
未找到文件。
src/inc/taosdef.h
浏览文件 @
7221f5a6
...
...
@@ -326,8 +326,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_QUERY_TYPE_TAG_FILTER_QUERY 0x400u
#define TSDB_QUERY_TYPE_INSERT 0x100u // insert type
#define TSDB_QUERY_TYPE_IMPORT 0x200u // import data
#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x800u
#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x200u
#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
...
...
src/query/src/qExecutor.c
浏览文件 @
7221f5a6
...
...
@@ -403,23 +403,24 @@ static bool isTopBottomQuery(SQuery *pQuery) {
return
false
;
}
static
SDataStatis
*
getStatisInfo
(
SQuery
*
pQuery
,
SDataStatis
*
pStatis
,
SDataBlockInfo
*
pDataBlockInfo
,
int32_t
index
)
{
static
SDataStatis
*
getStatisInfo
(
SQuery
*
pQuery
,
SDataStatis
*
pStatis
,
int32_t
numOfCols
,
int32_t
index
)
{
// for a tag column, no corresponding field info
SColIndex
*
pColIndex
Ex
=
&
pQuery
->
pSelectExpr
[
index
].
base
.
colInfo
;
if
(
TSDB_COL_IS_TAG
(
pColIndex
Ex
->
flag
))
{
SColIndex
*
pColIndex
=
&
pQuery
->
pSelectExpr
[
index
].
base
.
colInfo
;
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
return
NULL
;
}
/*
* Choose the right column field info by field id, since the file block may be out of date,
* which means the newest table schema is not equalled to the schema of this block.
* TODO: speedup by using bsearch
*/
for
(
int32_t
i
=
0
;
i
<
pDataBlockInfo
->
numOfCols
;
++
i
)
{
if
(
pColIndex
Ex
->
colId
==
pStatis
[
i
].
colId
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
if
(
pColIndex
->
colId
==
pStatis
[
i
].
colId
)
{
return
&
pStatis
[
i
];
}
}
return
NULL
;
}
...
...
@@ -431,8 +432,7 @@ static SDataStatis *getStatisInfo(SQuery *pQuery, SDataStatis *pStatis, SDataBlo
* @param pColStatis
* @return
*/
static
bool
hasNullValue
(
SQuery
*
pQuery
,
int32_t
col
,
SDataBlockInfo
*
pDataBlockInfo
,
SDataStatis
*
pStatis
,
SDataStatis
**
pColStatis
)
{
static
bool
hasNullValue
(
SQuery
*
pQuery
,
int32_t
col
,
int32_t
numOfCols
,
SDataStatis
*
pStatis
,
SDataStatis
**
pColStatis
)
{
SColIndex
*
pColIndex
=
&
pQuery
->
pSelectExpr
[
col
].
base
.
colInfo
;
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
return
false
;
...
...
@@ -444,7 +444,7 @@ static bool hasNullValue(SQuery *pQuery, int32_t col, SDataBlockInfo *pDataBlock
}
if
(
pStatis
!=
NULL
)
{
*
pColStatis
=
getStatisInfo
(
pQuery
,
pStatis
,
pDataBlockInfo
,
col
);
*
pColStatis
=
getStatisInfo
(
pQuery
,
pStatis
,
numOfCols
,
col
);
}
else
{
*
pColStatis
=
NULL
;
}
...
...
@@ -936,7 +936,7 @@ static void blockwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *
SDataStatis
*
tpField
=
NULL
;
bool
hasNull
=
hasNullValue
(
pQuery
,
k
,
pDataBlockInfo
,
pStatis
,
&
tpField
);
bool
hasNull
=
hasNullValue
(
pQuery
,
k
,
pDataBlockInfo
->
numOfCols
,
pStatis
,
&
tpField
);
char
*
dataBlock
=
getDataBlock
(
pRuntimeEnv
,
&
sasArray
[
k
],
k
,
pDataBlockInfo
->
rows
,
pDataBlock
);
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
primaryKeyCol
,
pDataBlockInfo
->
rows
,
functionId
,
tpField
,
hasNull
,
...
...
@@ -1157,7 +1157,7 @@ static void rowwiseApplyFunctions(SQueryRuntimeEnv *pRuntimeEnv, SDataStatis *pS
SDataStatis
*
pColStatis
=
NULL
;
bool
hasNull
=
hasNullValue
(
pQuery
,
k
,
pDataBlockInfo
,
pStatis
,
&
pColStatis
);
bool
hasNull
=
hasNullValue
(
pQuery
,
k
,
pDataBlockInfo
->
numOfCols
,
pStatis
,
&
pColStatis
);
char
*
dataBlock
=
getDataBlock
(
pRuntimeEnv
,
&
sasArray
[
k
],
k
,
pDataBlockInfo
->
rows
,
pDataBlock
);
setExecParams
(
pQuery
,
&
pCtx
[
k
],
dataBlock
,
primaryKeyCol
,
pDataBlockInfo
->
rows
,
functionId
,
pColStatis
,
hasNull
,
...
...
@@ -2455,9 +2455,9 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
}
SDataStatis
*
pStatis
=
NULL
;
SArray
*
pDataBlock
=
loadDataBlockOnDemand
(
pRuntimeEnv
,
pQueryHandle
,
&
blockInfo
,
&
pStatis
);
pQuery
->
pos
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
0
:
blockInfo
.
rows
-
1
;
SArray
*
pDataBlock
=
loadDataBlockOnDemand
(
pRuntimeEnv
,
pQueryHandle
,
&
blockInfo
,
&
pStatis
);
int32_t
numOfRes
=
tableApplyFunctionsOnBlock
(
pRuntimeEnv
,
&
blockInfo
,
pStatis
,
binarySearchForKey
,
pDataBlock
);
qTrace
(
"QInfo:%p check data block, brange:%"
PRId64
"-%"
PRId64
", rows:%d, numOfRes:%d"
,
GET_QINFO_ADDR
(
pRuntimeEnv
),
...
...
@@ -5610,18 +5610,18 @@ static void doUpdateExprColumnIndex(SQuery *pQuery) {
continue
;
}
SColIndex
*
pColIndex
Ex
=
&
pSqlExprMsg
->
colInfo
;
if
(
!
TSDB_COL_IS_TAG
(
pColIndex
Ex
->
flag
))
{
SColIndex
*
pColIndex
=
&
pSqlExprMsg
->
colInfo
;
if
(
!
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
for
(
int32_t
f
=
0
;
f
<
pQuery
->
numOfCols
;
++
f
)
{
if
(
pColIndex
Ex
->
colId
==
pQuery
->
colList
[
f
].
colId
)
{
pColIndex
Ex
->
colIndex
=
f
;
if
(
pColIndex
->
colId
==
pQuery
->
colList
[
f
].
colId
)
{
pColIndex
->
colIndex
=
f
;
break
;
}
}
}
else
{
for
(
int32_t
f
=
0
;
f
<
pQuery
->
numOfTags
;
++
f
)
{
if
(
pColIndex
Ex
->
colId
==
pQuery
->
tagColList
[
f
].
colId
)
{
pColIndex
Ex
->
colIndex
=
f
;
if
(
pColIndex
->
colId
==
pQuery
->
tagColList
[
f
].
colId
)
{
pColIndex
->
colIndex
=
f
;
break
;
}
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
7221f5a6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录