use of com.scalar.db.api.Scan in project scalardb by scalar-labs.
the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyRangeWithMinAndMaxValue_ShouldReturnProperResult.
private void scan_WithClusteringKeyRangeWithMinAndMaxValue_ShouldReturnProperResult(List<Value<?>> clusteringKeyValues, DataType clusteringKeyType, Order clusteringOrder, boolean startInclusive, boolean endInclusive, OrderingType orderingType, boolean withLimit) throws ExecutionException, IOException {
// Arrange
Value<?> startClusteringKeyValue = getMinValue(CLUSTERING_KEY, clusteringKeyType);
Value<?> endClusteringKeyValue = getMaxValue(CLUSTERING_KEY, clusteringKeyType);
List<Value<?>> expected = getExpected(clusteringKeyValues, startClusteringKeyValue, startInclusive, endClusteringKeyValue, endInclusive, orderingType);
int limit = getLimit(withLimit, expected);
if (limit > 0) {
expected = expected.subList(0, limit);
}
Scan scan = getScan(clusteringKeyType, clusteringOrder, startClusteringKeyValue, startInclusive, endClusteringKeyValue, endInclusive, orderingType, limit);
// Act
List<Result> actual = scanAll(scan);
// Assert
assertScanResult(actual, expected, description(clusteringKeyType, clusteringOrder, startInclusive, endInclusive, orderingType, withLimit));
}
use of com.scalar.db.api.Scan in project scalardb by scalar-labs.
the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyRangeWithSameValues_ShouldReturnProperResult.
private void scan_WithClusteringKeyRangeWithSameValues_ShouldReturnProperResult(List<Value<?>> clusteringKeyValues, DataType clusteringKeyType, Order clusteringOrder, boolean startInclusive, boolean endInclusive, OrderingType orderingType, boolean withLimit) throws ExecutionException, IOException {
// Arrange
Value<?> startAndEndClusteringKeyValue;
if (clusteringKeyType == DataType.BOOLEAN) {
startAndEndClusteringKeyValue = clusteringKeyValues.get(0);
} else {
startAndEndClusteringKeyValue = clusteringKeyValues.get(9);
}
List<Value<?>> expected = getExpected(clusteringKeyValues, startAndEndClusteringKeyValue, startInclusive, startAndEndClusteringKeyValue, endInclusive, orderingType);
int limit = getLimit(withLimit, expected);
if (limit > 0) {
expected = expected.subList(0, limit);
}
Scan scan = getScan(clusteringKeyType, clusteringOrder, startAndEndClusteringKeyValue, startInclusive, startAndEndClusteringKeyValue, endInclusive, orderingType, limit);
// Act
List<Result> actual = scanAll(scan);
// Assert
assertScanResult(actual, expected, description(clusteringKeyType, clusteringOrder, startInclusive, endInclusive, orderingType, withLimit));
}
use of com.scalar.db.api.Scan in project scalardb by scalar-labs.
the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithoutClusteringKeyRange_ShouldReturnProperResult.
private void scan_WithoutClusteringKeyRange_ShouldReturnProperResult(List<Value<?>> clusteringKeyValues, DataType clusteringKeyType, Order clusteringOrder, OrderingType orderingType, boolean withLimit) throws ExecutionException, IOException {
// Arrange
List<Value<?>> expected = getExpected(clusteringKeyValues, null, null, null, null, orderingType);
int limit = getLimit(withLimit, expected);
if (limit > 0) {
expected = expected.subList(0, limit);
}
Scan scan = getScan(clusteringKeyType, clusteringOrder, null, null, null, null, orderingType, limit);
// Act
List<Result> actual = scanAll(scan);
// Assert
assertScanResult(actual, expected, description(clusteringKeyType, clusteringOrder, null, null, orderingType, withLimit));
}
use of com.scalar.db.api.Scan in project scalardb by scalar-labs.
the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyEndRangeWithMaxValue_ShouldReturnProperResult.
private void scan_WithClusteringKeyEndRangeWithMaxValue_ShouldReturnProperResult(List<Value<?>> clusteringKeyValues, DataType clusteringKeyType, Order clusteringOrder, boolean endInclusive, OrderingType orderingType, boolean withLimit) throws ExecutionException, IOException {
// Arrange
Value<?> endClusteringKey = getMaxValue(CLUSTERING_KEY, clusteringKeyType);
List<Value<?>> expected = getExpected(clusteringKeyValues, null, null, endClusteringKey, endInclusive, orderingType);
int limit = getLimit(withLimit, expected);
if (limit > 0) {
expected = expected.subList(0, limit);
}
Scan scan = getScan(clusteringKeyType, clusteringOrder, null, null, endClusteringKey, endInclusive, orderingType, limit);
// Act
List<Result> actual = scanAll(scan);
// Assert
assertScanResult(actual, expected, description(clusteringKeyType, clusteringOrder, null, endInclusive, orderingType, withLimit));
}
use of com.scalar.db.api.Scan in project scalardb by scalar-labs.
the class StorageSingleClusteringKeyScanIntegrationTestBase method scan_WithClusteringKeyStartRange_ShouldReturnProperResult.
private void scan_WithClusteringKeyStartRange_ShouldReturnProperResult(List<Value<?>> clusteringKeyValues, DataType clusteringKeyType, Order clusteringOrder, boolean startInclusive, OrderingType orderingType, boolean withLimit) throws ExecutionException, IOException {
// Arrange
Value<?> startClusteringKeyValue;
if (clusteringKeyType == DataType.BOOLEAN) {
startClusteringKeyValue = clusteringKeyValues.get(0);
} else {
startClusteringKeyValue = clusteringKeyValues.get(4);
}
List<Value<?>> expected = getExpected(clusteringKeyValues, startClusteringKeyValue, startInclusive, null, null, orderingType);
int limit = getLimit(withLimit, expected);
if (limit > 0) {
expected = expected.subList(0, limit);
}
Scan scan = getScan(clusteringKeyType, clusteringOrder, startClusteringKeyValue, startInclusive, null, null, orderingType, limit);
// Act
List<Result> actual = scanAll(scan);
// Assert
assertScanResult(actual, expected, description(clusteringKeyType, clusteringOrder, startInclusive, null, orderingType, withLimit));
}
Aggregations