use of org.apache.druid.math.expr.SettableObjectBinding in project druid by druid-io.
the class ExpressionPostAggregatorTest method testOutputTypeAndCompute.
@Test
public void testOutputTypeAndCompute() {
ExpressionPostAggregator postAgg = new ExpressionPostAggregator("p0", "x + y", null, TestExprMacroTable.INSTANCE);
RowSignature signature = RowSignature.builder().add("x", ColumnType.LONG).add("y", ColumnType.DOUBLE).build();
SettableObjectBinding binding = new SettableObjectBinding().withBinding("x", 2L).withBinding("y", 3.0);
Assert.assertEquals(ColumnType.DOUBLE, postAgg.getType(signature));
Assert.assertEquals(5.0, postAgg.compute(binding.asMap()));
}
Aggregations