Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time-related types to the storage and transactional interfaces. #2437

Merged
merged 17 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subprojects {
commonsDbcp2Version = '2.13.0'
mysqlDriverVersion = '8.4.0'
postgresqlDriverVersion = '42.7.4'
oracleDriverVersion = '21.16.0.0'
oracleDriverVersion = '23.6.0.24.10'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade the Oracle driver to the latest version to facilitate the handling of dates before October 15th, 1582.

sqlserverDriverVersion = '11.2.3.jre8'
sqliteDriverVersion = '3.47.1.0'
yugabyteDriverVersion = '42.7.3-yb-2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ protected boolean shouldMutate(
return super.shouldMutate(initialColumn, columnToCompare, operator);
}
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ protected Map<String, String> getCreationOptions() {
@Override
@Disabled("Cross partition scan with ordering is not supported in Cassandra")
public void scan_WithOrderingForNonPrimaryColumns_ShouldReturnProperResult() {}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.scalar.db.storage.cassandra;

import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

public class CassandraMultipleClusteringKeyScanIntegrationTest
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
Expand All @@ -17,4 +20,11 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected List<DataType> getDataTypes() {
return super.getDataTypes().stream()
.filter(type -> type != DataType.TIMESTAMP)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.scalar.db.storage.cassandra;

import com.scalar.db.api.DistributedStorageMultiplePartitionKeyIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

public class CassandraMultiplePartitionKeyIntegrationTest
extends DistributedStorageMultiplePartitionKeyIntegrationTestBase {
Expand All @@ -16,4 +19,11 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected List<DataType> getDataTypes() {
return super.getDataTypes().stream()
.filter(type -> type != DataType.TIMESTAMP)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.scalar.db.storage.cassandra;

import com.scalar.db.api.DistributedStorageSecondaryIndexIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.stream.Collectors;

public class CassandraSecondaryIndexIntegrationTest
extends DistributedStorageSecondaryIndexIntegrationTestBase {
Expand All @@ -16,4 +19,11 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected Set<DataType> getSecondaryIndexTypes() {
return super.getSecondaryIndexTypes().stream()
.filter(type -> type != DataType.TIMESTAMP)
.collect(Collectors.toSet());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.scalar.db.storage.cassandra;

import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

public class CassandraSingleClusteringKeyScanIntegrationTest
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
Expand All @@ -16,4 +19,11 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected List<DataType> getClusteringKeyTypes() {
return super.getClusteringKeyTypes().stream()
.filter(type -> type != DataType.TIMESTAMP)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.scalar.db.storage.cassandra;

import com.scalar.db.api.DistributedStorageSinglePartitionKeyIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

public class CassandraSinglePartitionKeyIntegrationTest
extends DistributedStorageSinglePartitionKeyIntegrationTestBase {
Expand All @@ -16,4 +19,11 @@ protected Properties getProperties(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected List<DataType> getPartitionKeyTypes() {
return super.getPartitionKeyTypes().stream()
.filter(type -> type != DataType.TIMESTAMP)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ protected Properties getProps(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ protected Properties getProps(String testName) {
protected Map<String, String> getCreationOptions() {
return Collections.singletonMap(CassandraAdmin.REPLICATION_FACTOR, "1");
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.scalar.db.storage.cosmos;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;

public class CosmosMultipleClusteringKeyScanIntegrationTest
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
Expand All @@ -16,21 +16,11 @@ protected Properties getProperties(String testName) {
}

@Override
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
protected List<DataType> getDataTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (secondClusteringKeyType == DataType.BLOB) {
continue;
}
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
}
}
return clusteringKeyTypes;
return super.getDataTypes().stream()
.filter(type -> type != DataType.BLOB)
.collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.DataType;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class CosmosSingleClusteringKeyScanIntegrationTest
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
Expand All @@ -15,10 +15,10 @@ protected Properties getProperties(String testName) {
}

@Override
protected Set<DataType> getClusteringKeyTypes() {
protected List<DataType> getClusteringKeyTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
Set<DataType> clusteringKeyTypes = new HashSet<>();
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
List<DataType> clusteringKeyTypes = new ArrayList<>();
for (DataType dataType : DataType.values()) {
if (dataType == DataType.BLOB) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.scalar.db.storage.dynamo;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.scalar.db.api.DistributedStorageMultipleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.stream.Collectors;

public class DynamoMultipleClusteringKeyScanIntegrationTest
extends DistributedStorageMultipleClusteringKeyScanIntegrationTestBase {
Expand All @@ -18,21 +18,11 @@ protected Properties getProperties(String testName) {
}

@Override
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
protected List<DataType> getDataTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (secondClusteringKeyType == DataType.BLOB) {
continue;
}
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
}
}
return clusteringKeyTypes;
return super.getDataTypes().stream()
.filter(type -> type != DataType.BLOB)
.collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ protected Map<String, String> getCreationOptions() {
@Override
protected ListMultimap<DataType, DataType> getPartitionKeyTypes() {
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
for (DataType firstClusteringKeyType : DataType.values()) {
// BLOB type is supported only for the last value in partition key
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
for (DataType secondClusteringKeyType : DataType.values()) {
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected Properties getProperties(String testName) {
protected Set<DataType> getSecondaryIndexTypes() {
// Return types without BOOLEAN because boolean is not supported for secondary index for now
Set<DataType> clusteringKeyTypes = new HashSet<>();
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
for (DataType dataType : DataType.values()) {
if (dataType == DataType.BOOLEAN) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.Set;

public class DynamoSingleClusteringKeyScanIntegrationTest
extends DistributedStorageSingleClusteringKeyScanIntegrationTestBase {
Expand All @@ -18,10 +18,10 @@ protected Properties getProperties(String testName) {
}

@Override
protected Set<DataType> getClusteringKeyTypes() {
protected List<DataType> getClusteringKeyTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
Set<DataType> clusteringKeyTypes = new HashSet<>();
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
List<DataType> clusteringKeyTypes = new ArrayList<>();
for (DataType dataType : DataType.values()) {
if (dataType == DataType.BLOB) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public static DoubleColumn getRandomDynamoDoubleColumn(Random random, String col

public static double nextDynamoDouble(Random random) {
return random
.doubles(MIN_DYNAMO_DOUBLE_VALUE, MAX_DYNAMO_DOUBLE_VALUE)
.limit(1)
.doubles(1, MIN_DYNAMO_DOUBLE_VALUE, MAX_DYNAMO_DOUBLE_VALUE)
.findFirst()
.orElse(0.0d);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class ConsensusCommitAdminRepairIntegrationTestWithJdbcDatabase
extends ConsensusCommitAdminRepairIntegrationTestBase {
@LazyInit private RdbEngineStrategy rdbEngine;
@LazyInit private RdbEngineStrategy<?, ?, ?, ?> rdbEngine;

@Override
protected Properties getProps(String testName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class JdbcAdminImportTestUtils {
"geometry",
"geography");

private final RdbEngineStrategy rdbEngine;
private final RdbEngineStrategy<?, ?, ?, ?> rdbEngine;
private final int majorVersion;
private final BasicDataSource dataSource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class JdbcAdminRepairIntegrationTest
extends DistributedStorageAdminRepairIntegrationTestBase {
@LazyInit private RdbEngineStrategy rdbEngine;
@LazyInit private RdbEngineStrategy<?, ?, ?, ?> rdbEngine;

@Override
protected Properties getProperties(String testName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class JdbcAdminTestUtils extends AdminTestUtils {

private final String metadataSchema;
private final RdbEngineStrategy rdbEngine;
private final RdbEngineStrategy<?, ?, ?, ?> rdbEngine;
private final BasicDataSource dataSource;

public JdbcAdminTestUtils(Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class JdbcDatabaseColumnValueIntegrationTest
extends DistributedStorageColumnValueIntegrationTestBase {

private RdbEngineStrategy rdbEngine;
private RdbEngineStrategy<?, ?, ?, ?> rdbEngine;

@Override
protected Properties getProperties(String testName) {
Expand Down
Loading
Loading