Search in sources :

Example 1 with TimeLiteral

use of io.prestosql.sql.tree.TimeLiteral in project hetu-core by openlookeng.

the class TestSqlParser method testLiterals.

@Test
public void testLiterals() {
    assertExpression("TIME" + " 'abc'", new TimeLiteral("abc"));
    assertExpression("TIMESTAMP" + " 'abc'", new TimestampLiteral("abc"));
    assertExpression("INTERVAL '33' day", new IntervalLiteral("33", Sign.POSITIVE, IntervalField.DAY, Optional.empty()));
    assertExpression("INTERVAL '33' day to second", new IntervalLiteral("33", Sign.POSITIVE, IntervalField.DAY, Optional.of(IntervalField.SECOND)));
    assertExpression("CHAR 'abc'", new CharLiteral("abc"));
}
Also used : IntervalLiteral(io.prestosql.sql.tree.IntervalLiteral) TimestampLiteral(io.prestosql.sql.tree.TimestampLiteral) CharLiteral(io.prestosql.sql.tree.CharLiteral) TimeLiteral(io.prestosql.sql.tree.TimeLiteral) Test(org.testng.annotations.Test)

Aggregations

CharLiteral (io.prestosql.sql.tree.CharLiteral)1 IntervalLiteral (io.prestosql.sql.tree.IntervalLiteral)1 TimeLiteral (io.prestosql.sql.tree.TimeLiteral)1 TimestampLiteral (io.prestosql.sql.tree.TimestampLiteral)1 Test (org.testng.annotations.Test)1