Search in sources :

Example 1 with ExpressionParser.parseSelectExpression

use of io.confluent.ksql.parser.ExpressionParser.parseSelectExpression in project ksql by confluentinc.

the class ExpressionParserTest method shouldParseSelectExpression.

@Test
public void shouldParseSelectExpression() {
    // When:
    final SelectExpression parsed = ExpressionParser.parseSelectExpression("1 + 2 AS `three`");
    // Then:
    assertThat(parsed, equalTo(SelectExpression.of(ColumnName.of("three"), new ArithmeticBinaryExpression(parsed.getExpression().getLocation(), Operator.ADD, ONE, TWO))));
}
Also used : ArithmeticBinaryExpression(io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression) SelectExpression(io.confluent.ksql.execution.plan.SelectExpression) ExpressionParser.parseSelectExpression(io.confluent.ksql.parser.ExpressionParser.parseSelectExpression) Test(org.junit.Test)

Aggregations

ArithmeticBinaryExpression (io.confluent.ksql.execution.expression.tree.ArithmeticBinaryExpression)1 SelectExpression (io.confluent.ksql.execution.plan.SelectExpression)1 ExpressionParser.parseSelectExpression (io.confluent.ksql.parser.ExpressionParser.parseSelectExpression)1 Test (org.junit.Test)1