Search in sources :

Example 1 with Extract

use of io.confluent.ksql.parser.tree.Extract in project ksql by confluentinc.

the class ExpressionFormatterTest method shouldFormatExtract.

@Test
public void shouldFormatExtract() {
    final String result = ExpressionFormatter.formatExpression(new Extract(new StringLiteral("17/12/2017"), Extract.Field.DAY));
    assertThat(result, equalTo("EXTRACT(DAY FROM '17/12/2017')"));
}
Also used : StringLiteral(io.confluent.ksql.parser.tree.StringLiteral) Extract(io.confluent.ksql.parser.tree.Extract) Test(org.junit.Test)

Aggregations

Extract (io.confluent.ksql.parser.tree.Extract)1 StringLiteral (io.confluent.ksql.parser.tree.StringLiteral)1 Test (org.junit.Test)1