use of org.apache.druid.java.util.common.HumanReadableBytes in project druid by druid-io.
the class CalciteQueryTest method testStringAggMaxBytes.
@Test
public void testStringAggMaxBytes() throws Exception {
cannotVectorize();
testQuery("SELECT STRING_AGG(l1, ',', 128), STRING_AGG(DISTINCT l1, ',', 128) FROM numfoo", ImmutableList.of(Druids.newTimeseriesQueryBuilder().dataSource(CalciteTests.DATASOURCE3).intervals(querySegmentSpec(Filtration.eternity())).granularity(Granularities.ALL).aggregators(aggregators(new FilteredAggregatorFactory(new ExpressionLambdaAggregatorFactory("a0", ImmutableSet.of("l1"), "__acc", "[]", "[]", true, false, false, "array_append(\"__acc\", \"l1\")", "array_concat(\"__acc\", \"a0\")", null, "if(array_length(o) == 0, null, array_to_string(o, ','))", new HumanReadableBytes(128), TestExprMacroTable.INSTANCE), not(selector("l1", null, null))), new FilteredAggregatorFactory(new ExpressionLambdaAggregatorFactory("a1", ImmutableSet.of("l1"), "__acc", "[]", "[]", true, false, false, "array_set_add(\"__acc\", \"l1\")", "array_set_add_all(\"__acc\", \"a1\")", null, "if(array_length(o) == 0, null, array_to_string(o, ','))", new HumanReadableBytes(128), TestExprMacroTable.INSTANCE), not(selector("l1", null, null))))).context(QUERY_CONTEXT_DEFAULT).build()), ImmutableList.of(useDefault ? new Object[] { "7,325323,0,0,0,0", "0,325323,7" } : new Object[] { "7,325323,0", "0,325323,7" }));
}
use of org.apache.druid.java.util.common.HumanReadableBytes in project druid by druid-io.
the class CalciteArraysQueryTest method testArrayAggMaxBytes.
@Test
public void testArrayAggMaxBytes() throws Exception {
cannotVectorize();
testQuery("SELECT ARRAY_AGG(l1, 128), ARRAY_AGG(DISTINCT l1, 128) FROM numfoo", ImmutableList.of(Druids.newTimeseriesQueryBuilder().dataSource(CalciteTests.DATASOURCE3).intervals(querySegmentSpec(Filtration.eternity())).granularity(Granularities.ALL).aggregators(aggregators(new ExpressionLambdaAggregatorFactory("a0", ImmutableSet.of("l1"), "__acc", "ARRAY<LONG>[]", "ARRAY<LONG>[]", true, true, false, "array_append(\"__acc\", \"l1\")", "array_concat(\"__acc\", \"a0\")", null, null, new HumanReadableBytes(128), TestExprMacroTable.INSTANCE), new ExpressionLambdaAggregatorFactory("a1", ImmutableSet.of("l1"), "__acc", "ARRAY<LONG>[]", "ARRAY<LONG>[]", true, true, false, "array_set_add(\"__acc\", \"l1\")", "array_set_add_all(\"__acc\", \"a1\")", null, null, new HumanReadableBytes(128), TestExprMacroTable.INSTANCE))).context(QUERY_CONTEXT_DEFAULT).build()), ImmutableList.of(useDefault ? new Object[] { "[7,325323,0,0,0,0]", "[0,7,325323]" } : new Object[] { "[7,325323,0,null,null,null]", "[null,0,7,325323]" }));
}
use of org.apache.druid.java.util.common.HumanReadableBytes in project druid by druid-io.
the class ExpressionLambdaAggregatorFactoryTest method testLongArrayType.
@Test
public void testLongArrayType() {
ExpressionLambdaAggregatorFactory agg = new ExpressionLambdaAggregatorFactory("expr_agg_name", ImmutableSet.of("some_column", "some_other_column"), null, "0", "ARRAY<LONG>[]", null, false, false, "__acc + some_column + some_other_column", "array_set_add(__acc, expr_agg_name)", null, null, new HumanReadableBytes(2048), TestExprMacroTable.INSTANCE);
Assert.assertEquals(ColumnType.LONG, agg.getIntermediateType());
Assert.assertEquals(ColumnType.LONG_ARRAY, agg.getCombiningFactory().getIntermediateType());
Assert.assertEquals(ColumnType.LONG_ARRAY, agg.getResultType());
}
use of org.apache.druid.java.util.common.HumanReadableBytes in project druid by druid-io.
the class ExpressionLambdaAggregatorFactoryTest method testComplexType.
@Test
public void testComplexType() {
ExpressionLambdaAggregatorFactory agg = new ExpressionLambdaAggregatorFactory("expr_agg_name", ImmutableSet.of("some_column"), null, "hyper_unique()", null, null, false, false, "hyper_unique_add(some_column, __acc)", "hyper_unique_add(__acc, expr_agg_name)", null, null, new HumanReadableBytes(2048), TestExprMacroTable.INSTANCE);
Assert.assertEquals(HyperUniquesAggregatorFactory.TYPE, agg.getIntermediateType());
Assert.assertEquals(HyperUniquesAggregatorFactory.TYPE, agg.getCombiningFactory().getIntermediateType());
Assert.assertEquals(HyperUniquesAggregatorFactory.TYPE, agg.getResultType());
}
use of org.apache.druid.java.util.common.HumanReadableBytes in project druid by druid-io.
the class ExpressionLambdaAggregatorFactoryTest method testDoubleArrayType.
@Test
public void testDoubleArrayType() {
ExpressionLambdaAggregatorFactory agg = new ExpressionLambdaAggregatorFactory("expr_agg_name", ImmutableSet.of("some_column", "some_other_column"), null, "0.0", "ARRAY<DOUBLE>[]", null, false, false, "__acc + some_column + some_other_column", "array_set_add(__acc, expr_agg_name)", null, null, new HumanReadableBytes(2048), TestExprMacroTable.INSTANCE);
Assert.assertEquals(ColumnType.DOUBLE, agg.getIntermediateType());
Assert.assertEquals(ColumnType.DOUBLE_ARRAY, agg.getCombiningFactory().getIntermediateType());
Assert.assertEquals(ColumnType.DOUBLE_ARRAY, agg.getResultType());
}
Aggregations