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

Refactor to partially remove deprecated Value classes usage #2328

Merged
merged 5 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ protected Map<String, String> getCreationOptions() {
protected AdminTestUtils getAdminTestUtils(String testName) {
return new CassandraAdminTestUtils(getProperties(testName));
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ protected void initialize(String testName) {
admin = new CassandraAdmin(clusterManager, new DatabaseConfig(properties));
adminTestUtils = new CassandraAdminTestUtils(properties, clusterManager);
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ protected List<String> getCommandArgsForUpgrade(Path configFilePath) {
.add("--replication-factor=1")
.build();
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ protected Map<String, String> getCreationOptions() {
protected AdminTestUtils getAdminTestUtils(String testName) {
return new CassandraAdminTestUtils(getProperties(testName));
}

@Override
protected boolean isTimestampTypeSupported() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ protected void initialize(String testName) {
admin = new ConsensusCommitAdmin(storageAdmin, new DatabaseConfig(properties));
adminTestUtils = new CassandraAdminTestUtils(getProperties(testName), clusterManager);
}

@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
Expand Up @@ -35,7 +35,7 @@ public void repairTable_ForTableWithoutStoredProcedure_ShouldCreateStoredProcedu
cosmosAdminTestUtils.getTableStoredProcedure(getNamespace(), getTable()).delete();

// Act
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions());
admin.repairTable(getNamespace(), getTable(), getTableMetadata(), getCreationOptions());

// Assert
assertThatCode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void repairTable_ForTableWithoutStoredProcedure_ShouldCreateStoredProcedu
cosmosAdminTestUtils.getTableStoredProcedure(getNamespace(), getTable()).delete();

// Act
admin.repairTable(getNamespace(), getTable(), TABLE_METADATA, getCreationOptions());
admin.repairTable(getNamespace(), getTable(), getTableMetadata(), getCreationOptions());

// Assert
assertThatCode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ protected Properties getProperties(String testName) {
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.values()) {
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.values()) {
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (secondClusteringKeyType == DataType.BLOB) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected Properties getProperties(String testName) {
protected Set<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.values()) {
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
if (dataType == DataType.BLOB) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.scalar.db.storage.dynamo;

import com.scalar.db.api.DistributedStorageColumnValueIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import com.scalar.db.io.Value;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
Expand All @@ -20,26 +20,27 @@ protected Map<String, String> getCreationOptions() {
}

@Override
protected Value<?> getRandomValue(Random random, String columnName, DataType dataType) {
protected Column<?> getColumnWithRandomValue(
Random random, String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getRandomDynamoDoubleValue(random, columnName);
}
return super.getRandomValue(random, columnName, dataType);
return super.getColumnWithRandomValue(random, columnName, dataType);
}

@Override
protected Value<?> getMinValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMinValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMinDynamoDoubleValue(columnName);
}
return super.getMinValue(columnName, dataType);
return super.getColumnWithMinValue(columnName, dataType);
}

@Override
protected Value<?> getMaxValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMaxDynamoDoubleValue(columnName);
}
return super.getMaxValue(columnName, dataType);
return super.getColumnWithMaxValue(columnName, dataType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
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 com.scalar.db.io.Value;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
Expand All @@ -21,11 +21,11 @@ protected Properties getProperties(String testName) {
protected ListMultimap<DataType, DataType> getClusteringKeyTypes() {
// Return types without BLOB because blob is not supported for clustering key for now
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.values()) {
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.values()) {
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
if (secondClusteringKeyType == DataType.BLOB) {
continue;
}
Expand All @@ -41,26 +41,27 @@ protected Map<String, String> getCreationOptions() {
}

@Override
protected Value<?> getRandomValue(Random random, String columnName, DataType dataType) {
protected Column<?> getColumnWithRandomValue(
Random random, String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getRandomDynamoDoubleValue(random, columnName);
}
return super.getRandomValue(random, columnName, dataType);
return super.getColumnWithRandomValue(random, columnName, dataType);
}

@Override
protected Value<?> getMinValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMinValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMinDynamoDoubleValue(columnName);
}
return super.getMinValue(columnName, dataType);
return super.getColumnWithMinValue(columnName, dataType);
}

@Override
protected Value<?> getMaxValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMaxDynamoDoubleValue(columnName);
}
return super.getMaxValue(columnName, dataType);
return super.getColumnWithMaxValue(columnName, dataType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.scalar.db.api.DistributedStorageMultiplePartitionKeyIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import com.scalar.db.io.Value;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
Expand All @@ -24,39 +24,40 @@ protected Map<String, String> getCreationOptions() {
@Override
protected ListMultimap<DataType, DataType> getPartitionKeyTypes() {
ListMultimap<DataType, DataType> clusteringKeyTypes = ArrayListMultimap.create();
for (DataType firstClusteringKeyType : DataType.values()) {
for (DataType firstClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
// BLOB type is supported only for the last value in partition key
if (firstClusteringKeyType == DataType.BLOB) {
continue;
}
for (DataType secondClusteringKeyType : DataType.values()) {
for (DataType secondClusteringKeyType : DataType.valuesWithoutTimesRelatedTypes()) {
clusteringKeyTypes.put(firstClusteringKeyType, secondClusteringKeyType);
}
}
return clusteringKeyTypes;
}

@Override
protected Value<?> getRandomValue(Random random, String columnName, DataType dataType) {
protected Column<?> getColumnWithRandomValue(
Random random, String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getRandomDynamoDoubleValue(random, columnName);
}
return super.getRandomValue(random, columnName, dataType);
return super.getColumnWithRandomValue(random, columnName, dataType);
}

@Override
protected Value<?> getMinValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMinValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMinDynamoDoubleValue(columnName);
}
return super.getMinValue(columnName, dataType);
return super.getColumnWithMinValue(columnName, dataType);
}

@Override
protected Value<?> getMaxValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMaxDynamoDoubleValue(columnName);
}
return super.getMaxValue(columnName, dataType);
return super.getColumnWithMaxValue(columnName, dataType);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.scalar.db.storage.dynamo;

import com.scalar.db.api.DistributedStorageSecondaryIndexIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import com.scalar.db.io.Value;
import com.scalar.db.util.TestUtils;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -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.values()) {
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
if (dataType == DataType.BOOLEAN) {
continue;
}
Expand All @@ -36,28 +36,29 @@ protected Map<String, String> getCreationOptions() {
}

@Override
protected Value<?> getRandomValue(Random random, String columnName, DataType dataType) {
protected Column<?> getColumnWithRandomValue(
Random random, String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getRandomDynamoDoubleValue(random, columnName);
}
// don't allow empty value since secondary index cannot contain empty value
return TestUtils.getRandomValue(random, columnName, dataType, false);
return TestUtils.getColumnWithRandomValue(random, columnName, dataType, false);
}

@Override
protected Value<?> getMinValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMinValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMinDynamoDoubleValue(columnName);
}
// don't allow empty value since secondary index cannot contain empty value
return TestUtils.getMinValue(columnName, dataType, false);
return TestUtils.getColumnWithMinValue(columnName, dataType, false);
}

@Override
protected Value<?> getMaxValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMaxDynamoDoubleValue(columnName);
}
return super.getMaxValue(columnName, dataType);
return super.getColumnWithMaxValue(columnName, dataType);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.scalar.db.storage.dynamo;

import com.scalar.db.api.DistributedStorageSingleClusteringKeyScanIntegrationTestBase;
import com.scalar.db.io.Column;
import com.scalar.db.io.DataType;
import com.scalar.db.io.Value;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
Expand All @@ -21,7 +21,7 @@ protected Properties getProperties(String testName) {
protected Set<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.values()) {
for (DataType dataType : DataType.valuesWithoutTimesRelatedTypes()) {
if (dataType == DataType.BLOB) {
continue;
}
Expand All @@ -36,26 +36,27 @@ protected Map<String, String> getCreationOptions() {
}

@Override
protected Value<?> getRandomValue(Random random, String columnName, DataType dataType) {
protected Column<?> getColumnWithRandomValue(
Random random, String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getRandomDynamoDoubleValue(random, columnName);
}
return super.getRandomValue(random, columnName, dataType);
return super.getColumnWithRandomValue(random, columnName, dataType);
}

@Override
protected Value<?> getMinValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMinValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMinDynamoDoubleValue(columnName);
}
return super.getMinValue(columnName, dataType);
return super.getColumnWithMinValue(columnName, dataType);
}

@Override
protected Value<?> getMaxValue(String columnName, DataType dataType) {
protected Column<?> getColumnWithMaxValue(String columnName, DataType dataType) {
if (dataType == DataType.DOUBLE) {
return DynamoTestUtils.getMaxDynamoDoubleValue(columnName);
}
return super.getMaxValue(columnName, dataType);
return super.getColumnWithMaxValue(columnName, dataType);
}
}
Loading