Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,23 @@ private RestMessages() {}
// ---------------------------------------------------------------------------
public static final String EXCEPTION_UNSUPPORTED_DATA_TYPE_0521CEDE = "unsupported data type: ";

public static final String EXCEPTION_UNSUPPORTED_QUERY_DATA_TYPE_ARG_05BDDFBA =
"unsupported query data type: %s";

public static final String EXCEPTION_UNSUPPORTED_DATA_TYPE_ARG_3D7368DD =
"unsupported data type: %s";

public static final String EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE =
"This operation type is not supported";

public static final String EXCEPTION_ALL_INSERTED_DATA_IS_NULL_6B1A58B6 =
"All inserted data is null.";

public static final String EXCEPTION_THRIFT_SERVICE_IS_UNAVAILABLE_6DF40C0F =
"thrift service is unavailable";

public static final String EXCEPTION_ILLEGAL_FORMAT_OF_AUTHORIZATION_HEADER_D34F8A26 =
"Illegal format of authorization header.";

public static final String EXCEPTION_INVALID_TIME_ZONE_ARG_43D4C03A = "Invalid time zone: %s";
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,18 @@ private RestMessages() {}
// ---------------------------------------------------------------------------
public static final String EXCEPTION_UNSUPPORTED_DATA_TYPE_0521CEDE = "不支持的数据类型: ";

public static final String EXCEPTION_UNSUPPORTED_QUERY_DATA_TYPE_ARG_05BDDFBA = "不支持的查询数据类型:%s";

public static final String EXCEPTION_UNSUPPORTED_DATA_TYPE_ARG_3D7368DD = "不支持的数据类型:%s";

public static final String EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE = "不支持此操作类型";

public static final String EXCEPTION_ALL_INSERTED_DATA_IS_NULL_6B1A58B6 = "所有插入数据均为空。";

public static final String EXCEPTION_THRIFT_SERVICE_IS_UNAVAILABLE_6DF40C0F = "Thrift 服务不可用";

public static final String EXCEPTION_ILLEGAL_FORMAT_OF_AUTHORIZATION_HEADER_D34F8A26 =
"授权请求头格式无效。";

public static final String EXCEPTION_INVALID_TIME_ZONE_ARG_43D4C03A = "无效的时区:%s";
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.iotdb.db.conf.rest.IoTDBRestServiceDescriptor;
import org.apache.iotdb.db.protocol.session.RestClientSession;
import org.apache.iotdb.db.protocol.session.SessionManager;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.model.ExecutionStatus;
import org.apache.iotdb.rpc.TSStatusCode;

Expand All @@ -44,6 +45,7 @@
import java.time.DateTimeException;
import java.time.ZoneId;
import java.util.Base64;
import java.util.Objects;
import java.util.UUID;

@WebFilter("/*")
Expand Down Expand Up @@ -133,7 +135,8 @@ private User checkLogin(
.entity(
new ExecutionStatus()
.code(TSStatusCode.ILLEGAL_PARAMETER.getStatusCode())
.message("Illegal format of authorization header."))
.message(
RestMessages.EXCEPTION_ILLEGAL_FORMAT_OF_AUTHORIZATION_HEADER_D34F8A26))
.build();
containerRequestContext.abortWith(resp);
return null;
Expand Down Expand Up @@ -183,7 +186,10 @@ private ZoneId resolveTimeZone(ContainerRequestContext requestContext) {
.entity(
new ExecutionStatus()
.code(TSStatusCode.ILLEGAL_PARAMETER.getStatusCode())
.message("Invalid time zone: " + timeZoneHeader))
.message(
String.format(
RestMessages.EXCEPTION_INVALID_TIME_ZONE_ARG_43D4C03A,
Objects.toString(timeZoneHeader))))
.build();
requestContext.abortWith(resp);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.iotdb.commons.service.ThriftService;
import org.apache.iotdb.db.service.ExternalRPCService;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.PingApiService;
import org.apache.iotdb.rest.protocol.model.ExecutionStatus;
import org.apache.iotdb.rpc.TSStatusCode;
Expand All @@ -28,7 +29,8 @@

