use of io.trino.sql.tree.SetTimeZone in project trino by trinodb.
the class TestSetTimeZoneTask method testSetTimeZoneStringLiteral.
@Test
public void testSetTimeZoneStringLiteral() {
QueryStateMachine stateMachine = createQueryStateMachine("SET TIME ZONE 'America/Los_Angeles'");
SetTimeZone setTimeZone = new SetTimeZone(new NodeLocation(1, 1), Optional.of(new StringLiteral("America/Los_Angeles")));
executeSetTimeZone(setTimeZone, stateMachine);
Map<String, String> setSessionProperties = stateMachine.getSetSessionProperties();
assertThat(setSessionProperties).hasSize(1);
assertEquals(setSessionProperties.get(TIME_ZONE_ID), "America/Los_Angeles");
}
use of io.trino.sql.tree.SetTimeZone in project trino by trinodb.
the class TestSetTimeZoneTask method testSetTimeIntervalLiteralZoneHourToMinute.
@Test
public void testSetTimeIntervalLiteralZoneHourToMinute() {
QueryStateMachine stateMachine = createQueryStateMachine("SET TIME ZONE INTERVAL -'08:00' HOUR TO MINUTE");
SetTimeZone setTimeZone = new SetTimeZone(new NodeLocation(1, 1), Optional.of(new IntervalLiteral("8", NEGATIVE, HOUR, Optional.of(MINUTE))));
executeSetTimeZone(setTimeZone, stateMachine);
Map<String, String> setSessionProperties = stateMachine.getSetSessionProperties();
assertThat(setSessionProperties).hasSize(1);
assertEquals(setSessionProperties.get(TIME_ZONE_ID), "-08:00");
}
Aggregations