@Test
public void testBigintSmall()
{
List<RowExpression> values = new ArrayList<>();
values.add(new ConstantExpression((long) Integer.MIN_VALUE, BIGINT));
values.add(new ConstantExpression((long) Integer.MAX_VALUE, BIGINT));
values.add(new ConstantExpression(3L, BIGINT));
assertEquals(checkSwitchGenerationCase(BIGINT, values), DIRECT_SWITCH);
values.add(new ConstantExpression(null, BIGINT));
assertEquals(checkSwitchGenerationCase(BIGINT, values), DIRECT_SWITCH);
values.add(new CallExpression(
new Signature(
CAST,
SCALAR,
BIGINT.getDisplayName(),
DOUBLE.getDisplayName()
),
BIGINT,
Collections.singletonList(new ConstantExpression(12345678901234.0, DOUBLE))
));
assertEquals(checkSwitchGenerationCase(BIGINT, values), DIRECT_SWITCH);
for (long i = 6; i <= 32; ++i) {
values.add(new ConstantExpression(i, BIGINT));
}
assertEquals(checkSwitchGenerationCase(BIGINT, values), DIRECT_SWITCH);
values.add(new ConstantExpression(33L, BIGINT));
assertEquals(checkSwitchGenerationCase(BIGINT, values), SET_CONTAINS);
}