use of org.apache.druid.segment.ColumnValueSelector in project druid by druid-io.
the class ArrayStringGroupByColumnSelectorStrategyTest method testSanity.
@Test
public void testSanity() {
ColumnValueSelector columnValueSelector = Mockito.mock(ColumnValueSelector.class);
Mockito.when(columnValueSelector.getObject()).thenReturn(ImmutableList.of("a", "b"));
Assert.assertEquals(0, strategy.getOnlyValue(columnValueSelector));
GroupByColumnSelectorPlus groupByColumnSelectorPlus = Mockito.mock(GroupByColumnSelectorPlus.class);
Mockito.when(groupByColumnSelectorPlus.getResultRowPosition()).thenReturn(0);
ResultRow row = ResultRow.create(1);
buffer1.putInt(0);
strategy.processValueFromGroupingKey(groupByColumnSelectorPlus, buffer1, row, 0);
Assert.assertEquals(ComparableStringArray.of("a", "b"), row.get(0));
}
use of org.apache.druid.segment.ColumnValueSelector in project druid by druid-io.
the class ArrayStringGroupByColumnSelectorStrategyTest method testAddingInDictionaryWithObjects.
@Test
public void testAddingInDictionaryWithObjects() {
ColumnValueSelector columnValueSelector = Mockito.mock(ColumnValueSelector.class);
Mockito.when(columnValueSelector.getObject()).thenReturn(new Object[] { "f", "a" });
Assert.assertEquals(3, strategy.getOnlyValue(columnValueSelector));
GroupByColumnSelectorPlus groupByColumnSelectorPlus = Mockito.mock(GroupByColumnSelectorPlus.class);
Mockito.when(groupByColumnSelectorPlus.getResultRowPosition()).thenReturn(0);
ResultRow row = ResultRow.create(1);
buffer1.putInt(3);
strategy.processValueFromGroupingKey(groupByColumnSelectorPlus, buffer1, row, 0);
Assert.assertEquals(ComparableStringArray.of("f", "a"), row.get(0));
}
Aggregations