Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
730a2562
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
730a2562
编写于
6月 13, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: json tag plan ut
上级
1674e41d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
9 deletion
+36
-9
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+23
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+9
-9
source/libs/planner/test/planPartByTest.cpp
source/libs/planner/test/planPartByTest.cpp
+4
-0
未找到文件。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
730a2562
...
...
@@ -157,6 +157,28 @@ void generateTestST1(MockCatalogService* mcs) {
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s3"
,
1
);
}
/*
* Super Table: st2
* Field | Type | DataType | Bytes |
* ==========================================================================
* ts | column | TIMESTAMP | 8 |
* c1 | column | INT | 4 |
* c2 | column | VARCHAR | 20 |
* jtag | tag | json | -- |
* Child Table: st2s1, st2s2
*/
void
generateTestST2
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st2"
,
TSDB_SUPER_TABLE
,
3
,
1
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"jtag"
,
TSDB_DATA_TYPE_JSON
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s2"
,
2
);
}
void
generateFunctions
(
MockCatalogService
*
mcs
)
{
mcs
->
createFunction
(
"udf1"
,
TSDB_FUNC_TYPE_SCALAR
,
TSDB_DATA_TYPE_INT
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
,
0
);
mcs
->
createFunction
(
"udf2"
,
TSDB_FUNC_TYPE_AGGREGATE
,
TSDB_DATA_TYPE_DOUBLE
,
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
...
...
@@ -283,6 +305,7 @@ void generateMetaData() {
generatePerformanceSchema
(
g_mockCatalogService
.
get
());
generateTestT1
(
g_mockCatalogService
.
get
());
generateTestST1
(
g_mockCatalogService
.
get
());
generateTestST2
(
g_mockCatalogService
.
get
());
generateFunctions
(
g_mockCatalogService
.
get
());
g_mockCatalogService
->
showTables
();
}
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
730a2562
...
...
@@ -56,14 +56,14 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char* pKey) {
return
sprintf
(
pKey
,
"%s"
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
}
static
SNode
*
createSlotDesc
(
SPhysiPlanContext
*
pCxt
,
const
SNode
*
pNode
,
int16_t
slotId
,
bool
output
)
{
static
SNode
*
createSlotDesc
(
SPhysiPlanContext
*
pCxt
,
const
SNode
*
pNode
,
int16_t
slotId
,
bool
output
,
bool
reserve
)
{
SSlotDescNode
*
pSlot
=
(
SSlotDescNode
*
)
nodesMakeNode
(
QUERY_NODE_SLOT_DESC
);
if
(
NULL
==
pSlot
)
{
return
NULL
;
}
pSlot
->
slotId
=
slotId
;
pSlot
->
dataType
=
((
SExprNode
*
)
pNode
)
->
resType
;
pSlot
->
reserve
=
fals
e
;
pSlot
->
reserve
=
reserv
e
;
pSlot
->
output
=
output
;
return
(
SNode
*
)
pSlot
;
}
...
...
@@ -131,7 +131,7 @@ static int32_t buildDataBlockSlots(SPhysiPlanContext* pCxt, SNodeList* pList, SD
int16_t
slotId
=
0
;
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pList
)
{
code
=
nodesListStrictAppend
(
pDataBlockDesc
->
pSlots
,
createSlotDesc
(
pCxt
,
pNode
,
slotId
,
true
));
code
=
nodesListStrictAppend
(
pDataBlockDesc
->
pSlots
,
createSlotDesc
(
pCxt
,
pNode
,
slotId
,
true
,
false
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
putSlotToHash
(
pDataBlockDesc
->
dataBlockId
,
slotId
,
pNode
,
pHash
);
}
...
...
@@ -181,7 +181,7 @@ static int16_t getUnsetSlotId(const SArray* pSlotIdsInfo) {
}
static
int32_t
addDataBlockSlotsImpl
(
SPhysiPlanContext
*
pCxt
,
SNodeList
*
pList
,
SDataBlockDescNode
*
pDataBlockDesc
,
const
char
*
pStmtName
,
bool
output
)
{
const
char
*
pStmtName
,
bool
output
,
bool
reserve
)
{
if
(
NULL
==
pList
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -196,7 +196,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList,
int32_t
len
=
getSlotKey
(
pExpr
,
pStmtName
,
name
);
SSlotIndex
*
pIndex
=
taosHashGet
(
pHash
,
name
,
len
);
if
(
NULL
==
pIndex
)
{
code
=
nodesListStrictAppend
(
pDataBlockDesc
->
pSlots
,
createSlotDesc
(
pCxt
,
pExpr
,
nextSlotId
,
output
));
code
=
nodesListStrictAppend
(
pDataBlockDesc
->
pSlots
,
createSlotDesc
(
pCxt
,
pExpr
,
nextSlotId
,
output
,
reserve
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
putSlotToHashImpl
(
pDataBlockDesc
->
dataBlockId
,
nextSlotId
,
name
,
len
,
pHash
);
}
...
...
@@ -226,7 +226,7 @@ static int32_t addDataBlockSlotsImpl(SPhysiPlanContext* pCxt, SNodeList* pList,
}
static
int32_t
addDataBlockSlots
(
SPhysiPlanContext
*
pCxt
,
SNodeList
*
pList
,
SDataBlockDescNode
*
pDataBlockDesc
)
{
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
NULL
,
false
);
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
NULL
,
false
,
false
);
}
static
int32_t
addDataBlockSlot
(
SPhysiPlanContext
*
pCxt
,
SNode
**
pNode
,
SDataBlockDescNode
*
pDataBlockDesc
)
{
...
...
@@ -248,11 +248,11 @@ static int32_t addDataBlockSlot(SPhysiPlanContext* pCxt, SNode** pNode, SDataBlo
static
int32_t
addDataBlockSlotsForProject
(
SPhysiPlanContext
*
pCxt
,
const
char
*
pStmtName
,
SNodeList
*
pList
,
SDataBlockDescNode
*
pDataBlockDesc
)
{
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
pStmtName
,
true
);
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
pStmtName
,
true
,
false
);
}
static
int32_t
pushdownDataBlockSlots
(
SPhysiPlanContext
*
pCxt
,
SNodeList
*
pList
,
SDataBlockDescNode
*
pDataBlockDesc
)
{
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
NULL
,
true
);
return
addDataBlockSlotsImpl
(
pCxt
,
pList
,
pDataBlockDesc
,
NULL
,
true
,
true
);
}
typedef
struct
SSetSlotIdCxt
{
...
...
@@ -1117,7 +1117,7 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pPrecalcExprs
)
{
code
=
setListSlotId
(
pCxt
,
pChildTupe
->
dataBlockId
,
-
1
,
pPrecalcExprs
,
&
pPart
->
pExprs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
add
DataBlockSlots
(
pCxt
,
pPart
->
pExprs
,
pChildTupe
);
code
=
pushdown
DataBlockSlots
(
pCxt
,
pPart
->
pExprs
,
pChildTupe
);
}
}
...
...
source/libs/planner/test/planPartByTest.cpp
浏览文件 @
730a2562
...
...
@@ -24,6 +24,10 @@ TEST_F(PlanPartitionByTest, basic) {
useDb
(
"root"
,
"test"
);
run
(
"select * from t1 partition by c1"
);
run
(
"select ts, c1 + 1 from st1 partition by c1 + 1"
);
run
(
"select ts, jtag->'tag1' from st2 partition by jtag->'tag1'"
);
}
TEST_F
(
PlanPartitionByTest
,
withAggFunc
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录