Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
d8a7ea6b
I
Iotdb
项目概览
apache
/
Iotdb
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
d8a7ea6b
编写于
10月 18, 2019
作者:
S
SilverNarcissus
提交者:
Jialin Qiao
10月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IOTDB-240] fix unknown time series in where clause (#443)
* fix querying non-existing paths in where clause"
上级
da658d7b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
3 deletion
+47
-3
server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
+1
-2
server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
...e/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
+4
-1
server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
...a/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
+42
-0
未找到文件。
server/src/main/java/org/apache/iotdb/db/metadata/MTree.java
浏览文件 @
d8a7ea6b
...
@@ -512,8 +512,7 @@ public class MTree implements Serializable {
...
@@ -512,8 +512,7 @@ public class MTree implements Serializable {
MNode
cur
=
getRoot
();
MNode
cur
=
getRoot
();
for
(
int
i
=
1
;
i
<
nodes
.
length
;
i
++)
{
for
(
int
i
=
1
;
i
<
nodes
.
length
;
i
++)
{
if
(!
cur
.
hasChild
(
nodes
[
i
]))
{
if
(!
cur
.
hasChild
(
nodes
[
i
]))
{
throw
new
PathErrorException
(
throw
new
PathErrorException
(
"Path: \""
+
path
+
"\" doesn't correspond to any known time series"
);
String
.
format
(
NO_CHILD_ERROR
,
cur
.
getName
(),
nodes
[
i
]));
}
}
cur
=
cur
.
getChild
(
nodes
[
i
]);
cur
=
cur
.
getChild
(
nodes
[
i
]);
}
}
...
...
server/src/main/java/org/apache/iotdb/db/qp/strategy/optimizer/ConcatPathOptimizer.java
浏览文件 @
d8a7ea6b
...
@@ -276,6 +276,9 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
...
@@ -276,6 +276,9 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
for
(
Path
path
:
paths
)
{
for
(
Path
path
:
paths
)
{
List
<
String
>
all
;
List
<
String
>
all
;
all
=
executor
.
getAllPaths
(
path
.
getFullPath
());
all
=
executor
.
getAllPaths
(
path
.
getFullPath
());
if
(
all
.
isEmpty
()){
throw
new
LogicalOptimizeException
(
"Path: \""
+
path
+
"\" doesn't correspond to any known time series"
);
}
for
(
String
subPath
:
all
)
{
for
(
String
subPath
:
all
)
{
if
(!
pathMap
.
containsKey
(
subPath
))
{
if
(!
pathMap
.
containsKey
(
subPath
))
{
pathMap
.
put
(
subPath
,
1
);
pathMap
.
put
(
subPath
,
1
);
...
@@ -299,7 +302,7 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
...
@@ -299,7 +302,7 @@ public class ConcatPathOptimizer implements ILogicalOptimizer {
try
{
try
{
List
<
String
>
actualPaths
=
executor
.
getAllPaths
(
paths
.
get
(
i
).
getFullPath
());
List
<
String
>
actualPaths
=
executor
.
getAllPaths
(
paths
.
get
(
i
).
getFullPath
());
if
(
actualPaths
.
isEmpty
()){
if
(
actualPaths
.
isEmpty
()){
throw
new
LogicalOptimizeException
(
"Path: \""
+
paths
.
get
(
i
)
+
"\"
not corresponding
any known time series"
);
throw
new
LogicalOptimizeException
(
"Path: \""
+
paths
.
get
(
i
)
+
"\"
doesn't correspond to
any known time series"
);
}
}
for
(
String
actualPath
:
actualPaths
)
{
for
(
String
actualPath
:
actualPaths
)
{
retPaths
.
add
(
new
Path
(
actualPath
));
retPaths
.
add
(
new
Path
(
actualPath
));
...
...
server/src/test/java/org/apache/iotdb/db/integration/IoTDBMultiSeriesIT.java
浏览文件 @
d8a7ea6b
...
@@ -334,4 +334,46 @@ public class IoTDBMultiSeriesIT {
...
@@ -334,4 +334,46 @@ public class IoTDBMultiSeriesIT {
fail
(
e
.
getMessage
());
fail
(
e
.
getMessage
());
}
}
}
}
@Test
public
void
selectUnknownTimeSeries
()
throws
ClassNotFoundException
{
Class
.
forName
(
Config
.
JDBC_DRIVER_NAME
);
try
(
Connection
connection
=
DriverManager
.
getConnection
(
Config
.
IOTDB_URL_PREFIX
+
"127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"select s10 from root.vehicle.d0"
);
fail
(
"not throw exception when select unknown time series"
);
}
catch
(
SQLException
e
)
{
assertEquals
(
"Execute statement error: Path: \"root.vehicle.d0.s10\" doesn't correspond to any known time series"
,
e
.
getMessage
());
}
}
@Test
public
void
selectWhereUnknownTimeSeries
()
throws
ClassNotFoundException
{
Class
.
forName
(
Config
.
JDBC_DRIVER_NAME
);
try
(
Connection
connection
=
DriverManager
.
getConnection
(
Config
.
IOTDB_URL_PREFIX
+
"127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"select s1 from root.vehicle.d0 where s0 < 111 and s10 < 111"
);
fail
(
"not throw exception when unknown time series in where clause"
);
}
catch
(
SQLException
e
)
{
assertEquals
(
"Execute statement error: Path: \"root.vehicle.d0.s10\" doesn't correspond to any known time series"
,
e
.
getMessage
());
}
}
@Test
public
void
selectWhereUnknownTimeSeriesFromRoot
()
throws
ClassNotFoundException
{
Class
.
forName
(
Config
.
JDBC_DRIVER_NAME
);
try
(
Connection
connection
=
DriverManager
.
getConnection
(
Config
.
IOTDB_URL_PREFIX
+
"127.0.0.1:6667/"
,
"root"
,
"root"
);
Statement
statement
=
connection
.
createStatement
())
{
statement
.
execute
(
"select s1 from root.vehicle.d0 where root.vehicle.d0.s0 < 111 and root.vehicle.d0.s10 < 111"
);
fail
(
"not throw exception when unknown time series in where clause"
);
}
catch
(
SQLException
e
)
{
assertEquals
(
"Execute statement error: Path: \"root.vehicle.d0.s10\" doesn't correspond to any known time series"
,
e
.
getMessage
());
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录