public class PingApiServiceImpl extends PingApiService {

private static final String UNAVAILABLE_SERVICE = "thrift service is unavailable";
private static final String UNAVAILABLE_SERVICE =
RestMessages.EXCEPTION_THRIFT_SERVICE_IS_UNAVAILABLE_6DF40C0F;

@Override
public Response tryPing(SecurityContext securityContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertTabletStatement;
import org.apache.iotdb.db.utils.CommonUtils;
import org.apache.iotdb.db.utils.SetThreadName;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.handler.QueryRowLimitUtils;
import org.apache.iotdb.rest.protocol.table.v1.NotFoundException;
import org.apache.iotdb.rest.protocol.table.v1.RestApiService;
Expand Down Expand Up @@ -302,7 +303,7 @@ private Response validateStatement(Statement statement, boolean userQuery) {
.entity(
new org.apache.iotdb.rest.protocol.model.ExecutionStatus()
.code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
.message("This operation type is not supported"))
.message(RestMessages.EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE))
.build();
}
boolean isQueryStmt = ExecuteStatementHandler.validateStatement(statement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.iotdb.rest.protocol.utils;

import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.NoValidValueException;

Expand Down Expand Up @@ -85,7 +86,8 @@ public class InsertRowDataUtils {
};
};

private static final String ALL_INSERT_DATA_IS_NULL = "All inserted data is null.";
private static final String ALL_INSERT_DATA_IS_NULL =
RestMessages.EXCEPTION_ALL_INSERTED_DATA_IS_NULL_6B1A58B6;

public static void filterNullValueAndMeasurement(
List<String> deviceIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.tsfile.utils.BitMap;

import java.nio.charset.StandardCharsets;
import java.util.Objects;

/** Type-specific column writers used by the REST insert handlers. */
public final class TypeServices {
Expand Down Expand Up @@ -144,7 +145,10 @@ private static Object writeBinaryColumn(
}

private static WriteProcessRejectException unsupportedValue(Object value) {
return new WriteProcessRejectException("unsupported data type: " + value.getClass());
return new WriteProcessRejectException(
String.format(
RestMessages.EXCEPTION_UNSUPPORTED_DATA_TYPE_ARG_3D7368DD,
Objects.toString(value.getClass())));
}

@FunctionalInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowLoadedModelsStatement;
import org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowModelsStatement;
import org.apache.iotdb.db.queryengine.plan.statement.sys.AuthorStatement;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.handler.QueryRowLimitUtils;
import org.apache.iotdb.rest.protocol.v1.model.ExecutionStatus;
import org.apache.iotdb.rpc.TSStatusCode;
Expand Down Expand Up @@ -77,7 +78,8 @@ public static Response fillQueryDataSet(
.code(TSStatusCode.QUERY_PROCESS_ERROR.getStatusCode())
.message(
String.format(
"unsupported query data type: %s", statement.getType().toString())))
RestMessages.EXCEPTION_UNSUPPORTED_QUERY_DATA_TYPE_ARG_05BDDFBA,
statement.getType().toString())))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.iotdb.db.queryengine.plan.statement.metadata.view.CreateTableViewStatement;
import org.apache.iotdb.db.utils.CommonUtils;
import org.apache.iotdb.db.utils.SetThreadName;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.handler.AuthorizationHandler;
import org.apache.iotdb.rest.protocol.handler.QueryRowLimitUtils;
import org.apache.iotdb.rest.protocol.utils.InsertTabletSortDataUtils;
Expand Down Expand Up @@ -98,7 +99,7 @@ public Response executeNonQueryStatement(SQL sql, SecurityContext securityContex
.entity(
new org.apache.iotdb.rest.protocol.model.ExecutionStatus()
.code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
.message("This operation type is not supported"))
.message(RestMessages.EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE))
.build();
}
if (!ExecuteStatementHandler.validateStatement(statement)) {
Expand Down Expand Up @@ -193,7 +194,7 @@ public Response executeQueryStatement(SQL sql, SecurityContext securityContext)
.entity(
new org.apache.iotdb.rest.protocol.model.ExecutionStatus()
.code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
.message("This operation type is not supported"))
.message(RestMessages.EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE))
.build();
}
if (ExecuteStatementHandler.validateStatement(statement)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowLoadedModelsStatement;
import org.apache.iotdb.db.queryengine.plan.statement.metadata.model.ShowModelsStatement;
import org.apache.iotdb.db.queryengine.plan.statement.sys.AuthorStatement;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.handler.QueryRowLimitUtils;
import org.apache.iotdb.rest.protocol.model.ExecutionStatus;
import org.apache.iotdb.rpc.TSStatusCode;
Expand Down Expand Up @@ -77,7 +78,8 @@ public static Response fillQueryDataSet(
.code(TSStatusCode.QUERY_PROCESS_ERROR.getStatusCode())
.message(
String.format(
"unsupported query data type: %s", statement.getType().toString())))
RestMessages.EXCEPTION_UNSUPPORTED_QUERY_DATA_TYPE_ARG_05BDDFBA,
statement.getType().toString())))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegion;
import org.apache.iotdb.db.utils.CommonUtils;
import org.apache.iotdb.db.utils.SetThreadName;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.handler.AuthorizationHandler;
import org.apache.iotdb.rest.protocol.handler.QueryRowLimitUtils;
import org.apache.iotdb.rest.protocol.model.ExecutionStatus;
Expand Down Expand Up @@ -255,7 +256,7 @@ public Response executeNonQueryStatement(SQL sql, SecurityContext securityContex
.entity(
new ExecutionStatus()
.code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
.message("This operation type is not supported"))
.message(RestMessages.EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE))
.build();
}
if (!ExecuteStatementHandler.validateStatement(statement)) {
Expand Down Expand Up @@ -324,7 +325,7 @@ public Response executeQueryStatement(SQL sql, SecurityContext securityContext)
.entity(
new ExecutionStatus()
.code(TSStatusCode.SQL_PARSE_ERROR.getStatusCode())
.message("This operation type is not supported"))
.message(RestMessages.EXCEPTION_THIS_OPERATION_TYPE_IS_NOT_SUPPORTED_DD44BACE))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ public final class PipeApiMessages {
public static final String EXCEPTION_ATTRIBUTE_ARG_IS_REQUIRED_BUT_WAS_NOT_PROVIDED_5A6C1F93 =
"Attribute \"%s\" is required but was not provided.";

public static final String
EXCEPTION_ERROR_OCCURRED_WHILE_CONNECTING_TO_RECEIVER_ARG_ARG_PLEASE_CHECK_NETWORK_CONNECTIVITY_OR_SSL_CONFIGURATIONS_WHEN_ENABLE_SSL_TRANSMISSION_5C0C2E01 =
"Error occurred while connecting to receiver %s:%s, please check network connectivity or"
+ " SSL configurations when enable SSL transmission";

private PipeApiMessages() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ public final class PipeApiMessages {
public static final String EXCEPTION_ATTRIBUTE_ARG_IS_REQUIRED_BUT_WAS_NOT_PROVIDED_5A6C1F93 =
"属性 \"%s\" 是必填的,但未提供。";

public static final String
EXCEPTION_ERROR_OCCURRED_WHILE_CONNECTING_TO_RECEIVER_ARG_ARG_PLEASE_CHECK_NETWORK_CONNECTIVITY_OR_SSL_CONFIGURATIONS_WHEN_ENABLE_SSL_TRANSMISSION_5C0C2E01 =
"连接接收端 %s:%s 时发生错误,请检查网络连接,启用 SSL 传输时还需检查 SSL 配置";

private PipeApiMessages() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@

package org.apache.iotdb.pipe.api.exception;

import org.apache.iotdb.pipe.api.i18n.PipeApiMessages;

public class PipeConnectionException extends PipeException {

public static final String CONNECTION_ERROR_FORMATTER =
"Error occurred while connecting to receiver %s:%s, please check network connectivity or SSL configurations when enable SSL transmission";
PipeApiMessages
.EXCEPTION_ERROR_OCCURRED_WHILE_CONNECTING_TO_RECEIVER_ARG_ARG_PLEASE_CHECK_NETWORK_CONNECTIVITY_OR_SSL_CONFIGURATIONS_WHEN_ENABLE_SSL_TRANSMISSION_5C0C2E01;

public PipeConnectionException(final String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,25 @@ public final class UdfApiMessages {
"the data type of the input series (index: %d) is not valid. expected: %s. actual: %s.";

private UdfApiMessages() {}

public static final String EXCEPTION_RETURNEDTYPE_IS_NULL_98FA07AD = "returnedType is null";

public static final String EXCEPTION_TABLEFUNCTIONHANDLE_IS_NULL_7A2E991C =
"TableFunctionHandle is null";

public static final String EXCEPTION_FIELDNAMES_IS_NULL_AD6E57B6 = "fieldNames is null";

public static final String EXCEPTION_FIELDTYPES_IS_NULL_08BA6A6B = "fieldTypes is null";

public static final String EXCEPTION_PARTITIONBY_IS_NULL_82C1E068 = "partitionBy is null";

public static final String EXCEPTION_ORDERBY_IS_NULL_26D8DCDD = "orderBy is null";

public static final String EXCEPTION_FIELDS_IS_NULL_04C032C9 = "fields is null";

public static final String EXCEPTION_SHOULD_BE_A_POSITIVE_VALUE_081C5357 =
"should be a positive value";

public static final String EXCEPTION_SHOULD_BE_A_NON_NEGATIVE_VALUE_D7F8F4F0 =
"should be a non-negative value";
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,23 @@ public final class UdfApiMessages {
"输入序列(索引:%d)的数据类型无效。期望:%s。实际:%s。";

private UdfApiMessages() {}

public static final String EXCEPTION_RETURNEDTYPE_IS_NULL_98FA07AD = "returnedType 为空";

public static final String EXCEPTION_TABLEFUNCTIONHANDLE_IS_NULL_7A2E991C =
"TableFunctionHandle 为空";

public static final String EXCEPTION_FIELDNAMES_IS_NULL_AD6E57B6 = "fieldNames 为空";

public static final String EXCEPTION_FIELDTYPES_IS_NULL_08BA6A6B = "fieldTypes 为空";

public static final String EXCEPTION_PARTITIONBY_IS_NULL_82C1E068 = "partitionBy 为空";

public static final String EXCEPTION_ORDERBY_IS_NULL_26D8DCDD = "orderBy 为空";

public static final String EXCEPTION_FIELDS_IS_NULL_04C032C9 = "fields 为空";

public static final String EXCEPTION_SHOULD_BE_A_POSITIVE_VALUE_081C5357 = "应为正数";

public static final String EXCEPTION_SHOULD_BE_A_NON_NEGATIVE_VALUE_D7F8F4F0 = "应为非负数";
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.udf.api.relational.table;

import org.apache.iotdb.udf.api.i18n.UdfApiMessages;
import org.apache.iotdb.udf.api.relational.table.argument.DescribedSchema;

import java.util.HashMap;
Expand Down Expand Up @@ -65,10 +66,12 @@ private TableFunctionAnalysis(
Map<String, List<Integer>> requiredColumns,
boolean requiredRecordSnapshot,
TableFunctionHandle handle) {
this.properColumnSchema = requireNonNull(properColumnSchema, "returnedType is null");
this.properColumnSchema =
requireNonNull(properColumnSchema, UdfApiMessages.EXCEPTION_RETURNEDTYPE_IS_NULL_98FA07AD);
this.requiredColumns = requiredColumns;
this.requireRecordSnapshot = requiredRecordSnapshot;
this.handle = requireNonNull(handle, "TableFunctionHandle is null");
this.handle =
requireNonNull(handle, UdfApiMessages.EXCEPTION_TABLEFUNCTIONHANDLE_IS_NULL_7A2E991C);
}

public Optional<DescribedSchema> getProperColumnSchema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class DescribedSchema {
private final List<Field> fields;

private DescribedSchema(List<Field> fields) {
requireNonNull(fields, "fields is null");
requireNonNull(fields, UdfApiMessages.EXCEPTION_FIELDS_IS_NULL_04C032C9);
if (fields.isEmpty()) {
throw new IllegalArgumentException(UdfApiMessages.DESCRIBED_SCHEMA_HAS_NO_FIELDS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package org.apache.iotdb.udf.api.relational.table.argument;

import org.apache.iotdb.udf.api.i18n.UdfApiMessages;

import java.util.function.Function;

public class ScalarArgumentChecker {
Expand All @@ -27,14 +29,14 @@ public class ScalarArgumentChecker {
if (value instanceof Long && (Long) value > 0) {
return null;
}
return "should be a positive value";
return UdfApiMessages.EXCEPTION_SHOULD_BE_A_POSITIVE_VALUE_081C5357;
};

public static Function<Object, String> NON_NEGATIVE_DOUBLE_CHECKER =
(value) -> {
if (value instanceof Double && (Double) value >= 0) {
return null;
}
return "should be a non-negative value";
return UdfApiMessages.EXCEPTION_SHOULD_BE_A_NON_NEGATIVE_VALUE_D7F8F4F0;
};
}
Loading
Loading