Skip to content

Commit 683f011

Browse files
committed
Change default mapping for BLOB column for Db2 from "VARBINARY(32672)" to "BLOB(2G)" [skip ci]
1 parent 2f021d4 commit 683f011

19 files changed

+325
-92
lines changed

core/src/integration-test/java/com/scalar/db/storage/jdbc/ConsensusCommitAdminIntegrationTestWithJdbcDatabase.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2222
}
2323

2424
@Override
25-
protected boolean isCreateIndexOnTextAndBlobColumnsEnabled() {
26-
// "admin.createIndex()" for TEXT and BLOB columns fails (the "create index" query runs
25+
protected boolean isCreateIndexOnTextColumnEnabled() {
26+
// "admin.createIndex()" for TEXT column fails (the "create index" query runs
2727
// indefinitely) on the Db2 community edition docker version which we use for the CI.
2828
// However, the index creation is successful on Db2 hosted on IBM Cloud.
2929
// So we disable these tests until the issue with the Db2 community edition is resolved.
3030
return !JdbcTestUtils.isDb2(rdbEngine);
3131
}
32+
33+
@Override
34+
protected boolean isIndexOnBlobColumnSupported() {
35+
return !JdbcTestUtils.isDb2(rdbEngine);
36+
}
3237
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminCaseSensitivityIntegrationTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2222
}
2323

2424
@Override
25-
protected boolean isCreateIndexOnTextAndBlobColumnsEnabled() {
26-
// "admin.createIndex()" for TEXT and BLOB columns fails (the "create index" query runs
25+
protected boolean isCreateIndexOnTextColumnEnabled() {
26+
// "admin.createIndex()" for TEXT column fails (the "create index" query runs
2727
// indefinitely) on Db2 community edition version but works on Db2 hosted on IBM Cloud.
2828
// So we disable these tests until the issue is resolved.
2929
return !JdbcTestUtils.isDb2(rdbEngine);
3030
}
31+
32+
@Override
33+
protected boolean isIndexOnBlobColumnSupported() {
34+
return !JdbcTestUtils.isDb2(rdbEngine);
35+
}
3136
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminIntegrationTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2121
}
2222

2323
@Override
24-
protected boolean isCreateIndexOnTextAndBlobColumnsEnabled() {
25-
// "admin.createIndex()" for TEXT and BLOB columns fails (the "create index" query runs
24+
protected boolean isCreateIndexOnTextColumnEnabled() {
25+
// "admin.createIndex()" for TEXT columns fails (the "create index" query runs
2626
// indefinitely) on Db2 community edition version but works on Db2 hosted on IBM Cloud.
2727
// So we disable these tests until the issue is resolved.
2828
return !JdbcTestUtils.isDb2(rdbEngine);
2929
}
30+
31+
@Override
32+
protected boolean isIndexOnBlobColumnSupported() {
33+
return !JdbcTestUtils.isDb2(rdbEngine);
34+
}
3035
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseCrossPartitionScanIntegrationTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,9 @@ protected Stream<Arguments> provideColumnsForCNFConditionsTest() {
8080
}
8181
return Stream.of(Arguments.of(allColumnNames));
8282
}
83+
84+
@Override
85+
protected boolean isOrderingOnBlobColumnSupported() {
86+
return !JdbcTestUtils.isDb2(rdbEngine);
87+
}
8388
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseMultipleClusteringKeyScanIntegrationTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType)
9494
@Override
9595
protected List<DataType> getDataTypes() {
9696
// TIMESTAMP WITH TIME ZONE type cannot be used as a primary key in Oracle
97+
// BLOB type cannot be used as a clustering key in Db2
9798
return JdbcTestUtils.filterDataTypes(
9899
super.getDataTypes(),
99100
rdbEngine,
100-
ImmutableMap.of(RdbEngineOracle.class, ImmutableList.of(DataType.TIMESTAMPTZ)));
101+
ImmutableMap.of(
102+
RdbEngineOracle.class,
103+
ImmutableList.of(DataType.TIMESTAMPTZ),
104+
RdbEngineDb2.class,
105+
ImmutableList.of(DataType.BLOB)));
101106
}
102107
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseMultiplePartitionKeyIntegrationTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,16 @@ protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType)
8888
protected List<DataType> getDataTypes() {
8989
// TIMESTAMP WITH TIME ZONE type cannot be used as a primary key in Oracle
9090
// FLOAT and DOUBLE types cannot be used as partition key in Yugabyte
91+
// BLOB type cannot be used as a partition key in Db2
9192
return JdbcTestUtils.filterDataTypes(
9293
super.getDataTypes(),
9394
rdbEngine,
9495
ImmutableMap.of(
9596
RdbEngineOracle.class,
9697
ImmutableList.of(DataType.TIMESTAMPTZ),
9798
RdbEngineYugabyte.class,
98-
ImmutableList.of(DataType.FLOAT, DataType.DOUBLE)));
99+
ImmutableList.of(DataType.FLOAT, DataType.DOUBLE),
100+
RdbEngineDb2.class,
101+
ImmutableList.of(DataType.BLOB)));
99102
}
100103
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseSecondaryIndexIntegrationTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package com.scalar.db.storage.jdbc;
22

