Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
e45636ec
I
Iotdb
项目概览
apache
/
Iotdb
12 个月 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e45636ec
编写于
1月 19, 2022
作者:
Z
ZhaoXin
提交者:
GitHub
1月 19, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IOTDB-2440] Fix the query result is incorrect when using Template with aligned timeseries (#4902)
上级
6724bb3b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
102 addition
and
7 deletion
+102
-7
server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java
.../java/org/apache/iotdb/db/metadata/template/Template.java
+9
-2
server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
.../java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
+4
-3
server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
...va/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
+89
-2
未找到文件。
server/src/main/java/org/apache/iotdb/db/metadata/template/Template.java
浏览文件 @
e45636ec
...
...
@@ -26,6 +26,7 @@ import org.apache.iotdb.db.metadata.mnode.IEntityMNode;
import
org.apache.iotdb.db.metadata.mnode.IMNode
;
import
org.apache.iotdb.db.metadata.mnode.IMeasurementMNode
;
import
org.apache.iotdb.db.metadata.mnode.MeasurementMNode
;
import
org.apache.iotdb.db.metadata.path.PartialPath
;
import
org.apache.iotdb.db.metadata.utils.MetaUtils
;
import
org.apache.iotdb.db.qp.physical.sys.CreateTemplatePlan
;
import
org.apache.iotdb.db.utils.SerializeUtils
;
...
...
@@ -248,10 +249,16 @@ public class Template {
String
[]
nodeNames
,
TSDataType
[]
dataTypes
,
TSEncoding
[]
encodings
,
CompressionType
[]
compressors
)
{
CompressionType
[]
compressors
)
throws
IllegalPathException
{
MeasurementSchema
[]
schemas
=
new
MeasurementSchema
[
nodeNames
.
length
];
for
(
int
i
=
0
;
i
<
nodeNames
.
length
;
i
++)
{
schemas
[
i
]
=
new
MeasurementSchema
(
nodeNames
[
i
],
dataTypes
[
i
],
encodings
[
i
],
compressors
[
i
]);
schemas
[
i
]
=
new
MeasurementSchema
(
new
PartialPath
(
nodeNames
[
i
]).
getMeasurement
(),
dataTypes
[
i
],
encodings
[
i
],
compressors
[
i
]);
}
return
schemas
;
}
...
...
server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
浏览文件 @
e45636ec
...
...
@@ -894,13 +894,14 @@ public class MManagerBasicTest {
Set
<
String
>
allSchema
=
new
HashSet
<>();
for
(
IMeasurementSchema
schema
:
node
.
getSchemaTemplate
().
getSchemaMap
().
values
())
{
allSchema
.
add
(
"root.sg1.d1"
+
TsFileConstant
.
PATH_SEPARATOR
+
schema
.
getMeasurementId
());
allSchema
.
add
(
"root.sg1.d1.vector"
+
TsFileConstant
.
PATH_SEPARATOR
+
schema
.
getMeasurementId
());
}
for
(
MeasurementPath
measurementPath
:
manager
.
getMeasurementPaths
(
new
PartialPath
(
"root.sg1.
d1.
**"
)))
{
manager
.
getMeasurementPaths
(
new
PartialPath
(
"root.sg1.**"
)))
{
allSchema
.
remove
(
measurementPath
.
toString
());
}
allSchema
.
remove
(
"root.sg1.d1.vector.s11"
);
assertTrue
(
allSchema
.
isEmpty
());
IMeasurementMNode
mNode
=
manager
.
getMeasurementMNode
(
new
PartialPath
(
"root.sg1.d1.s11"
));
...
...
server/src/test/java/org/apache/iotdb/db/qp/physical/InsertRowPlanTest.java
浏览文件 @
e45636ec
...
...
@@ -106,6 +106,89 @@ public class InsertRowPlanTest {
}
}
@Test
public
void
testInsertRowPlanWithTreeSchemaTemplate
()
throws
QueryProcessException
,
MetadataException
,
InterruptedException
,
QueryFilterOptimizationException
,
StorageEngineException
,
IOException
{
List
<
List
<
String
>>
measurementList
=
new
ArrayList
<>();
List
<
String
>
v1
=
Arrays
.
asList
(
"GPS.s1"
,
"GPS.s2"
,
"GPS.s3"
);
measurementList
.
add
(
v1
);
List
<
String
>
v2
=
Arrays
.
asList
(
"GPS2.s4"
,
"GPS2.s5"
);
measurementList
.
add
(
v2
);
measurementList
.
add
(
Collections
.
singletonList
(
"s6"
));
List
<
List
<
TSDataType
>>
dataTypesList
=
new
ArrayList
<>();
List
<
TSDataType
>
d1
=
Arrays
.
asList
(
TSDataType
.
DOUBLE
,
TSDataType
.
FLOAT
,
TSDataType
.
INT64
);
dataTypesList
.
add
(
d1
);
List
<
TSDataType
>
d2
=
Arrays
.
asList
(
TSDataType
.
INT32
,
TSDataType
.
BOOLEAN
);
dataTypesList
.
add
(
d2
);
dataTypesList
.
add
(
Collections
.
singletonList
(
TSDataType
.
TEXT
));
List
<
List
<
TSEncoding
>>
encodingList
=
new
ArrayList
<>();
List
<
TSEncoding
>
e1
=
Arrays
.
asList
(
TSEncoding
.
PLAIN
,
TSEncoding
.
PLAIN
,
TSEncoding
.
PLAIN
);
encodingList
.
add
(
e1
);
List
<
TSEncoding
>
e2
=
Arrays
.
asList
(
TSEncoding
.
PLAIN
,
TSEncoding
.
PLAIN
);
encodingList
.
add
(
e2
);
encodingList
.
add
(
Collections
.
singletonList
(
TSEncoding
.
PLAIN
));
List
<
List
<
CompressionType
>>
compressionTypes
=
new
ArrayList
<>();
compressionTypes
.
add
(
Arrays
.
asList
(
CompressionType
.
SNAPPY
,
CompressionType
.
SNAPPY
,
CompressionType
.
SNAPPY
));
compressionTypes
.
add
(
Arrays
.
asList
(
CompressionType
.
SNAPPY
,
CompressionType
.
SNAPPY
));
compressionTypes
.
add
(
Arrays
.
asList
(
CompressionType
.
SNAPPY
));
CreateTemplatePlan
plan
=
new
CreateTemplatePlan
(
"templateN"
,
measurementList
,
dataTypesList
,
encodingList
,
compressionTypes
);
IoTDB
.
metaManager
.
createSchemaTemplate
(
plan
);
IoTDB
.
metaManager
.
setSchemaTemplate
(
new
SetTemplatePlan
(
"templateN"
,
"root.isp.d1"
));
IoTDBDescriptor
.
getInstance
().
getConfig
().
setAutoCreateSchemaEnabled
(
false
);
InsertRowPlan
rowPlan
=
getInsertAlignedRowPlan
(
111L
);
PlanExecutor
executor
=
new
PlanExecutor
();
executor
.
insert
(
rowPlan
);
rowPlan
=
getInsertAlignedRowPlan
(
112L
);
executor
.
insert
(
rowPlan
);
rowPlan
=
getInsertAlignedRowPlan
(
113L
);
executor
.
insert
(
rowPlan
);
QueryPlan
queryPlan
=
(
QueryPlan
)
processor
.
parseSQLToPhysicalPlan
(
"select * from root.isp.d1.GPS"
);
QueryDataSet
dataSet
=
executor
.
processQuery
(
queryPlan
,
EnvironmentUtils
.
TEST_QUERY_CONTEXT
);
Assert
.
assertEquals
(
1
,
dataSet
.
getPaths
().
size
());
int
resSize
=
0
;
while
(
dataSet
.
hasNext
())
{
Assert
.
assertEquals
(
3
,
dataSet
.
next
().
getFields
().
size
());
resSize
++;
}
Assert
.
assertEquals
(
3
,
resSize
);
TSDataType
[]
dataTypes
=
new
TSDataType
[]
{
TSDataType
.
TEXT
};
String
[]
columns
=
new
String
[
1
];
columns
[
0
]
=
"a"
;
rowPlan
=
new
InsertRowPlan
(
new
PartialPath
(
"root.isp.d1"
),
1111L
,
new
String
[]
{
"s6"
},
dataTypes
,
columns
,
false
);
executor
.
insert
(
rowPlan
);
queryPlan
=
(
QueryPlan
)
processor
.
parseSQLToPhysicalPlan
(
"select * from root.isp.d1"
);
dataSet
=
executor
.
processQuery
(
queryPlan
,
EnvironmentUtils
.
TEST_QUERY_CONTEXT
);
Assert
.
assertEquals
(
1
,
dataSet
.
getPaths
().
size
());
Assert
.
assertEquals
(
true
,
dataSet
.
hasNext
());
queryPlan
=
(
QueryPlan
)
processor
.
parseSQLToPhysicalPlan
(
"select * from root.isp.d1.**"
);
dataSet
=
executor
.
processQuery
(
queryPlan
,
EnvironmentUtils
.
TEST_QUERY_CONTEXT
);
Assert
.
assertEquals
(
2
,
dataSet
.
getPaths
().
size
());
Assert
.
assertEquals
(
true
,
dataSet
.
hasNext
());
Assert
.
assertEquals
(
5
,
dataSet
.
next
().
getFields
().
size
());
}
@Test
public
void
testInsertRowPlanWithSchemaTemplate
()
throws
QueryProcessException
,
MetadataException
,
InterruptedException
,
...
...
@@ -250,9 +333,10 @@ public class InsertRowPlanTest {
executor
.
insert
(
rowPlan
);
QueryPlan
queryPlan
=
(
QueryPlan
)
processor
.
parseSQLToPhysicalPlan
(
"select
s1
from root.isp.d1.GPS"
);
(
QueryPlan
)
processor
.
parseSQLToPhysicalPlan
(
"select
*
from root.isp.d1.GPS"
);
QueryDataSet
dataSet
=
executor
.
processQuery
(
queryPlan
,
EnvironmentUtils
.
TEST_QUERY_CONTEXT
);
Assert
.
assertEquals
(
1
,
dataSet
.
getPaths
().
size
());
Assert
.
assertEquals
(
true
,
dataSet
.
hasNext
());
while
(
dataSet
.
hasNext
())
{
RowRecord
record
=
dataSet
.
next
();
Assert
.
assertEquals
(
3
,
record
.
getFields
().
size
());
...
...
@@ -288,7 +372,10 @@ public class InsertRowPlanTest {
}
private
InsertRowPlan
getInsertAlignedRowPlan
()
throws
IllegalPathException
{
long
time
=
110L
;
return
getInsertAlignedRowPlan
(
110L
);
}
private
InsertRowPlan
getInsertAlignedRowPlan
(
long
time
)
throws
IllegalPathException
{
TSDataType
[]
dataTypes
=
new
TSDataType
[]
{
TSDataType
.
DOUBLE
,
TSDataType
.
FLOAT
,
TSDataType
.
INT64
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录