Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0108d6da
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看板
提交
0108d6da
编写于
10月 29, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10564] fix bug in planner.
上级
80295947
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
10 deletion
+14
-10
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-0
source/libs/parser/inc/queryInfoUtil.h
source/libs/parser/inc/queryInfoUtil.h
+0
-1
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+2
-0
source/libs/planner/src/planner.c
source/libs/planner/src/planner.c
+10
-9
未找到文件。
include/libs/parser/parser.h
浏览文件 @
0108d6da
...
@@ -230,6 +230,8 @@ SExprInfo* createExprInfo(STableMetaInfo* pTableMetaInfo, int16_t functionId, SC
...
@@ -230,6 +230,8 @@ SExprInfo* createExprInfo(STableMetaInfo* pTableMetaInfo, int16_t functionId, SC
int32_t
copyExprInfoList
(
SArray
*
dst
,
const
SArray
*
src
,
uint64_t
uid
,
bool
deepcopy
);
int32_t
copyExprInfoList
(
SArray
*
dst
,
const
SArray
*
src
,
uint64_t
uid
,
bool
deepcopy
);
STableMetaInfo
*
getMetaInfo
(
SQueryStmtInfo
*
pQueryInfo
,
int32_t
tableIndex
);
STableMetaInfo
*
getMetaInfo
(
SQueryStmtInfo
*
pQueryInfo
,
int32_t
tableIndex
);
SSchema
*
getOneColumnSchema
(
const
STableMeta
*
pTableMeta
,
int32_t
colIndex
);
int32_t
getNewResColId
();
int32_t
getNewResColId
();
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/libs/parser/inc/queryInfoUtil.h
浏览文件 @
0108d6da
...
@@ -27,7 +27,6 @@ int32_t getNumOfColumns(const STableMeta* pTableMeta);
...
@@ -27,7 +27,6 @@ int32_t getNumOfColumns(const STableMeta* pTableMeta);
int32_t
getNumOfTags
(
const
STableMeta
*
pTableMeta
);
int32_t
getNumOfTags
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableColumnSchema
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableColumnSchema
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableTagSchema
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getTableTagSchema
(
const
STableMeta
*
pTableMeta
);
SSchema
*
getOneColumnSchema
(
const
STableMeta
*
pTableMeta
,
int32_t
colIndex
);
size_t
getNumOfExprs
(
SQueryStmtInfo
*
pQueryInfo
);
size_t
getNumOfExprs
(
SQueryStmtInfo
*
pQueryInfo
);
SExprInfo
*
createBinaryExprInfo
(
struct
tExprNode
*
pNode
,
SSchema
*
pResSchema
);
SExprInfo
*
createBinaryExprInfo
(
struct
tExprNode
*
pNode
,
SSchema
*
pResSchema
);
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
0108d6da
...
@@ -1790,6 +1790,8 @@ static void setTsOutputExprInfo(SQueryStmtInfo* pQueryInfo, STableMetaInfo* pTab
...
@@ -1790,6 +1790,8 @@ static void setTsOutputExprInfo(SQueryStmtInfo* pQueryInfo, STableMetaInfo* pTab
SSchema
s
=
createSchema
(
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_KEYSIZE
,
getNewResColId
(),
"ts"
);
SSchema
s
=
createSchema
(
TSDB_DATA_TYPE_TIMESTAMP
,
TSDB_KEYSIZE
,
getNewResColId
(),
"ts"
);
SExprInfo
*
pExpr
=
createExprInfo
(
pTableMetaInfo
,
FUNCTION_TS_DUMMY
,
&
indexTS
,
NULL
,
&
s
,
TSDB_KEYSIZE
);
SExprInfo
*
pExpr
=
createExprInfo
(
pTableMetaInfo
,
FUNCTION_TS_DUMMY
,
&
indexTS
,
NULL
,
&
s
,
TSDB_KEYSIZE
);
strncpy
(
pExpr
->
base
.
token
,
"ts"
,
tListLen
(
pExpr
->
base
.
token
));
addExprInfo
(
pQueryInfo
,
outputIndex
,
pExpr
);
addExprInfo
(
pQueryInfo
,
outputIndex
,
pExpr
);
SSchema
*
pSourceSchema
=
getOneColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
indexTS
.
columnIndex
);
SSchema
*
pSourceSchema
=
getOneColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
indexTS
.
columnIndex
);
...
...
source/libs/planner/src/planner.c
浏览文件 @
0108d6da
...
@@ -108,9 +108,7 @@ static SQueryPlanNode* createQueryNode(int32_t type, const char* name, SQueryPla
...
@@ -108,9 +108,7 @@ static SQueryPlanNode* createQueryNode(int32_t type, const char* name, SQueryPla
pNode
->
pExpr
=
taosArrayInit
(
numOfOutput
,
POINTER_BYTES
);
pNode
->
pExpr
=
taosArrayInit
(
numOfOutput
,
POINTER_BYTES
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
p
=
calloc
(
1
,
sizeof
(
SExprInfo
));
taosArrayPush
(
pNode
->
pExpr
,
&
pExpr
[
i
]);
assignExprInfo
(
p
,
pExpr
[
i
]);
taosArrayPush
(
pNode
->
pExpr
,
&
p
);
}
}
pNode
->
pPrevNodes
=
taosArrayInit
(
4
,
POINTER_BYTES
);
pNode
->
pPrevNodes
=
taosArrayInit
(
4
,
POINTER_BYTES
);
...
@@ -183,16 +181,16 @@ static SQueryPlanNode* doAddTableColumnNode(SQueryStmtInfo* pQueryInfo, STableMe
...
@@ -183,16 +181,16 @@ static SQueryPlanNode* doAddTableColumnNode(SQueryStmtInfo* pQueryInfo, STableMe
// table source column projection, generate the projection expr
// table source column projection, generate the projection expr
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
tableCols
);
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
tableCols
);
SExprInfo
**
pExpr
=
calloc
(
numOfCols
,
POINTER_BYTES
);
SExprInfo
**
pExpr
=
calloc
(
numOfCols
,
POINTER_BYTES
);
SSchema
*
pSchema
=
pTableMetaInfo
->
pTableMeta
->
schema
;
STableMetaInfo
*
pTableMetaInfo1
=
getMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo1
=
getMetaInfo
(
pQueryInfo
,
0
);
SSchema
resultSchema
=
*
pSchema
;
resultSchema
.
colId
=
getNewResColId
();
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumn
*
pCol
=
taosArrayGetP
(
tableCols
,
i
);
SColumn
*
pCol
=
taosArrayGetP
(
tableCols
,
i
);
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
pCol
->
columnIndex
};
SColumnIndex
index
=
{.
tableIndex
=
0
,
.
columnIndex
=
pCol
->
columnIndex
};
SSchema
*
pSchema
=
getOneColumnSchema
(
pTableMetaInfo
->
pTableMeta
,
i
);
SSchema
resultSchema
=
*
pSchema
;
SExprInfo
*
p
=
createExprInfo
(
pTableMetaInfo1
,
FUNCTION_PRJ
,
&
index
,
NULL
,
&
resultSchema
,
0
);
SExprInfo
*
p
=
createExprInfo
(
pTableMetaInfo1
,
FUNCTION_PRJ
,
&
index
,
NULL
,
&
resultSchema
,
0
);
pExpr
[
i
]
=
p
;
pExpr
[
i
]
=
p
;
}
}
...
@@ -252,7 +250,8 @@ static SQueryPlanNode* doCreateQueryPlanForOneTableImpl(SQueryStmtInfo* pQueryIn
...
@@ -252,7 +250,8 @@ static SQueryPlanNode* doCreateQueryPlanForOneTableImpl(SQueryStmtInfo* pQueryIn
static
SQueryPlanNode
*
doCreateQueryPlanForOneTable
(
SQueryStmtInfo
*
pQueryInfo
,
STableMetaInfo
*
pTableMetaInfo
,
SArray
*
pExprs
,
static
SQueryPlanNode
*
doCreateQueryPlanForOneTable
(
SQueryStmtInfo
*
pQueryInfo
,
STableMetaInfo
*
pTableMetaInfo
,
SArray
*
pExprs
,
SArray
*
tableCols
)
{
SArray
*
tableCols
)
{
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
tstrncpy
(
name
,
pTableMetaInfo
->
name
.
tname
,
TSDB_TABLE_FNAME_LEN
);
// tNameExtractFullName(&pTableMetaInfo->name, name);
SQueryTableInfo
info
=
{.
tableName
=
strdup
(
name
),
.
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
,};
SQueryTableInfo
info
=
{.
tableName
=
strdup
(
name
),
.
uid
=
pTableMetaInfo
->
pTableMeta
->
uid
,};
...
@@ -450,9 +449,11 @@ static int32_t doPrintPlan(char* buf, SQueryPlanNode* pQueryNode, int32_t level,
...
@@ -450,9 +449,11 @@ static int32_t doPrintPlan(char* buf, SQueryPlanNode* pQueryNode, int32_t level,
len
+=
len1
;
len
+=
len1
;
SInterval
*
pInterval
=
pQueryNode
->
pExtInfo
;
SInterval
*
pInterval
=
pQueryNode
->
pExtInfo
;
len1
=
sprintf
(
buf
+
len
,
"interval:%"
PRId64
"(%s), sliding:%"
PRId64
"(%s), offset:%"
PRId64
"
\n
"
,
// todo dynamic return the time precision
len1
=
sprintf
(
buf
+
len
,
"interval:%"
PRId64
"(%s), sliding:%"
PRId64
"(%s), offset:%"
PRId64
"(%s)
\n
"
,
pInterval
->
interval
,
TSDB_TIME_PRECISION_MILLI_STR
,
pInterval
->
sliding
,
TSDB_TIME_PRECISION_MILLI_STR
,
pInterval
->
interval
,
TSDB_TIME_PRECISION_MILLI_STR
,
pInterval
->
sliding
,
TSDB_TIME_PRECISION_MILLI_STR
,
pInterval
->
offset
);
pInterval
->
offset
,
TSDB_TIME_PRECISION_MILLI_STR
);
len
+=
len1
;
len
+=
len1
;
break
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录