You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Kramer, Ulrich" <u....@sap.com.INVALID> on 2021/07/13 06:18:41 UTC
Prepared Statements with setArray
Hi all,
we would like to use the IN operator with a single array/list argument.
SELECT … WHERE COL IN(?)
Avatica supports setting array parameters using
ps.setArray(1, ps.getConnection().createArrayOf("VARCHAR", new Object[]{"VAL1", "VAL2"}))
Unfortunately calcite optimizes the query to (when the column COL is of type VARCHAR)
SELECT … WHERE COL = (CAST ? AS VARCHAR)
which evaluates to
SELECT … WHERE COL = '[VAL1,VAL2]'
which will obviously return nothing.
Is there a way to fix this?
Kind Regards
Ulrich