Hi!
Some time ago, I implemented an implicit cast from string literals to
arrays [1]. However, this implementation has limitations. For instance, the
following query will not work:
select a.v = ARRAY[1,2] FROM UNNEST(ARRAY['{1,2}', '{3,4}']) as a(v);

Additionally, an implicit cast from arrays to strings has not been
implemented.

I began working on these things [2][3] and faced the issue that I have no
idea how to properly implement parsing of typed arrays using JavaCC. Here
are some examples:

SELECT TIMESTAMP ARRAY ''{"2000-07-20 20:17:40", "2001-07-20 20:17:40"}'
SELECT ARRAY[TIMESTAMP '2000-07-20 20:17:40', TIMESTAMP '2001-07-20
20:17:40'] || array '{"2000-07-20 20:17:40", "2001-07-20 20:17:40"}';

Does someone have an idea of the best way to implement this?

Thanks!

[1] https://issues.apache.org/jira/browse/CALCITE-5159
[2]
https://github.com/dssysolyatin/calcite/tree/feature/implicit-cast-betweeb
[3]
https://github.com/dssysolyatin/calcite/commit/bb41df3fbb1671e190633ed95f1684ada54603c1

Reply via email to