Calcite SQL does not recognize CONVERT_TIMEZONE in Apache Beam

Viewed 218

I'm running a simple Sql transform in my Beam pipeline:

SELECT CONVERT_TIMEZONE('America/New York', 'UTC',(TIMESTAMP '1970-01-01 00:00:00' + OriginalTZ * INTERVAL '1' SECOND)) as MyUTC FROM PCOLLECTION

But i get the error:

 No match found for function signature CONVERT_TIMEZONE(<CHARACTER>, <CHARACTER>, <TIMESTAMP>)

But according to the Calcite documentation, that's how the syntax is.

I'm using Apache Beam version 2.29. But it seems that the Calcite sql version within is an old version 2.20 from 2019.

How can I use the CONVERT_TIMEZONE in my Calcite sql?

2 Answers

Apache Beam is currently on Calcite SQL 1.20 while CONVERT_TIMEZONE was added to 1.21.

A workaround is to use a normal ParDo or Map to convert the timezone. If you are using Python, some examples: Python Timezone conversion.

Related