use of io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp in project ksql by confluentinc.
the class SqlToJavaVisitorTest method shouldGenerateCorrectCodeForDecimalUnaryPlus.
@Test
public void shouldGenerateCorrectCodeForDecimalUnaryPlus() {
// Given:
final ArithmeticUnaryExpression binExp = new ArithmeticUnaryExpression(Optional.empty(), Sign.PLUS, new UnqualifiedColumnReferenceExp(ColumnName.of("COL8")));
// When:
final String java = sqlToJavaVisitor.process(binExp);
// Then:
assertThat(java, is("(COL8.plus(new MathContext(2, RoundingMode.UNNECESSARY)))"));
}
use of io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp in project ksql by confluentinc.
the class SqlToJavaVisitorTest method shouldGenerateCorrectCodeForDecimalDoubleEQ.
@Test
public void shouldGenerateCorrectCodeForDecimalDoubleEQ() {
// Given:
final ComparisonExpression compExp = new ComparisonExpression(ComparisonExpression.Type.EQUAL, new UnqualifiedColumnReferenceExp(ColumnName.of("COL8")), new UnqualifiedColumnReferenceExp(ColumnName.of("COL3")));
// When:
final String java = sqlToJavaVisitor.process(compExp);
// Then:
assertThat(java, containsString("(COL8.compareTo(BigDecimal.valueOf(COL3)) == 0))"));
}
use of io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForTableGroupByAnyKey.
@Test
public void shouldResolveSchemaForTableGroupByAnyKey() {
// Given:
final TableGroupBy<?> step = new TableGroupBy<>(PROPERTIES, tableSource, formats, ImmutableList.of(new UnqualifiedColumnReferenceExp(Optional.empty(), ORANGE_COL)));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ORANGE_COL, SqlTypes.INTEGER).valueColumns(SCHEMA.value()).build()));
}
use of io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamGroupBy.
@Test
public void shouldResolveSchemaForStreamGroupBy() {
// Given:
final StreamGroupBy<?> step = new StreamGroupBy<>(PROPERTIES, streamSource, formats, ImmutableList.of(new UnqualifiedColumnReferenceExp(Optional.empty(), ORANGE_COL)));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ORANGE_COL, SqlTypes.INTEGER).valueColumns(SCHEMA.value()).build()));
}
use of io.confluent.ksql.execution.expression.tree.UnqualifiedColumnReferenceExp in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamSelectKeyV2.
@Test
public void shouldResolveSchemaForStreamSelectKeyV2() {
// Given:
final UnqualifiedColumnReferenceExp keyExpression1 = new UnqualifiedColumnReferenceExp(ColumnName.of("ORANGE"));
final UnqualifiedColumnReferenceExp keyExpression2 = new UnqualifiedColumnReferenceExp(ColumnName.of("APPLE"));
final StreamSelectKey<GenericKey> step = new StreamSelectKey<>(PROPERTIES, streamSource, ImmutableList.of(keyExpression1, keyExpression2));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(keyExpression1.getColumnName(), SqlTypes.INTEGER).keyColumn(keyExpression2.getColumnName(), SqlTypes.BIGINT).valueColumns(SCHEMA.value()).build()));
}
Aggregations