use of io.crate.sql.tree.IntervalLiteral in project crate by crate.
the class IntervalLiteralTest method testNegative.
@Test
public void testNegative() {
IntervalLiteral interval = (IntervalLiteral) SqlParser.createExpression("INTERVAL -'1' HOUR");
assertThat(interval.getValue(), is("1"));
assertThat(interval.getSign(), is(IntervalLiteral.Sign.MINUS));
assertThat(interval.getStartField(), is(IntervalLiteral.IntervalField.HOUR));
assertThat(interval.getEndField(), is(nullValue()));
}
use of io.crate.sql.tree.IntervalLiteral in project crate by crate.
the class IntervalLiteralTest method testTo.
@Test
public void testTo() {
IntervalLiteral interval = (IntervalLiteral) SqlParser.createExpression("INTERVAL '1' HOUR TO SECOND");
assertThat(interval.getValue(), is("1"));
assertThat(interval.getSign(), is(IntervalLiteral.Sign.PLUS));
assertThat(interval.getStartField(), is(IntervalLiteral.IntervalField.HOUR));
assertThat(interval.getEndField(), is(IntervalLiteral.IntervalField.SECOND));
}
use of io.crate.sql.tree.IntervalLiteral in project crate by crate.
the class IntervalLiteralTest method testMonth.
@Test
public void testMonth() {
IntervalLiteral interval = (IntervalLiteral) SqlParser.createExpression("INTERVAL +'1' MONTH");
assertThat(interval.getValue(), is("1"));
assertThat(interval.getSign(), is(IntervalLiteral.Sign.PLUS));
assertThat(interval.getStartField(), is(IntervalLiteral.IntervalField.MONTH));
assertThat(interval.getEndField(), is(nullValue()));
}
use of io.crate.sql.tree.IntervalLiteral in project crate by crate.
the class IntervalLiteralTest method testDay.
@Test
public void testDay() {
IntervalLiteral interval = (IntervalLiteral) SqlParser.createExpression("INTERVAL +'1' DAY");
assertThat(interval.getValue(), is("1"));
assertThat(interval.getSign(), is(IntervalLiteral.Sign.PLUS));
assertThat(interval.getStartField(), is(IntervalLiteral.IntervalField.DAY));
assertThat(interval.getEndField(), is(nullValue()));
}
Aggregations