use of org.apache.druid.segment.column.RowSignature in project druid by druid-io.
the class DruidOuterQueryRel method toDruidQuery.
@Override
public DruidQuery toDruidQuery(final boolean finalizeAggregations) {
// Must finalize aggregations on subqueries.
final DruidQuery subQuery = ((DruidRel) sourceRel).toDruidQuery(true);
final RowSignature sourceRowSignature = subQuery.getOutputRowSignature();
return partialQuery.build(new QueryDataSource(subQuery.getQuery()), sourceRowSignature, getPlannerContext(), getCluster().getRexBuilder(), finalizeAggregations);
}
use of org.apache.druid.segment.column.RowSignature in project druid by druid-io.
the class ExpressionPostAggregatorTest method testNilOutputType.
@Test
public void testNilOutputType() {
ExpressionPostAggregator postAgg = new ExpressionPostAggregator("p0", "x + y", null, TestExprMacroTable.INSTANCE);
RowSignature signature = RowSignature.builder().build();
// columns not existing in the output signature means they don't exist, so the output is also null
Assert.assertNull(postAgg.getType(signature));
}
use of org.apache.druid.segment.column.RowSignature 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()));
}
use of org.apache.druid.segment.column.RowSignature in project druid by druid-io.
the class FieldAccessPostAggregatorTest method testGetTypeBeforeDecorate.
@Test
public void testGetTypeBeforeDecorate() {
FieldAccessPostAggregator postAgg = new FieldAccessPostAggregator("name", "column");
RowSignature signature = RowSignature.builder().add("column", ColumnType.LONG).build();
Assert.assertEquals(ColumnType.LONG, postAgg.getType(signature));
}
use of org.apache.druid.segment.column.RowSignature in project druid by druid-io.
the class DruidSchemaTest method testSegmentMetadataColumnType.
@Test
public void testSegmentMetadataColumnType() {
RowSignature signature = DruidSchema.analysisToRowSignature(new SegmentAnalysis("id", ImmutableList.of(Intervals.utc(1L, 2L)), ImmutableMap.of("a", new ColumnAnalysis(ColumnType.STRING, ColumnType.STRING.asTypeString(), false, true, 1234, 26, "a", "z", null), "count", new ColumnAnalysis(ColumnType.LONG, ColumnType.LONG.asTypeString(), false, true, 1234, 26, "a", "z", null)), 1234, 100, null, null, null, null));
Assert.assertEquals(RowSignature.builder().add("a", ColumnType.STRING).add("count", ColumnType.LONG).build(), signature);
}
Aggregations