use of org.apache.druid.segment.ConstantMultiValueDimensionSelector in project druid by druid-io.
the class ExpressionVirtualColumnTest method testConstantDimensionSelectors.
@Test
public void testConstantDimensionSelectors() {
ExpressionVirtualColumn constant = new ExpressionVirtualColumn("constant", Parser.parse("1 + 2", TestExprMacroTable.INSTANCE), ColumnType.LONG);
DimensionSelector constantSelector = constant.makeDimensionSelector(DefaultDimensionSpec.of("constant"), COLUMN_SELECTOR_FACTORY);
Assert.assertTrue(constantSelector instanceof ConstantDimensionSelector);
Assert.assertEquals("3", constantSelector.getObject());
ExpressionVirtualColumn multiConstant = new ExpressionVirtualColumn("multi", Parser.parse("string_to_array('a,b,c', ',')", TestExprMacroTable.INSTANCE), ColumnType.STRING);
DimensionSelector multiConstantSelector = multiConstant.makeDimensionSelector(DefaultDimensionSpec.of("multiConstant"), COLUMN_SELECTOR_FACTORY);
Assert.assertTrue(multiConstantSelector instanceof ConstantMultiValueDimensionSelector);
Assert.assertEquals(ImmutableList.of("a", "b", "c"), multiConstantSelector.getObject());
}
Aggregations