Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d57b9459
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看板
提交
d57b9459
编写于
5月 06, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-3299]
上级
dbe026a8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
25 deletion
+18
-25
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+5
-1
src/query/src/qPlan.c
src/query/src/qPlan.c
+11
-21
src/query/src/qSqlParser.c
src/query/src/qSqlParser.c
+0
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
d57b9459
...
@@ -134,8 +134,8 @@ typedef struct SJoinNode {
...
@@ -134,8 +134,8 @@ typedef struct SJoinNode {
}
SJoinNode
;
}
SJoinNode
;
typedef
struct
SJoinInfo
{
typedef
struct
SJoinInfo
{
bool
hasJoin
;
bool
hasJoin
;
SJoinNode
*
joinTables
[
TSDB_MAX_JOIN_TABLE_NUM
];
SJoinNode
*
joinTables
[
TSDB_MAX_JOIN_TABLE_NUM
];
}
SJoinInfo
;
}
SJoinInfo
;
typedef
struct
STagCond
{
typedef
struct
STagCond
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d57b9459
...
@@ -3678,10 +3678,14 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
...
@@ -3678,10 +3678,14 @@ static bool validateJoinExprNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlExpr
SSchema
*
pLeftSchema
=
tscGetTableSchema
(
pLeftMeterMeta
->
pTableMeta
);
SSchema
*
pLeftSchema
=
tscGetTableSchema
(
pLeftMeterMeta
->
pTableMeta
);
int16_t
leftType
=
pLeftSchema
[
pLeftIndex
->
columnIndex
].
type
;
int16_t
leftType
=
pLeftSchema
[
pLeftIndex
->
columnIndex
].
type
;
tscColumnListInsert
(
pQueryInfo
->
colList
,
pLeftIndex
->
columnIndex
,
pLeftMeterMeta
->
pTableMeta
->
id
.
uid
,
&
pLeftSchema
[
pLeftIndex
->
columnIndex
]);
STableMetaInfo
*
pRightMeterMeta
=
tscGetMetaInfo
(
pQueryInfo
,
rightIndex
.
tableIndex
);
STableMetaInfo
*
pRightMeterMeta
=
tscGetMetaInfo
(
pQueryInfo
,
rightIndex
.
tableIndex
);
SSchema
*
pRightSchema
=
tscGetTableSchema
(
pRightMeterMeta
->
pTableMeta
);
SSchema
*
pRightSchema
=
tscGetTableSchema
(
pRightMeterMeta
->
pTableMeta
);
int16_t
rightType
=
pRightSchema
[
rightIndex
.
columnIndex
].
type
;
int16_t
rightType
=
pRightSchema
[
rightIndex
.
columnIndex
].
type
;
tscColumnListInsert
(
pQueryInfo
->
colList
,
rightIndex
.
columnIndex
,
pRightMeterMeta
->
pTableMeta
->
id
.
uid
,
&
pRightSchema
[
rightIndex
.
columnIndex
]);
if
(
leftType
!=
rightType
)
{
if
(
leftType
!=
rightType
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
return
false
;
...
@@ -3846,7 +3850,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
...
@@ -3846,7 +3850,7 @@ static int32_t handleExprInQueryCond(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSql
taosArrayPush
((
*
rightNode
)
->
tsJoin
,
&
leftIdx
);
taosArrayPush
((
*
rightNode
)
->
tsJoin
,
&
leftIdx
);
/*
/*
*
t
o release expression, e.g., m1.ts = m2.ts,
*
T
o release expression, e.g., m1.ts = m2.ts,
* since this expression is used to set the join query type
* since this expression is used to set the join query type
*/
*/
tSqlExprDestroy
(
*
pExpr
);
tSqlExprDestroy
(
*
pExpr
);
...
...
src/query/src/qPlan.c
浏览文件 @
d57b9459
...
@@ -23,9 +23,15 @@
...
@@ -23,9 +23,15 @@
typedef
struct
SFillEssInfo
{
typedef
struct
SFillEssInfo
{
int32_t
fillType
;
// fill type
int32_t
fillType
;
// fill type
int64_t
*
val
;
// fill value
int64_t
*
val
;
// fill value
}
SFillEssInfo
;
}
SFillEssInfo
;
typedef
struct
SJoinCond
{
bool
tagExists
;
// denote if tag condition exists or not
SColumn
*
tagCond
[
2
];
SColumn
*
colCond
[
2
];
}
SJoinCond
;
static
SQueryNode
*
createQueryNode
(
int32_t
type
,
const
char
*
name
,
SQueryNode
**
prev
,
static
SQueryNode
*
createQueryNode
(
int32_t
type
,
const
char
*
name
,
SQueryNode
**
prev
,
int32_t
numOfPrev
,
SExprInfo
**
pExpr
,
int32_t
numOfOutput
,
SQueryTableInfo
*
pTableInfo
,
int32_t
numOfPrev
,
SExprInfo
**
pExpr
,
int32_t
numOfOutput
,
SQueryTableInfo
*
pTableInfo
,
void
*
pExtInfo
)
{
void
*
pExtInfo
)
{
...
@@ -92,8 +98,8 @@ static SQueryNode* createQueryNode(int32_t type, const char* name, SQueryNode**
...
@@ -92,8 +98,8 @@ static SQueryNode* createQueryNode(int32_t type, const char* name, SQueryNode**
return
pNode
;
return
pNode
;
}
}
static
SQueryNode
*
doAddTableColumnNode
(
SQueryInfo
*
pQueryInfo
,
STableMetaInfo
*
pTableMetaInfo
,
static
SQueryNode
*
doAddTableColumnNode
(
SQueryInfo
*
pQueryInfo
,
STableMetaInfo
*
pTableMetaInfo
,
SQueryTableInfo
*
info
,
S
QueryTableInfo
*
info
,
S
Array
*
pExprs
,
SArray
*
tableCols
)
{
SArray
*
pExprs
,
SArray
*
tableCols
)
{
if
(
pQueryInfo
->
onlyTagQuery
)
{
if
(
pQueryInfo
->
onlyTagQuery
)
{
int32_t
num
=
taosArrayGetSize
(
pExprs
);
int32_t
num
=
taosArrayGetSize
(
pExprs
);
SQueryNode
*
pNode
=
createQueryNode
(
QNODE_TAGSCAN
,
"TableTagScan"
,
NULL
,
0
,
pExprs
->
pData
,
num
,
info
,
NULL
);
SQueryNode
*
pNode
=
createQueryNode
(
QNODE_TAGSCAN
,
"TableTagScan"
,
NULL
,
0
,
pExprs
->
pData
,
num
,
info
,
NULL
);
...
@@ -232,28 +238,12 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
...
@@ -232,28 +238,12 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
SQueryTableInfo
info
=
{.
tableName
=
strdup
(
name
),
.
id
=
pTableMetaInfo
->
pTableMeta
->
id
,};
SQueryTableInfo
info
=
{.
tableName
=
strdup
(
name
),
.
id
=
pTableMetaInfo
->
pTableMeta
->
id
,};
// 3. add the join columns (the tags and the primary timestamp column)
// 3. get the required table column list
tscInsertPrimaryTsSourceColumn
(
pQueryInfo
,
info
.
id
.
uid
);
SArray
*
tableColumnList
=
taosArrayInit
(
4
,
sizeof
(
SColumn
));
SArray
*
tableColumnList
=
taosArrayInit
(
4
,
sizeof
(
SColumn
));
tscColumnListCopy
(
tableColumnList
,
pQueryInfo
->
colList
,
uid
);
tscColumnListCopy
(
tableColumnList
,
pQueryInfo
->
colList
,
uid
);
// TODO add the tag column into the required column list
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
int16_t
tagColId
=
tscGetJoinTagColIdByUid
(
&
pQueryInfo
->
tagCond
,
info
.
id
.
uid
);
SSchema
*
s
=
tscGetColumnSchemaById
(
pTableMetaInfo
->
pTableMeta
,
tagColId
);
SColumn
*
col
=
calloc
(
1
,
sizeof
(
SColumn
));
col
->
tableUid
=
info
.
id
.
uid
;
col
->
info
.
colId
=
tagColId
;
col
->
info
.
type
=
s
->
type
;
col
->
info
.
bytes
=
s
->
bytes
;
taosArrayPush
(
pQueryInfo
->
colList
,
&
col
);
}
// 4. add the projection query node
// 4. add the projection query node
SQueryNode
*
pNode
=
doAddTableColumnNode
(
pQueryInfo
,
pTableMetaInfo
,
&
info
,
exprList
,
tableColumnList
);
SQueryNode
*
pNode
=
doAddTableColumnNode
(
pQueryInfo
,
pTableMetaInfo
,
&
info
,
exprList
,
tableColumnList
);
taosArrayPush
(
upstream
,
&
pNode
);
taosArrayPush
(
upstream
,
&
pNode
);
}
}
...
@@ -497,7 +487,7 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
...
@@ -497,7 +487,7 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
case
QNODE_JOIN
:
{
case
QNODE_JOIN
:
{
// print join condition
// print join condition
len1
=
sprintf
(
buf
+
len
,
"
\n
"
);
len1
=
sprintf
(
buf
+
len
,
"
)
\n
"
);
len
+=
len1
;
len
+=
len1
;
break
;
break
;
}
}
...
...
src/query/src/qSqlParser.c
浏览文件 @
d57b9459
...
@@ -229,7 +229,6 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
...
@@ -229,7 +229,6 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
pExpr
->
flags
&=
~
(
1
<<
EXPR_FLAG_TS_ERROR
);
pExpr
->
flags
&=
~
(
1
<<
EXPR_FLAG_TS_ERROR
);
}
}
switch
(
optrType
)
{
switch
(
optrType
)
{
case
TK_PLUS
:
{
case
TK_PLUS
:
{
pExpr
->
value
.
i64
=
pLeft
->
value
.
i64
+
pRight
->
value
.
i64
;
pExpr
->
value
.
i64
=
pLeft
->
value
.
i64
+
pRight
->
value
.
i64
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录