use of io.prestosql.operator.scalar.FunctionAssertions in project hetu-core by openlookeng.
the class TestDateTimeOperators method testTimeRepresentationOnDate.
private static void testTimeRepresentationOnDate(DateTime date, String timeLiteral, Type expectedType, Object expected) {
Session localSession = testSessionBuilder().setTimeZoneKey(getTimeZoneKey("America/Los_Angeles")).setStartTime(date.getMillis()).build();
try (FunctionAssertions localAssertions = new FunctionAssertions(localSession)) {
localAssertions.assertFunction(timeLiteral, expectedType, expected);
localAssertions.assertFunctionString(timeLiteral, expectedType, valueFromLiteral(timeLiteral));
}
}
use of io.prestosql.operator.scalar.FunctionAssertions in project hetu-core by openlookeng.
the class TestExpressionCompiler method setupClass.
@BeforeClass
public void setupClass() {
Logging.initialize();
if (PARALLEL) {
executor = listeningDecorator(newFixedThreadPool(getRuntime().availableProcessors() * 2, daemonThreadsNamed("completer-%s")));
} else {
executor = newDirectExecutorService();
}
functionAssertions = new FunctionAssertions();
}
use of io.prestosql.operator.scalar.FunctionAssertions in project hetu-core by openlookeng.
the class TestTimeBase method testCastToTimeWithTimeZoneWithTZWithRulesChanged.
@Test
public void testCastToTimeWithTimeZoneWithTZWithRulesChanged() {
TimeZoneKey timeZoneThatChangedSince1970 = getTimeZoneKey("Asia/Kathmandu");
DateTimeZone dateTimeZoneThatChangedSince1970 = getDateTimeZone(timeZoneThatChangedSince1970);
Session session = Session.builder(this.session).setTimeZoneKey(timeZoneThatChangedSince1970).build();
try (FunctionAssertions localAssertions = new FunctionAssertions(session)) {
localAssertions.assertFunction("cast(TIME '03:04:05.321' as time with time zone)", TIME_WITH_TIME_ZONE, new SqlTimeWithTimeZone(new DateTime(1970, 1, 1, 3, 4, 5, 321, dateTimeZoneThatChangedSince1970).getMillis(), dateTimeZoneThatChangedSince1970.toTimeZone()));
}
}
Aggregations