Search in sources :

Example 1 with SplitKeyExpression

use of com.apple.foundationdb.record.metadata.expressions.SplitKeyExpression in project fdb-record-layer by FoundationDB.

the class KeyExpressionTest method testSplit.

@Test
public void testSplit() throws Exception {
    final SplitKeyExpression split = field("repeat_me", FanType.FanOut).split(3);
    split.validate(TestScalarFieldAccess.getDescriptor());
    assertEquals(Arrays.asList(concatenate("one", "two", "three"), concatenate("four", "five", "six"), concatenate("seven", "eight", "nine")), evaluate(split, numbers));
    assertEquals(Collections.emptyList(), evaluate(split, null));
}
Also used : SplitKeyExpression(com.apple.foundationdb.record.metadata.expressions.SplitKeyExpression) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with SplitKeyExpression

use of com.apple.foundationdb.record.metadata.expressions.SplitKeyExpression in project fdb-record-layer by FoundationDB.

the class KeyExpressionTest method testSplitBad.

@Test
public void testSplitBad() throws Exception {
    assertThrows(RecordCoreException.class, () -> {
        final SplitKeyExpression split = field("repeat_me", FanType.FanOut).split(4);
        split.validate(TestScalarFieldAccess.getDescriptor());
        evaluate(split, numbers);
    });
}
Also used : SplitKeyExpression(com.apple.foundationdb.record.metadata.expressions.SplitKeyExpression) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

SplitKeyExpression (com.apple.foundationdb.record.metadata.expressions.SplitKeyExpression)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2