Search in sources :

Example 6 with DataType

use of com.scalar.db.io.DataType in project scalardb by scalar-labs.

the class StorageSecondaryIndexIntegrationTestBase method scan_WithMinSecondaryIndexValue_ShouldReturnProperResult.

@Test
public void scan_WithMinSecondaryIndexValue_ShouldReturnProperResult() throws ExecutionException, IOException {
    for (DataType secondaryIndexType : secondaryIndexTypes) {
        truncateTable(secondaryIndexType);
        // Arrange
        Value<?> secondaryIndexValue = getMinValue(INDEX_COL_NAME, secondaryIndexType);
        prepareRecords(secondaryIndexType, secondaryIndexValue);
        Scan scan = new Scan(new Key(secondaryIndexValue)).forNamespace(namespace).forTable(getTableName(secondaryIndexType));
        // Act
        List<Result> results = scanAll(scan);
        // Assert
        assertResults(results, secondaryIndexValue);
    }
}
Also used : DataType(com.scalar.db.io.DataType) Scan(com.scalar.db.api.Scan) Key(com.scalar.db.io.Key) Result(com.scalar.db.api.Result) Test(org.junit.Test)

Example 7 with DataType

use of com.scalar.db.io.DataType in project scalardb by scalar-labs.

the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyRange_ShouldReturnProperResult.

@Test
public void scan_WithClusteringKeyRange_ShouldReturnProperResult() throws ExecutionException, IOException {
    for (DataType clusteringKeyType : clusteringKeyTypes) {
        for (Order clusteringOrder : Order.values()) {
            truncateTable(clusteringKeyType, clusteringOrder);
            List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
            for (boolean startInclusive : Arrays.asList(true, false)) {
                for (boolean endInclusive : Arrays.asList(true, false)) {
                    for (OrderingType orderingType : OrderingType.values()) {
                        for (boolean withLimit : Arrays.asList(false, true)) {
                            scan_WithClusteringKeyRange_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, startInclusive, endInclusive, orderingType, withLimit);
                        }
                    }
                }
            }
        }
    }
}
Also used : Order(com.scalar.db.api.Scan.Ordering.Order) Value(com.scalar.db.io.Value) DataType(com.scalar.db.io.DataType) Test(org.junit.Test)

Example 8 with DataType

use of com.scalar.db.io.DataType in project scalardb by scalar-labs.

the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithoutClusteringKeyRange_ShouldReturnProperResult.

@Test
public void scan_WithoutClusteringKeyRange_ShouldReturnProperResult() throws ExecutionException, IOException {
    for (DataType clusteringKeyType : clusteringKeyTypes) {
        for (Order clusteringOrder : Order.values()) {
            truncateTable(clusteringKeyType, clusteringOrder);
            List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
            for (OrderingType orderingType : OrderingType.values()) {
                for (boolean withLimit : Arrays.asList(false, true)) {
                    scan_WithoutClusteringKeyRange_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, orderingType, withLimit);
                }
            }
        }
    }
}
Also used : Order(com.scalar.db.api.Scan.Ordering.Order) Value(com.scalar.db.io.Value) DataType(com.scalar.db.io.DataType) Test(org.junit.Test)

Example 9 with DataType

use of com.scalar.db.io.DataType in project scalardb by scalar-labs.

the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyStartRangeWithMinValue_ShouldReturnProperResult.

@Test
public void scan_WithClusteringKeyStartRangeWithMinValue_ShouldReturnProperResult() throws ExecutionException, IOException {
    for (DataType clusteringKeyType : clusteringKeyTypes) {
        for (Order clusteringOrder : Order.values()) {
            truncateTable(clusteringKeyType, clusteringOrder);
            List<Value<?>> clusteringKeyValues = prepareRecords(clusteringKeyType, clusteringOrder);
            for (boolean startInclusive : Arrays.asList(true, false)) {
                for (OrderingType orderingType : OrderingType.values()) {
                    for (boolean withLimit : Arrays.asList(false, true)) {
                        scan_WithClusteringKeyStartRangeWithMinValue_ShouldReturnProperResult(clusteringKeyValues, clusteringKeyType, clusteringOrder, startInclusive, orderingType, withLimit);
                    }
                }
            }
        }
    }
}
Also used : Order(com.scalar.db.api.Scan.Ordering.Order) Value(com.scalar.db.io.Value) DataType(com.scalar.db.io.DataType) Test(org.junit.Test)

Example 10 with DataType

use of com.scalar.db.io.DataType in project scalardb by scalar-labs.

the class StorageSingleClusteringKeyScanIntegrationTestBase method createTables.

private void createTables() throws ExecutionException {
    Map<String, String> options = getCreateOptions();
    admin.createNamespace(namespace, true, options);
    for (DataType clusteringKeyType : clusteringKeyTypes) {
        for (Order clusteringOrder : Order.values()) {
            createTable(clusteringKeyType, clusteringOrder, options);
        }
    }
}
Also used : Order(com.scalar.db.api.Scan.Ordering.Order) DataType(com.scalar.db.io.DataType)

Aggregations

DataType (com.scalar.db.io.DataType)52 Order (com.scalar.db.api.Scan.Ordering.Order)30 Value (com.scalar.db.io.Value)18 Test (org.junit.jupiter.api.Test)16 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)12 Callable (java.util.concurrent.Callable)12 Key (com.scalar.db.io.Key)6 Result (com.scalar.db.api.Result)5 Scan (com.scalar.db.api.Scan)3 Delete (com.scalar.db.api.Delete)2 Get (com.scalar.db.api.Get)2 TableMetadata (com.scalar.db.api.TableMetadata)2 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 Ordering (com.scalar.db.api.Scan.Ordering)1 ExecutionException (com.scalar.db.exception.storage.ExecutionException)1 BigIntValue (com.scalar.db.io.BigIntValue)1 BlobValue (com.scalar.db.io.BlobValue)1