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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions core/src/main/java/com/scalar/db/common/CoreError.java
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,30 @@ public enum CoreError implements ScalarDbError {
"Db2 does not support renaming primary key or index key columns",
"",
""),
DYNAMO_IMPORT_NOT_SUPPORTED(
Category.USER_ERROR,
"0223",
"Import-related functionality is not supported in DynamoDB",
"",
""),
DYNAMO_PARTITION_KEY_BLOB_TYPE_NOT_SUPPORTED(
Category.USER_ERROR,
"0224",
"The BLOB type is supported only for the last column in the partition key in DynamoDB. Column: %s",
"",
""),
DYNAMO_CLUSTERING_KEY_BLOB_TYPE_NOT_SUPPORTED(
Category.USER_ERROR,
"0225",
"The BLOB type is not supported for clustering keys in DynamoDB. Column: %s",
"",
""),
DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED(
Category.USER_ERROR,
"0226",
"The BOOLEAN type is not supported for index columns in DynamoDB. Column: %s",
"",
""),

//
// Errors for the concurrency error category
Expand Down
29 changes: 10 additions & 19 deletions core/src/main/java/com/scalar/db/storage/dynamo/DynamoAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,24 +285,23 @@ private void checkMetadata(TableMetadata metadata) {
}
if (metadata.getColumnDataType(partitionKeyName) == DataType.BLOB) {
throw new IllegalArgumentException(
"BLOB type is supported only for the last column in partition key in DynamoDB: "
+ partitionKeyName);
CoreError.DYNAMO_PARTITION_KEY_BLOB_TYPE_NOT_SUPPORTED.buildMessage(partitionKeyName));
}
}

for (String clusteringKeyName : metadata.getClusteringKeyNames()) {
if (metadata.getColumnDataType(clusteringKeyName) == DataType.BLOB) {
throw new IllegalArgumentException(
"Currently, BLOB type is not supported for clustering keys in DynamoDB: "
+ clusteringKeyName);
CoreError.DYNAMO_CLUSTERING_KEY_BLOB_TYPE_NOT_SUPPORTED.buildMessage(
clusteringKeyName));
}
}

for (String secondaryIndexName : metadata.getSecondaryIndexNames()) {
if (metadata.getColumnDataType(secondaryIndexName) == DataType.BOOLEAN) {
throw new IllegalArgumentException(
"Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
+ secondaryIndexName);
CoreError.DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED.buildMessage(
secondaryIndexName));
}
}
}
Expand Down Expand Up @@ -814,16 +813,11 @@ public void createIndex(
throws ExecutionException {
Namespace namespace = Namespace.of(namespacePrefix, nonPrefixedNamespace);
TableMetadata metadata = getTableMetadata(nonPrefixedNamespace, table);

if (metadata == null) {
throw new IllegalArgumentException(
"Table " + getFullTableName(namespace, table) + " does not exist");
}
assert metadata != null;

if (metadata.getColumnDataType(columnName) == DataType.BOOLEAN) {
throw new IllegalArgumentException(
"Currently, BOOLEAN type is not supported for a secondary index in DynamoDB: "
+ columnName);
CoreError.DYNAMO_INDEX_COLUMN_BOOLEAN_TYPE_NOT_SUPPORTED.buildMessage(columnName));
}

long ru = Long.parseLong(options.getOrDefault(REQUEST_UNIT, DEFAULT_REQUEST_UNIT));
Expand Down Expand Up @@ -1259,15 +1253,13 @@ public void renameColumn(
@Override
public TableMetadata getImportTableMetadata(
String namespace, String table, Map<String, DataType> overrideColumnsType) {
throw new UnsupportedOperationException(
"Import-related functionality is not supported in DynamoDB");
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
}

@Override
public void addRawColumnToTable(
String namespace, String table, String columnName, DataType columnType) {
throw new UnsupportedOperationException(
"Import-related functionality is not supported in DynamoDB");
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
}

@Override
Expand All @@ -1276,8 +1268,7 @@ public void importTable(
String table,
Map<String, String> options,
Map<String, DataType> overrideColumnsType) {
throw new UnsupportedOperationException(
"Import-related functionality is not supported in DynamoDB");
throw new UnsupportedOperationException(CoreError.DYNAMO_IMPORT_NOT_SUPPORTED.buildMessage());
}

@Override
Expand Down