@Test
public void testCastToSlice()
throws Exception
{
assertFunction("cast(INTERVAL '12 10:45:32.123' DAY TO SECOND as varchar)", "12 10:45:32.123");
assertFunction("cast(INTERVAL '12 10:45:32.123' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 10, 45, 32, 123).toString());
assertFunction("cast(INTERVAL '12 10:45:32.12' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 10, 45, 32, 120).toString());
assertFunction("cast(INTERVAL '12 10:45:32' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 10, 45, 32, 0).toString());
assertFunction("cast(INTERVAL '12 10:45' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 10, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '12 10' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12' DAY TO SECOND as varchar)", new SqlIntervalDayTime(12, 0, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12 10:45' DAY TO MINUTE as varchar)", new SqlIntervalDayTime(12, 10, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '12 10' DAY TO MINUTE as varchar)", new SqlIntervalDayTime(12, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12' DAY TO MINUTE as varchar)", new SqlIntervalDayTime(12, 0, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12 10' DAY TO HOUR as varchar)", new SqlIntervalDayTime(12, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12' DAY TO HOUR as varchar)", new SqlIntervalDayTime(12, 0, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '12' DAY as varchar)", new SqlIntervalDayTime(12, 0, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '10:45:32.123' HOUR TO SECOND as varchar)", new SqlIntervalDayTime(0, 10, 45, 32, 123).toString());
assertFunction("cast(INTERVAL '10:45:32.12' HOUR TO SECOND as varchar)", new SqlIntervalDayTime(0, 10, 45, 32, 120).toString());
assertFunction("cast(INTERVAL '10:45:32' HOUR TO SECOND as varchar)", new SqlIntervalDayTime(0, 10, 45, 32, 0).toString());
assertFunction("cast(INTERVAL '10:45' HOUR TO SECOND as varchar)", new SqlIntervalDayTime(0, 10, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '10' HOUR TO SECOND as varchar)", new SqlIntervalDayTime(0, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '10:45' HOUR TO MINUTE as varchar)", new SqlIntervalDayTime(0, 10, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '10' HOUR TO MINUTE as varchar)", new SqlIntervalDayTime(0, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '10' HOUR as varchar)", new SqlIntervalDayTime(0, 10, 0, 0, 0).toString());
assertFunction("cast(INTERVAL '45:32.123' MINUTE TO SECOND as varchar)", new SqlIntervalDayTime(0, 0, 45, 32, 123).toString());
assertFunction("cast(INTERVAL '45:32.12' MINUTE TO SECOND as varchar)", new SqlIntervalDayTime(0, 0, 45, 32, 120).toString());
assertFunction("cast(INTERVAL '45:32' MINUTE TO SECOND as varchar)", new SqlIntervalDayTime(0, 0, 45, 32, 0).toString());
assertFunction("cast(INTERVAL '45' MINUTE TO SECOND as varchar)", new SqlIntervalDayTime(0, 0, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '45' MINUTE as varchar)", new SqlIntervalDayTime(0, 0, 45, 0, 0).toString());
assertFunction("cast(INTERVAL '32.123' SECOND as varchar)", new SqlIntervalDayTime(0, 0, 0, 32, 123).toString());
assertFunction("cast(INTERVAL '32.12' SECOND as varchar)", new SqlIntervalDayTime(0, 0, 0, 32, 120).toString());
assertFunction("cast(INTERVAL '32' SECOND as varchar)", new SqlIntervalDayTime(0, 0, 0, 32, 0).toString());
}