3+
import com.google.common.collect.ImmutableList;
4+
import com.google.common.collect.ImmutableMap;
5+
import com.google.common.collect.Sets;
36
import com.scalar.db.api.DistributedStorageSecondaryIndexIntegrationTestBase;
47
import com.scalar.db.config.DatabaseConfig;
58
import com.scalar.db.io.Column;
69
import com.scalar.db.io.DataType;
710
import com.scalar.db.util.TestUtils;
11+
import java.util.Arrays;
812
import java.util.Properties;
913
import java.util.Random;
14+
import java.util.Set;
1015

1116
public class JdbcDatabaseSecondaryIndexIntegrationTest
1217
extends DistributedStorageSecondaryIndexIntegrationTestBase {
@@ -68,4 +73,14 @@ protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType)
6873
}
6974
return super.getColumnWithMaxValue(columnName, dataType);
7075
}
76+
77+
@Override
78+
protected Set<DataType> getSecondaryIndexTypes() {
79+
// BLOB type cannot be used as a secondary index in Db2
80+
return Sets.newHashSet(
81+
JdbcTestUtils.filterDataTypes(
82+
Arrays.asList(DataType.values()),
83+
rdbEngine,
84+
ImmutableMap.of(RdbEngineDb2.class, ImmutableList.of(DataType.BLOB))));
85+
}
7186
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseSingleClusteringKeyScanIntegrationTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType)
7070
@Override
7171
protected List<DataType> getClusteringKeyTypes() {
7272
// TIMESTAMP WITH TIME ZONE type cannot be used as a primary key in Oracle
73+
// BLOB type cannot be used as a clustering key in Db2
7374
return JdbcTestUtils.filterDataTypes(
7475
super.getClusteringKeyTypes(),
7576
rdbEngine,
76-
ImmutableMap.of(RdbEngineOracle.class, ImmutableList.of(DataType.TIMESTAMPTZ)));
77+
ImmutableMap.of(
78+
RdbEngineOracle.class,
79+
ImmutableList.of(DataType.TIMESTAMPTZ),
80+
RdbEngineDb2.class,
81+
ImmutableList.of(DataType.BLOB)));
7782
}
7883
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcDatabaseSinglePartitionKeyIntegrationTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,16 @@ protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType)
7171
protected List<DataType> getPartitionKeyTypes() {
7272
// TIMESTAMP WITH TIME ZONE type cannot be used as a primary key in Oracle
7373
// FLOAT and DOUBLE types cannot be used as partition key in Yugabyte
74+
// BLOB type cannot be used as a partition key in Db2
7475
return JdbcTestUtils.filterDataTypes(
7576
super.getPartitionKeyTypes(),
7677
rdbEngine,
7778
ImmutableMap.of(
7879
RdbEngineOracle.class,
7980
ImmutableList.of(DataType.TIMESTAMPTZ),
8081
RdbEngineYugabyte.class,
81-
ImmutableList.of(DataType.FLOAT, DataType.DOUBLE)));
82+
ImmutableList.of(DataType.FLOAT, DataType.DOUBLE),
83+
RdbEngineDb2.class,
84+
ImmutableList.of(DataType.BLOB)));
8285
}
8386
}

core/src/integration-test/java/com/scalar/db/storage/jdbc/SingleCrudOperationTransactionAdminIntegrationTestWithJdbcDatabase.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ protected AdminTestUtils getAdminTestUtils(String testName) {
2222
}
2323

2424
@Override
25-
protected boolean isCreateIndexOnTextAndBlobColumnsEnabled() {
26-
// "admin.createIndex()" for TEXT and BLOB columns fails (the "create index" query runs
25+
protected boolean isCreateIndexOnTextColumnEnabled() {
26+
// "admin.createIndex()" for TEXT column fails (the "create index" query runs
2727
// indefinitely) on the Db2 community edition docker version which we use for the CI.
2828
// However, the index creation is successful on Db2 hosted on IBM Cloud.
2929
// So we disable these tests until the issue with the Db2 community edition is resolved.
3030
return !JdbcTestUtils.isDb2(rdbEngine);
3131
}
32+
33+
@Override
34+
protected boolean isIndexOnBlobColumnSupported() {
35+
return !JdbcTestUtils.isDb2(rdbEngine);
36+
}
3237
}

0 commit comments

Comments
 (0)