[
https://issues.apache.org/jira/browse/CALCITE-6197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu reassigned CALCITE-6197:
------------------------------
Assignee: Yu Xu
> TIME_SUB is unparsed incorrectly
> --------------------------------
>
> Key: CALCITE-6197
> URL: https://issues.apache.org/jira/browse/CALCITE-6197
> Project: Calcite
> Issue Type: Improvement
> Reporter: Tanner Clary
> Assignee: Yu Xu
> Priority: Major
>
> This {{RelToSqlConverterTest}} explains it:
> {code:java}
> @Test void testBigQueryTimeSubFunction() {
> String timeSub = "select time_sub(time '15:30:00', interval 2 hour)\n"
> + "from \"foodmart\".\"product\"\n";
> final String expectedTimeSub =
> "SELECT TIME_SUB(TIME '15:30:00', INTERVAL 2 HOUR)\n"
> + "FROM \"foodmart\".\"product\"";
>
> sql(timeSub).withBigQuery().withLibrary(SqlLibrary.BIG_QUERY).ok(expectedTimeSub);
> }
> {code}
> This fails with:
> {code:java}
> Expected: is "SELECT TIME_SUB(TIME '15:30:00', INTERVAL 2 HOUR)\nFROM
> \"foodmart\".\"product\""
> but: was "SELECT (TIME '15:30:00' - INTERVAL 1 HOUR * 2)\nFROM
> foodmart.product"
> {code}
> The other *_SUB() DATETIME functions seem to be working as intended so that
> should narrow down the problem. I will try to fix this when I have more time
> if someone doesn't beat me to it.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)