Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
c36a71e8
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c36a71e8
编写于
5月 06, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-3299]
上级
77d95c27
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
42 addition
and
14 deletion
+42
-14
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-0
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+20
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+4
-0
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-0
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-4
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+9
-9
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
c36a71e8
...
...
@@ -36,6 +36,9 @@ extern "C" {
#define UTIL_TABLE_IS_NORMAL_TABLE(metaInfo)\
(!(UTIL_TABLE_IS_SUPER_TABLE(metaInfo) || UTIL_TABLE_IS_CHILD_TABLE(metaInfo)))
#define UTIL_TABLE_IS_TMP_TABLE(metaInfo) \
(((metaInfo)->pTableMeta != NULL) && ((metaInfo)->pTableMeta->tableType == TSDB_TEMP_TABLE))
#pragma pack(push,1)
// this struct is transfered as binary, padding two bytes to avoid
// an 'uid' whose low bytes is 0xff being recoginized as NULL,
...
...
src/client/src/tscSQLParser.c
浏览文件 @
c36a71e8
...
...
@@ -1859,7 +1859,9 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
// add the primary timestamp column even though it is not required by user
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
tscInsertPrimaryTsSourceColumn
(
pQueryInfo
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
if
(
!
UTIL_TABLE_IS_TMP_TABLE
(
pTableMetaInfo
))
{
tscInsertPrimaryTsSourceColumn
(
pQueryInfo
,
pTableMetaInfo
->
pTableMeta
->
id
.
uid
);
}
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
@@ -7221,6 +7223,23 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
return
TSDB_CODE_TSC_INVALID_SQL
;
}
// all columns are added into the table column list
for
(
int32_t
i
=
0
;
i
<
pTableMeta
->
tableInfo
.
numOfColumns
;
++
i
)
{
tscColumnListInsert
(
current
->
colList
,
i
,
pTableMetaInfo1
->
pTableMeta
->
id
.
uid
,
&
pTableMetaInfo1
->
pTableMeta
->
schema
[
i
]);
}
if
(
pSqlNode
->
pWhere
!=
NULL
)
{
if
(
validateWhereNode
(
current
,
&
pSqlNode
->
pWhere
,
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
pSqlNode
->
pWhere
=
NULL
;
if
(
pTableMeta
->
tableInfo
.
precision
==
TSDB_TIME_PRECISION_MILLI
)
{
current
->
window
.
skey
=
current
->
window
.
skey
/
1000
;
current
->
window
.
ekey
=
current
->
window
.
ekey
/
1000
;
}
}
}
else
{
pQueryInfo
->
command
=
TSDB_SQL_SELECT
;
...
...
src/client/src/tscSql.c
浏览文件 @
c36a71e8
...
...
@@ -378,6 +378,10 @@ int taos_num_fields(TAOS_RES *res) {
return
num
;
}
while
(
pQueryInfo
->
pDownstream
!=
NULL
)
{
pQueryInfo
=
pQueryInfo
->
pDownstream
;
}
size_t
numOfCols
=
tscNumOfFields
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SInternalField
*
pInfo
=
taosArrayGet
(
pQueryInfo
->
fieldsInfo
.
internalField
,
i
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
c36a71e8
...
...
@@ -3580,6 +3580,8 @@ void* createQueryInfoFromQueryNode(SQueryInfo* pQueryInfo, SExprInfo* pExprs, ST
tfree
(
pExprs
);
createFilterInfo
(
pQueryAttr
,
0
);
SArray
*
pa
=
NULL
;
if
(
stage
==
MASTER_SCAN
)
{
pa
=
createExecOperatorPlan
(
pQueryAttr
);
...
...
src/client/src/tscUtil.c
浏览文件 @
c36a71e8
...
...
@@ -479,9 +479,9 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo) {
}
int32_t
tscCreateResPointerInfo
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
)
{
if
(
pRes
->
tsrow
==
NULL
)
{
pRes
->
numOfCols
=
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
pRes
->
numOfCols
=
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
if
(
pRes
->
tsrow
==
NULL
)
{
pRes
->
tsrow
=
calloc
(
pRes
->
numOfCols
,
POINTER_BYTES
);
pRes
->
urow
=
calloc
(
pRes
->
numOfCols
,
POINTER_BYTES
);
pRes
->
length
=
calloc
(
pRes
->
numOfCols
,
sizeof
(
int32_t
));
...
...
@@ -704,8 +704,7 @@ SOperatorInfo* createDummyInputOperator(char* pResult, SSchema* pSchema, int32_t
assert
(
numOfCols
>
0
);
SDummyInputInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SDummyInputInfo
));
pInfo
->
pRes
=
(
SSqlRes
*
)
pResult
;
pInfo
->
pRes
=
(
SSqlRes
*
)
pResult
;
pInfo
->
block
=
calloc
(
numOfCols
,
sizeof
(
SSDataBlock
));
pInfo
->
block
->
info
.
numOfCols
=
numOfCols
;
...
...
src/query/inc/qExecutor.h
浏览文件 @
c36a71e8
...
...
@@ -543,6 +543,7 @@ SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SGroupbyExpr *pGroupbyExpr, S
int32_t
initQInfo
(
STsBufInfo
*
pTsBufInfo
,
void
*
tsdb
,
void
*
sourceOptr
,
SQInfo
*
pQInfo
,
SQueryParam
*
param
,
char
*
start
,
int32_t
prevResultLen
,
void
*
merger
);
int32_t
createFilterInfo
(
SQueryAttr
*
pQueryAttr
,
uint64_t
qId
);
void
freeColumnFilterInfo
(
SColumnFilterInfo
*
pFilter
,
int32_t
numOfFilters
);
STableQueryInfo
*
createTableQueryInfo
(
SQueryAttr
*
pQueryAttr
,
void
*
pTable
,
bool
groupbyColumn
,
STimeWindow
win
,
void
*
buf
);
...
...
src/query/src/qExecutor.c
浏览文件 @
c36a71e8
...
...
@@ -1748,7 +1748,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
SOperatorInfo
*
prev
=
pRuntimeEnv
->
proot
;
if
(
i
==
0
)
{
pRuntimeEnv
->
proot
=
createArithOperatorInfo
(
pRuntimeEnv
,
prev
,
pQueryAttr
->
pExpr1
,
pQueryAttr
->
numOfOutput
);
if
(
pRuntimeEnv
->
proot
!=
NULL
&&
p
RuntimeEnv
->
proot
->
operatorType
!=
OP_DummyInput
)
{
// TODO refactor
if
(
pRuntimeEnv
->
proot
!=
NULL
&&
p
rev
->
operatorType
!=
OP_DummyInput
)
{
// TODO refactor
setTableScanFilterOperatorInfo
(
prev
->
info
,
pRuntimeEnv
->
proot
);
}
}
else
{
...
...
@@ -1765,12 +1765,12 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int32_t numOf
}
case
OP_Filter
:
{
// todo refactor
assert
(
pQueryAttr
->
havingNum
>
0
);
if
(
pQueryAttr
->
stableQuery
)
{
pRuntimeEnv
->
proot
=
createFilterOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQueryAttr
->
pExpr3
,
pQueryAttr
->
numOfExpr3
);
}
else
{
pRuntimeEnv
->
proot
=
createFilterOperatorInfo
(
pRuntimeEnv
,
pRuntimeEnv
->
proot
,
pQueryAttr
->
pExpr1
,
pQueryAttr
->
numOfOutput
);
}
break
;
}
...
...
@@ -4141,12 +4141,12 @@ static void doCloseAllTimeWindow(SQueryRuntimeEnv* pRuntimeEnv) {
}
static
SSDataBlock
*
doTableScanImpl
(
void
*
param
,
bool
*
newgroup
)
{
SOperatorInfo
*
pOperator
=
(
SOperatorInfo
*
)
param
;
SOperatorInfo
*
pOperator
=
(
SOperatorInfo
*
)
param
;
STableScanInfo
*
pTableScanInfo
=
pOperator
->
info
;
SSDataBlock
*
pBlock
=
&
pTableScanInfo
->
block
;
STableScanInfo
*
pTableScanInfo
=
pOperator
->
info
;
SSDataBlock
*
pBlock
=
&
pTableScanInfo
->
block
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
pOperator
->
pRuntimeEnv
;
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
SQueryAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
STableGroupInfo
*
pTableGroupInfo
=
&
pOperator
->
pRuntimeEnv
->
tableqinfoGroupInfo
;
*
newgroup
=
false
;
...
...
@@ -5410,7 +5410,7 @@ SOperatorInfo* createArithOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorI
}
SOperatorInfo
*
createFilterOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
)
{
int32_t
numOfOutput
)
{
SFilterOperatorInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SFilterOperatorInfo
));
{
...
...
@@ -5444,7 +5444,7 @@ SOperatorInfo* createFilterOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperator
SOperatorInfo
*
pOperator
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
pOperator
->
name
=
"
Condition
Operator"
;
pOperator
->
name
=
"
Filter
Operator"
;
pOperator
->
operatorType
=
OP_Filter
;
pOperator
->
blockingOptr
=
false
;
pOperator
->
status
=
OP_IN_EXECUTING
;
...
...
@@ -6685,7 +6685,7 @@ void* doDestroyFilterInfo(SSingleColumnFilterInfo* pFilterInfo, int32_t numOfFil
return
NULL
;
}
static
int32_t
createFilterInfo
(
SQueryAttr
*
pQueryAttr
,
uint64_t
qId
)
{
int32_t
createFilterInfo
(
SQueryAttr
*
pQueryAttr
,
uint64_t
qId
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfCols
;
++
i
)
{
if
(
pQueryAttr
->
tableCols
[
i
].
flist
.
numOfFilters
>
0
)
{
pQueryAttr
->
numOfFilterCols
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录