use of io.confluent.ksql.parser.tree.LambdaExpression in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatLambdaExpression.
@Test
public void shouldFormatLambdaExpression() {
final LambdaExpression expression = new LambdaExpression(Arrays.asList("a", "b"), new StringLiteral("something"));
assertThat(ExpressionFormatter.formatExpression(expression), equalTo("(a, b) -> 'something'"));
}
use of io.confluent.ksql.parser.tree.LambdaExpression in project ksql by confluentinc.
the class AstBuilder method visitLambda.
@Override
public Node visitLambda(SqlBaseParser.LambdaContext context) {
List<String> arguments = context.identifier().stream().map(AstBuilder::getIdentifierText).collect(toList());
Expression body = (Expression) visit(context.expression());
return new LambdaExpression(arguments, body);
}
Aggregations