Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
072d15a8
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 搜索 >>
未验证
提交
072d15a8
编写于
6月 29, 2023
作者:
B
Beyyes
提交者:
GitHub
6月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix more corner cases to improve code coverage, fix sonar code smells
上级
dc68e6bc
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
326 addition
and
164 deletion
+326
-164
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AbstractFragInsStateTracker.java
...eryengine/plan/scheduler/AbstractFragInsStateTracker.java
+0
-4
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncSendPlanNodeHandler.java
.../queryengine/plan/scheduler/AsyncSendPlanNodeHandler.java
+1
-0
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/ClusterScheduler.java
...iotdb/db/queryengine/plan/scheduler/ClusterScheduler.java
+0
-14
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/FragmentInstanceDispatcherImpl.java
...engine/plan/scheduler/FragmentInstanceDispatcherImpl.java
+10
-6
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/IScheduler.java
...pache/iotdb/db/queryengine/plan/scheduler/IScheduler.java
+0
-6
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileDispatcherImpl.java
...yengine/plan/scheduler/load/LoadTsFileDispatcherImpl.java
+2
-0
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java
.../queryengine/plan/scheduler/load/LoadTsFileScheduler.java
+0
-11
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/QueryStatement.java
...db/db/queryengine/plan/statement/crud/QueryStatement.java
+0
-13
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java
...db/db/queryengine/plan/parser/StatementGeneratorTest.java
+25
-13
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/QueryStatementTest.java
...tdb/db/queryengine/plan/statement/QueryStatementTest.java
+3
-2
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/ErrorHandlingUtilsTest.java
...ava/org/apache/iotdb/db/utils/ErrorHandlingUtilsTest.java
+98
-0
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/NotImplementedException.java
...pache/iotdb/tsfile/exception/NotImplementedException.java
+0
-8
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/TsFileRuntimeException.java
...apache/iotdb/tsfile/exception/TsFileRuntimeException.java
+0
-12
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
...g/apache/iotdb/tsfile/exception/cache/CacheException.java
+0
-18
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/compress/CompressionTypeNotSupportedException.java
...eption/compress/CompressionTypeNotSupportedException.java
+0
-5
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
...db/tsfile/exception/encoding/TsFileDecodingException.java
+0
-13
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
...db/tsfile/exception/encoding/TsFileEncodingException.java
+0
-12
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/filter/QueryFilterOptimizationException.java
...le/exception/filter/QueryFilterOptimizationException.java
+0
-8
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/filter/UnSupportFilterDataTypeException.java
...le/exception/filter/UnSupportFilterDataTypeException.java
+0
-9
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/write/TsFileNotCompleteException.java
...db/tsfile/exception/write/TsFileNotCompleteException.java
+0
-10
iotdb-core/tsfile/src/test/java/org/apache/iotdb/tsfile/exception/TsFileExceptionTest.java
...rg/apache/iotdb/tsfile/exception/TsFileExceptionTest.java
+187
-0
未找到文件。
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AbstractFragInsStateTracker.java
浏览文件 @
072d15a8
...
...
@@ -65,10 +65,6 @@ public abstract class AbstractFragInsStateTracker implements IFragInstanceStateT
this
.
localhostInternalPort
=
IoTDBDescriptor
.
getInstance
().
getConfig
().
getInternalPort
();
}
public
abstract
void
start
();
public
abstract
void
abort
();
protected
FragmentInstanceInfo
fetchInstanceInfo
(
FragmentInstance
instance
)
throws
ClientManagerException
,
TException
{
TEndPoint
endPoint
=
instance
.
getHostDataNode
().
internalEndPoint
;
...
...
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/AsyncSendPlanNodeHandler.java
浏览文件 @
072d15a8
...
...
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package
org.apache.iotdb.db.queryengine.plan.scheduler
;
import
org.apache.iotdb.commons.service.metric.PerformanceOverviewMetrics
;
...
...
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/ClusterScheduler.java
浏览文件 @
072d15a8
...
...
@@ -23,9 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TSStatus;
import
org.apache.iotdb.commons.client.IClientManager
;
import
org.apache.iotdb.commons.client.async.AsyncDataNodeInternalServiceClient
;
import
org.apache.iotdb.commons.client.sync.SyncDataNodeInternalServiceClient
;
import
org.apache.iotdb.db.queryengine.common.FragmentInstanceId
;
import
org.apache.iotdb.db.queryengine.common.MPPQueryContext
;
import
org.apache.iotdb.db.queryengine.common.PlanFragmentId
;
import
org.apache.iotdb.db.queryengine.execution.QueryStateMachine
;
import
org.apache.iotdb.db.queryengine.execution.fragment.FragmentInfo
;
import
org.apache.iotdb.db.queryengine.metric.QueryExecutionMetricSet
;
...
...
@@ -177,16 +175,4 @@ public class ClusterScheduler implements IScheduler {
public
FragmentInfo
getFragmentInfo
()
{
return
null
;
}
@Override
public
void
abortFragmentInstance
(
FragmentInstanceId
instanceId
,
Throwable
failureCause
)
{}
@Override
public
void
cancelFragment
(
PlanFragmentId
planFragmentId
)
{}
// Send the instances to other nodes
private
void
sendFragmentInstances
()
{}
// After sending, start to collect the states of these fragment instances
private
void
startMonitorInstances
()
{}
}
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/FragmentInstanceDispatcherImpl.java
浏览文件 @
072d15a8
...
...
@@ -81,6 +81,10 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
private
static
final
PerformanceOverviewMetrics
PERFORMANCE_OVERVIEW_METRICS
=
PerformanceOverviewMetrics
.
getInstance
();
private
static
final
String
DISPATCH_FAILED
=
"[DispatchFailed]"
;
private
static
final
String
UNEXPECTED_ERRORS
=
"Unexpected errors: "
;
public
FragmentInstanceDispatcherImpl
(
QueryType
type
,
MPPQueryContext
queryContext
,
...
...
@@ -119,11 +123,11 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
}
catch
(
FragmentInstanceDispatchException
e
)
{
return
immediateFuture
(
new
FragInstanceDispatchResult
(
e
.
getFailureStatus
()));
}
catch
(
Throwable
t
)
{
logger
.
warn
(
"[DispatchFailed]"
,
t
);
logger
.
warn
(
DISPATCH_FAILED
,
t
);
return
immediateFuture
(
new
FragInstanceDispatchResult
(
RpcUtils
.
getStatus
(
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
"Unexpected errors: "
+
t
.
getMessage
())));
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
UNEXPECTED_ERRORS
+
t
.
getMessage
())));
}
finally
{
QUERY_EXECUTION_METRIC_SET
.
recordExecutionCost
(
DISPATCH_READ
,
System
.
nanoTime
()
-
startTime
);
...
...
@@ -149,10 +153,10 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
}
}
}
catch
(
Throwable
t
)
{
logger
.
warn
(
"[DispatchFailed]"
,
t
);
logger
.
warn
(
DISPATCH_FAILED
,
t
);
failureStatusList
.
add
(
RpcUtils
.
getStatus
(
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
"Unexpected errors: "
+
t
.
getMessage
()));
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
UNEXPECTED_ERRORS
+
t
.
getMessage
()));
}
}
if
(
failureStatusList
.
isEmpty
())
{
...
...
@@ -194,10 +198,10 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
}
catch
(
FragmentInstanceDispatchException
e
)
{
dataNodeFailureList
.
add
(
e
.
getFailureStatus
());
}
catch
(
Throwable
t
)
{
logger
.
warn
(
"[DispatchFailed]"
,
t
);
logger
.
warn
(
DISPATCH_FAILED
,
t
);
dataNodeFailureList
.
add
(
RpcUtils
.
getStatus
(
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
"Unexpected errors: "
+
t
.
getMessage
()));
TSStatusCode
.
INTERNAL_SERVER_ERROR
,
UNEXPECTED_ERRORS
+
t
.
getMessage
()));
}
}
PERFORMANCE_OVERVIEW_METRICS
.
recordScheduleLocalCost
(
...
...
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/IScheduler.java
浏览文件 @
072d15a8
...
...
@@ -18,8 +18,6 @@
*/
package
org.apache.iotdb.db.queryengine.plan.scheduler
;
import
org.apache.iotdb.db.queryengine.common.FragmentInstanceId
;
import
org.apache.iotdb.db.queryengine.common.PlanFragmentId
;
import
org.apache.iotdb.db.queryengine.execution.fragment.FragmentInfo
;
import
io.airlift.units.Duration
;
...
...
@@ -33,8 +31,4 @@ public interface IScheduler {
Duration
getTotalCpuTime
();
FragmentInfo
getFragmentInfo
();
void
abortFragmentInstance
(
FragmentInstanceId
instanceId
,
Throwable
failureCause
);
void
cancelFragment
(
PlanFragmentId
planFragmentId
);
}
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileDispatcherImpl.java
浏览文件 @
072d15a8
...
...
@@ -69,6 +69,8 @@ public class LoadTsFileDispatcherImpl implements IFragInstanceDispatcher {
internalServiceClientManager
;
private
final
ExecutorService
executor
;
private
static
final
String
NODE_CONNECTION_ERROR
=
"can't connect to node {}"
;
public
LoadTsFileDispatcherImpl
(
IClientManager
<
TEndPoint
,
SyncDataNodeInternalServiceClient
>
internalServiceClientManager
)
{
this
.
internalServiceClientManager
=
internalServiceClientManager
;
...
...
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java
浏览文件 @
072d15a8
...
...
@@ -32,7 +32,6 @@ import org.apache.iotdb.commons.partition.StorageExecutor;
import
org.apache.iotdb.db.conf.IoTDBConfig
;
import
org.apache.iotdb.db.conf.IoTDBDescriptor
;
import
org.apache.iotdb.db.exception.mpp.FragmentInstanceDispatchException
;
import
org.apache.iotdb.db.queryengine.common.FragmentInstanceId
;
import
org.apache.iotdb.db.queryengine.common.MPPQueryContext
;
import
org.apache.iotdb.db.queryengine.common.PlanFragmentId
;
import
org.apache.iotdb.db.queryengine.execution.QueryStateMachine
;
...
...
@@ -354,16 +353,6 @@ public class LoadTsFileScheduler implements IScheduler {
return
null
;
}
@Override
public
void
abortFragmentInstance
(
FragmentInstanceId
instanceId
,
Throwable
failureCause
)
{
// Do nothing
}
@Override
public
void
cancelFragment
(
PlanFragmentId
planFragmentId
)
{
// Do nothing
}
public
enum
LoadCommand
{
EXECUTE
,
ROLLBACK
...
...
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/QueryStatement.java
浏览文件 @
072d15a8
...
...
@@ -333,10 +333,6 @@ public class QueryStatement extends Statement {
return
resultSetFormat
==
ResultSetFormat
.
ALIGN_BY_DEVICE
;
}
public
boolean
disableAlign
()
{
return
resultSetFormat
==
ResultSetFormat
.
DISABLE_ALIGN
;
}
public
boolean
isOrderByTime
()
{
return
orderByComponent
!=
null
&&
orderByComponent
.
isOrderByTime
();
}
...
...
@@ -474,9 +470,6 @@ public class QueryStatement extends Statement {
public
void
semanticCheck
()
{
if
(
isAggregationQuery
())
{
if
(
disableAlign
())
{
throw
new
SemanticException
(
"AGGREGATION doesn't support disable align clause."
);
}
if
(
groupByComponent
!=
null
&&
isGroupByLevel
())
{
throw
new
SemanticException
(
"GROUP BY CLAUSES doesn't support GROUP BY LEVEL now."
);
}
...
...
@@ -600,9 +593,6 @@ public class QueryStatement extends Statement {
if
(
isAlignByDevice
())
{
throw
new
SemanticException
(
"Last query doesn't support align by device."
);
}
if
(
disableAlign
())
{
throw
new
SemanticException
(
"Disable align cannot be applied to LAST query."
);
}
for
(
ResultColumn
resultColumn
:
selectComponent
.
getResultColumns
())
{
Expression
expression
=
resultColumn
.
getExpression
();
if
(!(
expression
instanceof
TimeSeriesOperand
))
{
...
...
@@ -635,9 +625,6 @@ public class QueryStatement extends Statement {
if
(
getSeriesOffset
()
>
0
)
{
throw
new
SemanticException
(
"select into: soffset clauses are not supported."
);
}
if
(
disableAlign
())
{
throw
new
SemanticException
(
"select into: disable align clauses are not supported."
);
}
if
(
isLastQuery
())
{
throw
new
SemanticException
(
"select into: last clauses are not supported."
);
}
...
...
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/StatementGeneratorTest.java
浏览文件 @
072d15a8
...
...
@@ -32,28 +32,35 @@ import java.util.Arrays;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
StatementGeneratorTest
{
@Test
public
void
testRawDataQuery
()
{
List
<
String
>
selectExprList
=
Arrays
.
asList
(
"s1"
,
"s2"
);
List
<
String
>
prefixPaths
=
Collections
.
singletonList
(
"root.sg1.d1"
);
public
void
rawDataQueryTest
()
{
String
sql
=
"SELECT s1, s2 FROM root.sg1.d1 WHERE time > 1 and s3 > 2 LIMIT 10 OFFSET 11"
;
checkQueryStatement
(
"SELECT s1, s2 FROM root.sg1.d1 LIMIT 10 OFFSET 10"
,
selectExprList
,
prefixPaths
,
10
,
10
);
sql
,
Arrays
.
asList
(
"s1"
,
"s2"
),
Collections
.
singletonList
(
"root.sg1.d1"
),
"Time > 1 & s3 > 2"
,
10
,
11
);
}
@Test
public
void
testGroupByTagWithDuplicatedKeys
()
{
public
void
groupByTagWithDuplicatedKeysTest
()
{
try
{
checkQueryStatement
(
"SELECT avg(*) FROM root.sg.** GROUP BY TAGS(k1, k2, k1)"
,
Collections
.
emptyList
(),
Collections
.
emptyList
(),
""
,
10
,
10
);
Assert
.
fail
();
}
catch
(
SemanticException
e
)
{
Assert
.
assertEquals
(
"duplicated key in GROUP BY TAGS: k1"
,
e
.
getMessage
());
assertEquals
(
"duplicated key in GROUP BY TAGS: k1"
,
e
.
getMessage
());
}
}
...
...
@@ -62,7 +69,8 @@ public class StatementGeneratorTest {
private
void
checkQueryStatement
(
String
sql
,
List
<
String
>
selectExprList
,
List
<
String
>
prefixPaths
,
List
<
String
>
fromPrefixPaths
,
String
wherePredicateString
,
int
rowLimit
,
int
rowOffset
)
{
QueryStatement
statement
=
...
...
@@ -72,20 +80,24 @@ public class StatementGeneratorTest {
int
cnt
=
0
;
for
(
ResultColumn
resultColumn
:
statement
.
getSelectComponent
().
getResultColumns
())
{
String
selectExpr
=
resultColumn
.
getExpression
().
toString
();
Assert
.
assertEquals
(
selectExprList
.
get
(
cnt
++),
selectExpr
);
assertEquals
(
selectExprList
.
get
(
cnt
++),
selectExpr
);
}
Assert
.
assertEquals
(
selectExprList
.
size
(),
cnt
);
assertEquals
(
selectExprList
.
size
(),
statement
.
getSelectComponent
().
getResultColumns
().
size
()
);
// check FROM clause
cnt
=
0
;
for
(
PartialPath
path
:
statement
.
getFromComponent
().
getPrefixPaths
())
{
Assert
.
assertEquals
(
p
refixPaths
.
get
(
cnt
++),
path
.
toString
());
assertEquals
(
fromP
refixPaths
.
get
(
cnt
++),
path
.
toString
());
}
Assert
.
assertEquals
(
prefixPaths
.
size
(),
cnt
);
assertEquals
(
fromPrefixPaths
.
size
(),
statement
.
getFromComponent
().
getPrefixPaths
().
size
());
// check WHERE clause
assertEquals
(
wherePredicateString
,
statement
.
getWhereCondition
().
getPredicate
().
getExpressionString
());
// check LIMIT & OFFSET clause
Assert
.
assertEquals
(
rowLimit
,
statement
.
getRowLimit
());
Assert
.
assertEquals
(
rowOffset
,
statement
.
getRowOffset
());
assertEquals
(
rowLimit
,
statement
.
getRowLimit
());
assertEquals
(
rowOffset
,
statement
.
getRowOffset
());
// TODO: add more clause
}
...
...
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/QueryStatementTest.java
浏览文件 @
072d15a8
...
...
@@ -135,10 +135,11 @@ public class QueryStatementTest {
checkErrorQuerySql
(
errorSql
);
}
catch
(
SemanticException
e
)
{
assertEquals
(
errorMsg
,
e
.
getMessage
());
continue
;
}
catch
(
Exception
ex
)
{
logger
.
error
(
"Meets error in test sql: {}"
,
errorSql
,
ex
);
fail
();
fail
(
String
.
format
(
"Meets exception %s in test sql: `%s`"
,
errorMsg
,
errorSql
));
}
fail
(
String
.
format
(
"Sql: `%s` must throw exception: %s"
,
errorSql
,
errorMsg
));
}
}
...
...
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/ErrorHandlingUtilsTest.java
0 → 100644
浏览文件 @
072d15a8
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package
org.apache.iotdb.db.utils
;
import
org.apache.iotdb.common.rpc.thrift.TSStatus
;
import
org.apache.iotdb.db.exception.StorageGroupNotReadyException
;
import
org.apache.iotdb.db.exception.metadata.PathNotExistException
;
import
org.apache.iotdb.db.exception.query.QueryProcessException
;
import
org.apache.iotdb.db.exception.sql.SemanticException
;
import
org.apache.iotdb.db.protocol.thrift.OperationType
;
import
org.apache.iotdb.rpc.TSStatusCode
;
import
org.junit.Test
;
import
java.io.IOException
;
import
static
org
.
apache
.
iotdb
.
db
.
utils
.
ErrorHandlingUtils
.
onIoTDBException
;
import
static
org
.
apache
.
iotdb
.
db
.
utils
.
ErrorHandlingUtils
.
onNonQueryException
;
import
static
org
.
apache
.
iotdb
.
db
.
utils
.
ErrorHandlingUtils
.
onNpeOrUnexpectedException
;
import
static
org
.
apache
.
iotdb
.
db
.
utils
.
ErrorHandlingUtils
.
onQueryException
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
public
class
ErrorHandlingUtilsTest
{
@Test
public
void
onNpeOrUnexpectedExceptionTest
()
{
TSStatus
status
=
onNpeOrUnexpectedException
(
new
IOException
(
"test-IOException"
),
OperationType
.
EXECUTE_STATEMENT
,
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
);
assertEquals
(
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
.
getStatusCode
(),
status
.
getCode
());
status
=
onNpeOrUnexpectedException
(
new
NullPointerException
(
"test-NullPointerException"
),
OperationType
.
EXECUTE_STATEMENT
,
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
);
assertEquals
(
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
.
getStatusCode
(),
status
.
getCode
());
status
=
onNpeOrUnexpectedException
(
new
RuntimeException
(
"test-RuntimeException"
),
OperationType
.
EXECUTE_STATEMENT
,
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
);
assertEquals
(
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
.
getStatusCode
(),
status
.
getCode
());
}
@Test
public
void
onQueryExceptionTest
()
{
TSStatus
status
=
onQueryException
(
new
StorageGroupNotReadyException
(
"test-StorageGroupNotReadyException"
,
0
),
OperationType
.
EXECUTE_STATEMENT
);
assertEquals
(
TSStatusCode
.
STORAGE_ENGINE_NOT_READY
.
getStatusCode
(),
status
.
getCode
());
status
=
onQueryException
(
new
SemanticException
(
"test-SemanticException"
),
OperationType
.
EXECUTE_STATEMENT
);
assertEquals
(
TSStatusCode
.
SEMANTIC_ERROR
.
getStatusCode
(),
status
.
getCode
());
}
@Test
public
void
onNonQueryExceptionTest
()
{
TSStatus
status
=
onNonQueryException
(
new
PathNotExistException
(
"test-PathNotExistException"
),
OperationType
.
EXECUTE_STATEMENT
);
assertEquals
(
TSStatusCode
.
PATH_NOT_EXIST
.
getStatusCode
(),
status
.
getCode
());
}
@Test
public
void
onIoTDBExceptionTest
()
{
TSStatus
status
=
onIoTDBException
(
new
QueryProcessException
(
"test-QueryProcessException"
),
OperationType
.
EXECUTE_STATEMENT
,
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
.
getStatusCode
());
assertEquals
(
TSStatusCode
.
EXECUTE_STATEMENT_ERROR
.
getStatusCode
(),
status
.
getCode
());
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/NotImplementedException.java
浏览文件 @
072d15a8
...
...
@@ -27,15 +27,7 @@ public class NotImplementedException extends RuntimeException {
super
();
}
public
NotImplementedException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
NotImplementedException
(
String
message
)
{
super
(
message
);
}
public
NotImplementedException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/TsFileRuntimeException.java
浏览文件 @
072d15a8
...
...
@@ -27,19 +27,7 @@ public class TsFileRuntimeException extends RuntimeException {
private
static
final
long
serialVersionUID
=
6455048223316780984L
;
public
TsFileRuntimeException
()
{
super
();
}
public
TsFileRuntimeException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
TsFileRuntimeException
(
String
message
)
{
super
(
message
);
}
public
TsFileRuntimeException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/cache/CacheException.java
浏览文件 @
072d15a8
...
...
@@ -20,25 +20,7 @@
package
org.apache.iotdb.tsfile.exception.cache
;
public
class
CacheException
extends
Exception
{
public
CacheException
()
{
// do nothing
}
public
CacheException
(
String
message
)
{
super
(
message
);
}
public
CacheException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
CacheException
(
Throwable
cause
)
{
super
(
cause
);
}
public
CacheException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/compress/CompressionTypeNotSupportedException.java
浏览文件 @
072d15a8
...
...
@@ -28,11 +28,6 @@ public class CompressionTypeNotSupportedException extends RuntimeException {
private
static
final
long
serialVersionUID
=
-
2244072267816916609L
;
private
final
Class
<?>
codecClass
;
public
CompressionTypeNotSupportedException
(
Class
<?>
codecClass
)
{
super
(
"codec not supported: "
+
codecClass
.
getName
());
this
.
codecClass
=
codecClass
;
}
public
CompressionTypeNotSupportedException
(
String
codecType
)
{
super
(
"codec not supported: "
+
codecType
);
this
.
codecClass
=
null
;
...
...
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileDecodingException.java
浏览文件 @
072d15a8
...
...
@@ -26,22 +26,9 @@ import org.apache.iotdb.tsfile.exception.TsFileRuntimeException;
* This Exception extends super class {@link TsFileRuntimeException}
*/
public
class
TsFileDecodingException
extends
TsFileRuntimeException
{
private
static
final
long
serialVersionUID
=
-
8632392900655017028L
;
public
TsFileDecodingException
()
{
// do nothing
}
public
TsFileDecodingException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
TsFileDecodingException
(
String
message
)
{
super
(
message
);
}
public
TsFileDecodingException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/encoding/TsFileEncodingException.java
浏览文件 @
072d15a8
...
...
@@ -29,19 +29,7 @@ public class TsFileEncodingException extends TsFileRuntimeException {
private
static
final
long
serialVersionUID
=
-
7225811149696714845L
;
public
TsFileEncodingException
()
{
// do nothing
}
public
TsFileEncodingException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
TsFileEncodingException
(
String
message
)
{
super
(
message
);
}
public
TsFileEncodingException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/filter/QueryFilterOptimizationException.java
浏览文件 @
072d15a8
...
...
@@ -24,12 +24,4 @@ public class QueryFilterOptimizationException extends Exception {
public
QueryFilterOptimizationException
(
String
msg
)
{
super
(
msg
);
}
public
QueryFilterOptimizationException
(
Throwable
cause
)
{
super
(
cause
);
}
public
QueryFilterOptimizationException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/filter/UnSupportFilterDataTypeException.java
浏览文件 @
072d15a8
...
...
@@ -21,16 +21,7 @@ package org.apache.iotdb.tsfile.exception.filter;
/** Some wrong filter parameters invoke. */
public
class
UnSupportFilterDataTypeException
extends
RuntimeException
{
public
UnSupportFilterDataTypeException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
UnSupportFilterDataTypeException
(
String
message
)
{
super
(
message
);
}
public
UnSupportFilterDataTypeException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/main/java/org/apache/iotdb/tsfile/exception/write/TsFileNotCompleteException.java
浏览文件 @
072d15a8
...
...
@@ -23,17 +23,7 @@ import java.io.IOException;
public
class
TsFileNotCompleteException
extends
IOException
{
public
TsFileNotCompleteException
()
{}
public
TsFileNotCompleteException
(
String
message
)
{
super
(
message
);
}
public
TsFileNotCompleteException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
TsFileNotCompleteException
(
Throwable
cause
)
{
super
(
cause
);
}
}
iotdb-core/tsfile/src/test/java/org/apache/iotdb/tsfile/exception/TsFileExceptionTest.java
0 → 100644
浏览文件 @
072d15a8
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package
org.apache.iotdb.tsfile.exception
;
import
org.apache.iotdb.tsfile.exception.cache.CacheException
;
import
org.apache.iotdb.tsfile.exception.compress.CompressionTypeNotSupportedException
;
import
org.apache.iotdb.tsfile.exception.compress.GZIPCompressOverflowException
;
import
org.apache.iotdb.tsfile.exception.encoding.TsFileDecodingException
;
import
org.apache.iotdb.tsfile.exception.encoding.TsFileEncodingException
;
import
org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException
;
import
org.apache.iotdb.tsfile.exception.filter.StatisticsClassException
;
import
org.apache.iotdb.tsfile.exception.filter.UnSupportFilterDataTypeException
;
import
org.apache.iotdb.tsfile.exception.write.NoMeasurementException
;
import
org.apache.iotdb.tsfile.exception.write.PageException
;
import
org.apache.iotdb.tsfile.exception.write.TsFileNotCompleteException
;
import
org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException
;
import
org.apache.iotdb.tsfile.exception.write.UnknownColumnTypeException
;
import
org.apache.iotdb.tsfile.exception.write.WriteProcessException
;
import
org.junit.Test
;
import
java.io.IOException
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
public
class
TsFileExceptionTest
{
private
static
final
String
MOCK
=
"mock"
;
@Test
public
void
testNotCompatibleTsFileException
()
{
NotCompatibleTsFileException
e
=
new
NotCompatibleTsFileException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testNotImplementedException
()
{
NotImplementedException
e
=
new
NotImplementedException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
e
=
new
NotImplementedException
();
assertNull
(
e
.
getMessage
());
}
@Test
public
void
testNullFieldException
()
{
NullFieldException
e
=
new
NullFieldException
();
assertEquals
(
"Field is null"
,
e
.
getMessage
());
}
@Test
public
void
testPathParseException
()
{
PathParseException
e
=
new
PathParseException
(
MOCK
);
assertEquals
(
"mock is not a legal path."
,
e
.
getMessage
());
}
@Test
public
void
testTsFileRuntimeException
()
{
TsFileRuntimeException
e
=
new
TsFileRuntimeException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testTsFileStatisticsMistakesException
()
{
TsFileStatisticsMistakesException
e
=
new
TsFileStatisticsMistakesException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
// test for cache exception
@Test
public
void
testCacheException
()
{
CacheException
e
=
new
CacheException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
// test for compress exception
@Test
public
void
testCompressionTypeNotSupportedException
()
{
CompressionTypeNotSupportedException
e
=
new
CompressionTypeNotSupportedException
(
MOCK
);
assertEquals
(
"codec not supported: "
+
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testGZIPCompressOverflowException
()
{
GZIPCompressOverflowException
e
=
new
GZIPCompressOverflowException
();
assertEquals
(
"compressed data is larger than the given byte container."
,
e
.
getMessage
());
}
// test for encoding exception
@Test
public
void
testTsFileDecodingException
()
{
TsFileDecodingException
e
=
new
TsFileDecodingException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testTsFileEncodingException
()
{
TsFileEncodingException
e
=
new
TsFileEncodingException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
// test for filter exception
@Test
public
void
testQueryFilterOptimizationException
()
{
QueryFilterOptimizationException
e
=
new
QueryFilterOptimizationException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testStatisticsClassException
()
{
StatisticsClassException
e
=
new
StatisticsClassException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testUnSupportFilterDataTypeException
()
{
UnSupportFilterDataTypeException
e
=
new
UnSupportFilterDataTypeException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
// test for write exception
@Test
public
void
testNoMeasurementException
()
{
NoMeasurementException
e
=
new
NoMeasurementException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testPageException
()
{
PageException
e
=
new
PageException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
e
=
new
PageException
(
MOCK
,
new
IOException
());
assertEquals
(
MOCK
,
e
.
getMessage
());
e
=
new
PageException
(
new
IOException
());
assertEquals
(
"java.io.IOException"
,
e
.
getMessage
());
}
@Test
public
void
testTsFileNotCompleteException
()
{
TsFileNotCompleteException
e
=
new
TsFileNotCompleteException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testUnknownColumnTypeException
()
{
UnknownColumnTypeException
e
=
new
UnknownColumnTypeException
(
MOCK
);
assertEquals
(
"Column type not found: "
+
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testUnSupportedDataTypeException
()
{
UnSupportedDataTypeException
e
=
new
UnSupportedDataTypeException
(
MOCK
);
assertEquals
(
"Unsupported dataType: "
+
MOCK
,
e
.
getMessage
());
}
@Test
public
void
testWriteProcessException
()
{
WriteProcessException
e
=
new
WriteProcessException
(
MOCK
);
assertEquals
(
MOCK
,
e
.
getMessage
());
e
=
new
WriteProcessException
(
MOCK
,
new
IOException
());
assertEquals
(
MOCK
,
e
.
getMessage
());
e
=
new
WriteProcessException
(
new
IOException
());
assertEquals
(
"java.io.IOException"
,
e
.
getMessage
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录