use of io.confluent.ksql.parser.tree.NodeLocation in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatFunctionWithDistinct.
@Test
public void shouldFormatFunctionWithDistinct() {
final FunctionCall functionCall = new FunctionCall(new NodeLocation(1, 1), QualifiedName.of("function", "COUNT"), true, Collections.singletonList(new StringLiteral("name")));
assertThat(ExpressionFormatter.formatExpression(functionCall), equalTo("function.COUNT(DISTINCT 'name')"));
}
use of io.confluent.ksql.parser.tree.NodeLocation in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatFunctionCallWithWindow.
@Test
public void shouldFormatFunctionCallWithWindow() {
final FunctionCall functionCall = new FunctionCall(new NodeLocation(1, 1), QualifiedName.of("function"), Optional.of(new Window("window", new WindowExpression("blah", new TumblingWindowExpression(1L, TimeUnit.SECONDS)))), false, Collections.singletonList(new StringLiteral("name")));
assertThat(ExpressionFormatter.formatExpression(functionCall), equalTo("function('name') OVER WINDOW WINDOW blah TUMBLING ( SIZE 1 SECONDS ) "));
}
Aggregations