Skip to content

Commit b082256

Browse files
committed
Add time related types (#2468)
# Conflicts: # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraAdminRepairIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraColumnValueIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraMultipleClusteringKeyScanIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraMultiplePartitionKeyIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraSchemaLoaderIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraSecondaryIndexIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraSingleClusteringKeyScanIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraSinglePartitionKeyIntegrationTest.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitAdminIntegrationTestWithCassandra.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitAdminRepairIntegrationTestWithCassandra.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitIntegrationTestWithCassandra.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/SingleCrudOperationTransactionAdminIntegrationTestWithCassandra.java # core/src/integration-test/java/com/scalar/db/storage/cassandra/TwoPhaseConsensusCommitIntegrationTestWithCassandra.java # core/src/integration-test/java/com/scalar/db/storage/jdbc/JdbcAdminImportTestUtils.java # core/src/main/java/com/scalar/db/common/CheckedDistributedStorageAdmin.java # core/src/main/java/com/scalar/db/storage/cassandra/CassandraAdmin.java # core/src/main/java/com/scalar/db/storage/jdbc/JdbcAdmin.java # core/src/main/java/com/scalar/db/storage/jdbc/JdbcConfig.java # core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineOracle.java # core/src/main/java/com/scalar/db/storage/jdbc/RdbEnginePostgresql.java # core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineSqlServer.java # core/src/main/java/com/scalar/db/storage/jdbc/RdbEngineSqlite.java # core/src/main/java/com/scalar/db/transaction/consensuscommit/ConsensusCommitAdmin.java # core/src/test/java/com/scalar/db/storage/cosmos/CosmosAdminTestBase.java # core/src/test/java/com/scalar/db/storage/jdbc/JdbcAdminTestBase.java # core/src/test/java/com/scalar/db/storage/multistorage/MultiStorageAdminTest.java # integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminImportTableIntegrationTestBase.java # integration-test/src/main/java/com/scalar/db/api/DistributedStorageAdminRepairTableIntegrationTestBase.java # integration-test/src/main/java/com/scalar/db/api/DistributedTransactionAdminImportTableIntegrationTestBase.java # integration-test/src/main/java/com/scalar/db/api/DistributedTransactionAdminRepairIntegrationTestBase.java # integration-test/src/main/java/com/scalar/db/schemaloader/SchemaLoaderIntegrationTestBase.java
1 parent db432f3 commit b082256

File tree

194 files changed

+10751
-1809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

194 files changed

+10751
-1809
lines changed

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ subprojects {
3131
commonsDbcp2Version = '2.13.0'
3232
mysqlDriverVersion = '8.4.0'
3333
postgresqlDriverVersion = '42.7.5'
34-
oracleDriverVersion = '21.16.0.0'
35-
sqlserverDriverVersion = '11.2.3.jre8'
34+
oracleDriverVersion = '23.6.0.24.10'
35+
sqlserverDriverVersion = '12.8.1.jre8'
3636
sqliteDriverVersion = '3.48.0.0'
3737
yugabyteDriverVersion = '42.7.3-yb-2'
3838
mariadDbDriverVersion = '3.5.1'

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraAdminIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ protected String getSystemNamespaceName(Properties properties) {
1616
.getSystemNamespaceName()
1717
.orElse(DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME);
1818
}
19+
20+
@Override
21+
protected boolean isTimestampTypeSupported() {
22+
return false;
23+
}
1924
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraAdminRepairTableIntegrationTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ public void repairTable_ShouldDoNothing() throws ExecutionException {
4343
// Act
4444
assertThatCode(
4545
() ->
46-
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions()))
46+
admin.repairTable(
47+
getNamespace(), getTable(), getTableMetadata(), getCreationOptions()))
4748
.doesNotThrowAnyException();
4849

4950
// Assert
5051
assertThat(admin.tableExists(getNamespace(), getTable())).isTrue();
51-
assertThat(admin.getTableMetadata(getNamespace(), getTable())).isEqualTo(TABLE_METADATA);
52+
assertThat(admin.getTableMetadata(getNamespace(), getTable())).isEqualTo(getTableMetadata());
5253
}
5354
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraColumnValueIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ public class CassandraColumnValueIntegrationTest
99
protected Properties getProperties(String testName) {
1010
return CassandraEnv.getProperties(testName);
1111
}
12+
13+
@Override
14+
protected boolean isTimestampTypeSupported() {
15+
return false;
16+
}
1217
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraConditionalMutationIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,9 @@ protected boolean shouldMutate(
2525
return super.shouldMutate(initialColumn, columnToCompare, operator);
2626
}
2727
}
28+
29+
@Override
30+
protected boolean isTimestampTypeSupported() {
31+
return false;
32+
}
2833
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraCrossPartitionScanIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ protected Map<String, String> getCreationOptions() {
2424
@Override
2525
@Disabled("Cross partition scan with ordering is not supported in Cassandra")
2626
public void scan_WithOrderingForNonPrimaryColumns_ShouldReturnProperResult() {}
27+
28+
@Override
29+
protected boolean isTimestampTypeSupported() {
30+
return false;
31+
}
2732
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraMultipleClusteringKeyScanIntegrationTest.java

+10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.scalar.db.storage.cassandra;
22

33
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
4+
import com.scalar.db.io.DataType;
5+
import java.util.List;
46
import java.util.Properties;
7+
import java.util.stream.Collectors;
58

69
public class CassandraMultipleClusteringKeyScanIntegrationTest
710
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
@@ -10,4 +13,11 @@ public class CassandraMultipleClusteringKeyScanIntegrationTest
1013
protected Properties getProperties(String testName) {
1114
return CassandraEnv.getProperties(testName);
1215
}
16+
17+
@Override
18+
protected List<DataType> getDataTypes() {
19+
return super.getDataTypes().stream()
20+
.filter(type -> type != DataType.TIMESTAMP)
21+
.collect(Collectors.toList());
22+
}
1323
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.scalar.db.storage.cassandra;
22

33
import com.scalar.db.api.DistributedStorageMultiplePartitionKeyIntegrationTestBase;
4+
import com.scalar.db.io.DataType;
5+
import java.util.List;
46
import java.util.Properties;
7+
import java.util.stream.Collectors;
58

69
public class CassandraMultiplePartitionKeyIntegrationTest
710
extends DistributedStorageMultiplePartitionKeyIntegrationTestBase {
811
@Override
912
protected Properties getProperties(String testName) {
1013
return CassandraEnv.getProperties(testName);
1114
}
15+
16+
@Override
17+
protected List<DataType> getDataTypes() {
18+
return super.getDataTypes().stream()
19+
.filter(type -> type != DataType.TIMESTAMP)
20+
.collect(Collectors.toList());
21+
}
1222
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/CassandraSchemaLoaderIntegrationTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ protected Properties getProperties(String testName) {
1515
protected AdminTestUtils getAdminTestUtils(String testName) {
1616
return new CassandraAdminTestUtils(getProperties(testName));
1717
}
18+
19+
@Override
20+
protected boolean isTimestampTypeSupported() {
21+
return false;
22+
}
1823
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.scalar.db.storage.cassandra;
22

33
import com.scalar.db.api.DistributedStorageSecondaryIndexIntegrationTestBase;
4+
import com.scalar.db.io.DataType;
45
import java.util.Properties;
6+
import java.util.Set;
7+
import java.util.stream.Collectors;
58

69
public class CassandraSecondaryIndexIntegrationTest
710
extends DistributedStorageSecondaryIndexIntegrationTestBase {
811
@Override
912
protected Properties getProperties(String testName) {
1013
return CassandraEnv.getProperties(testName);
1114
}
15+
16+
@Override
17+
protected Set<DataType> getSecondaryIndexTypes() {
18+
return super.getSecondaryIndexTypes().stream()
19+
.filter(type -> type != DataType.TIMESTAMP)
20+
.collect(Collectors.toSet());
21+
}
1222
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.scalar.db.storage.cassandra;
22

33
import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
4+
import com.scalar.db.io.DataType;
5+
import java.util.List;
46
import java.util.Properties;
7+
import java.util.stream.Collectors;
58

69
public class CassandraSingleClusteringKeyScanIntegrationTest
710
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
811
@Override
912
protected Properties getProperties(String testName) {
1013
return CassandraEnv.getProperties(testName);
1114
}
15+
16+
@Override
17+
protected List<DataType> getClusteringKeyTypes() {
18+
return super.getClusteringKeyTypes().stream()
19+
.filter(type -> type != DataType.TIMESTAMP)
20+
.collect(Collectors.toList());
21+
}
1222
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package com.scalar.db.storage.cassandra;
22

33
import com.scalar.db.api.DistributedStorageSinglePartitionKeyIntegrationTestBase;
4+
import com.scalar.db.io.DataType;
5+
import java.util.List;
46
import java.util.Properties;
7+
import java.util.stream.Collectors;
58

69
public class CassandraSinglePartitionKeyIntegrationTest
710
extends DistributedStorageSinglePartitionKeyIntegrationTestBase {
811
@Override
912
protected Properties getProperties(String testName) {
1013
return CassandraEnv.getProperties(testName);
1114
}
15+
16+
@Override
17+
protected List<DataType> getPartitionKeyTypes() {
18+
return super.getPartitionKeyTypes().stream()
19+
.filter(type -> type != DataType.TIMESTAMP)
20+
.collect(Collectors.toList());
21+
}
1222
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitAdminIntegrationTestWithCassandra.java

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ protected boolean isGroupCommitEnabled(String testName) {
3333
.isCoordinatorGroupCommitEnabled();
3434
}
3535

36+
@Override
37+
protected boolean isTimestampTypeSupported() {
38+
return false;
39+
}
40+
3641
@Override
3742
protected void extraCheckOnCoordinatorTable() {}
3843
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitAdminRepairTableIntegrationTestWithCassandra.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ public void repairTableAndCoordinatorTable_ShouldDoNothing() throws ExecutionExc
4343
// Act
4444
assertThatCode(
4545
() -> {
46-
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions());
46+
admin.repairTable(
47+
getNamespace(), getTable(), getTableMetadata(), getCreationOptions());
4748
admin.repairCoordinatorTables(getCreationOptions());
4849
})
4950
.doesNotThrowAnyException();
5051

5152
// Assert
5253
assertThat(admin.tableExists(getNamespace(), getTable())).isTrue();
53-
assertThat(admin.getTableMetadata(getNamespace(), getTable())).isEqualTo(TABLE_METADATA);
54+
assertThat(admin.getTableMetadata(getNamespace(), getTable())).isEqualTo(getTableMetadata());
5455
assertThat(admin.coordinatorTablesExist()).isTrue();
5556
}
57+
58+
@Override
59+
protected boolean isTimestampTypeSupported() {
60+
return false;
61+
}
5662
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/ConsensusCommitIntegrationTestWithCassandra.java

+5
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ public class ConsensusCommitIntegrationTestWithCassandra
99
protected Properties getProps(String testName) {
1010
return ConsensusCommitCassandraEnv.getProperties(testName);
1111
}
12+
13+
@Override
14+
protected boolean isTimestampTypeSupported() {
15+
return false;
16+
}
1217
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/SingleCrudOperationTransactionAdminIntegrationTestWithCassandra.java

+5
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ protected Map<String, String> getCreationOptions() {
2323
protected String getSystemNamespaceName(Properties properties) {
2424
return DatabaseConfig.DEFAULT_SYSTEM_NAMESPACE_NAME;
2525
}
26+
27+
@Override
28+
protected boolean isTimestampTypeSupported() {
29+
return false;
30+
}
2631
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/SingleCrudOperationTransactionIntegrationTestWithCassandra.java

+5
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ protected Properties getProps(String testName) {
1717
protected Map<String, String> getCreationOptions() {
1818
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
1919
}
20+
21+
@Override
22+
protected boolean isTimestampTypeSupported() {
23+
return false;
24+
}
2025
}

core/src/integration-test/java/com/scalar/db/storage/cassandra/TwoPhaseConsensusCommitIntegrationTestWithCassandra.java

+5
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ public class TwoPhaseConsensusCommitIntegrationTestWithCassandra
99
protected Properties getProps1(String testName) {
1010
return ConsensusCommitCassandraEnv.getProperties(testName);
1111
}
12+
13+
@Override
14+
protected boolean isTimestampTypeSupported() {
15+
return false;
16+
}
1217
}

core/src/integration-test/java/com/scalar/db/storage/cosmos/ConsensusCommitAdminRepairTableIntegrationTestWithCosmos.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void repairTable_ForTableWithoutStoredProcedure_ShouldCreateStoredProcedu
3535
cosmosAdminTestUtils.getTableStoredProcedure(getNamespace(), getTable()).delete();
3636

3737
// Act
38-
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions());
38+
admin.repairTable(getNamespace(), getTable(), getTableMetadata(), getCreationOptions());
3939

4040
// Assert
4141
assertThatCode(

core/src/integration-test/java/com/scalar/db/storage/cosmos/CosmosAdminRepairTableIntegrationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void repairTable_ForTableWithoutStoredProcedure_ShouldCreateStoredProcedu
3535
cosmosAdminTestUtils.getTableStoredProcedure(getNamespace(), getTable()).delete();
3636

3737
// Act
38-
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions());
38+
admin.repairTable(getNamespace(), getTable(), getTableMetadata(), getCreationOptions());
3939

4040
// Assert
4141
assertThatCode(

core/src/integration-test/java/com/scalar/db/storage/cosmos/CosmosMultipleClusteringKeyScanIntegrationTest.java

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package com.scalar.db.storage.cosmos;
22

3-
import com.google.common.collect.ArrayListMultimap;
4-
import com.google.common.collect.ListMultimap;
53
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
64
import com.scalar.db.io.DataType;
5+
import java.util.List;
76
import java.util.Map;
87
import java.util.Properties;
8+
import java.util.stream.Collectors;
99

1010
public class CosmosMultipleClusteringKeyScanIntegrationTest
1111
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
@@ -16,21 +16,11 @@ protected Properties getProperties(String testName) {
1616
}
1717

1818
@Override
19-
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
19+
protected List<DataType> getDataTypes() {
2020
// Return types without BLOB because blob is not supported for clustering key for now
21-
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
22-
for (DataType firstClusteringKeyType : DataType.values()) {
23-
if (firstClusteringKeyType == DataType.BLOB) {
24-
continue;
25-
}
26-
for (DataType secondClusteringKeyType : DataType.values()) {
27-
if (secondClusteringKeyType == DataType.BLOB) {
28-
continue;
29-
}
30-
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
31-
}
32-
}
33-
return clusteringKeyTypes;
21+
return super.getDataTypes().stream()
22+
.filter(type -> type != DataType.BLOB)
23+
.collect(Collectors.toList());
3424
}
3525

3626
@Override

core/src/integration-test/java/com/scalar/db/storage/cosmos/CosmosSingleClusteringKeyScanIntegrationTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
44
import com.scalar.db.io.DataType;
5-
import java.util.HashSet;
5+
import java.util.ArrayList;
6+
import java.util.List;
67
import java.util.Map;
78
import java.util.Properties;
8-
import java.util.Set;
99

1010
public class CosmosSingleClusteringKeyScanIntegrationTest
1111
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
@@ -15,9 +15,9 @@ protected Properties getProperties(String testName) {
1515
}
1616

1717
@Override
18-
protected Set<DataType> getClusteringKeyTypes() {
18+
protected List<DataType> getClusteringKeyTypes() {
1919
// Return types without BLOB because blob is not supported for clustering key for now
20-
Set<DataType> clusteringKeyTypes = new HashSet<>();
20+
List<DataType> clusteringKeyTypes = new ArrayList<>();
2121
for (DataType dataType : DataType.values()) {
2222
if (dataType == DataType.BLOB) {
2323
continue;

core/src/integration-test/java/com/scalar/db/storage/dynamo/DynamoMultipleClusteringKeyScanIntegrationTest.java

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.scalar.db.storage.dynamo;
22

3-
import com.google.common.collect.ArrayListMultimap;
4-
import com.google.common.collect.ListMultimap;
53
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
64
import com.scalar.db.io.Column;
75
import com.scalar.db.io.DataType;
6+
import java.util.List;
87
import java.util.Map;
98
import java.util.Properties;
109
import java.util.Random;
10+
import java.util.stream.Collectors;
1111

1212
public class DynamoMultipleClusteringKeyScanIntegrationTest
1313
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
@@ -18,21 +18,11 @@ protected Properties getProperties(String testName) {
1818
}
1919

2020
@Override
21-
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
21+
protected List<DataType> getDataTypes() {
2222
// Return types without BLOB because blob is not supported for clustering key for now
23-
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
24-
for (DataType firstClusteringKeyType : DataType.values()) {
25-
if (firstClusteringKeyType == DataType.BLOB) {
26-
continue;
27-
}
28-
for (DataType secondClusteringKeyType : DataType.values()) {
29-
if (secondClusteringKeyType == DataType.BLOB) {
30-
continue;
31-
}
32-
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
33-
}
34-
}
35-
return clusteringKeyTypes;
23+
return super.getDataTypes().stream()
24+
.filter(type -> type != DataType.BLOB)
25+
.collect(Collectors.toList());
3626
}
3727

3828
@Override

0 commit comments

Comments
 (0)