use of io.confluent.ksql.execution.expression.tree.DereferenceExpression in project ksql by confluentinc.
the class PartitionByParamsFactoryTest method shouldBuildResultSchemaWhenPartitioningByMultipleFields.
@Test
public void shouldBuildResultSchemaWhenPartitioningByMultipleFields() {
// Given:
final List<Expression> partitionBy = ImmutableList.of(new UnqualifiedColumnReferenceExp(COL1), new DereferenceExpression(Optional.empty(), new UnqualifiedColumnReferenceExp(COL3), "someField"), new ArithmeticUnaryExpression(Optional.empty(), Sign.MINUS, new UnqualifiedColumnReferenceExp(COL1)));
// When:
final LogicalSchema resultSchema = PartitionByParamsFactory.buildSchema(SCHEMA, partitionBy, functionRegistry);
// Then:
assertThat(resultSchema, is(LogicalSchema.builder().keyColumn(COL1, SqlTypes.INTEGER).keyColumn(ColumnName.of("someField"), SqlTypes.BIGINT).keyColumn(ColumnName.of("KSQL_COL_0"), SqlTypes.INTEGER).valueColumn(COL1, SqlTypes.INTEGER).valueColumn(COL2, SqlTypes.INTEGER).valueColumn(COL3, COL3_TYPE).valueColumn(SystemColumns.ROWTIME_NAME, SqlTypes.BIGINT).valueColumn(COL0, SqlTypes.STRING).valueColumn(ColumnName.of("someField"), SqlTypes.BIGINT).valueColumn(ColumnName.of("KSQL_COL_0"), SqlTypes.INTEGER).build()));
}
Aggregations