Hey folks,

Note:  using Phoenix 4.7 on CDH

I've got a table defined similar to this:
CREATE TABLE IF NOT EXISTS my_tbl (
  my_id BINARY NOT NULL PRIMARY KEY,
  name VARCHAR
) COMPRESSION='SNAPPY';

I am trying to create a prepared statement like:

val sqlString = "SELECT name from my_tbl where my_id in ?"

val pStmt = connection.prepareStatement(sqlString)

val myBinaryKeyArray: Array[B]

pStmt.setArray(4, connection.createArrayOf("BINARY ARRAY",
myBinaryKeyArray))


I have tried a number of variations of the sql data type (BINARY and BINARY
ARRAY... when I use
BINARY ARRAY I get the following error:
java.lang.ClassCastException: [B cannot be cast to
org.apache.phoenix.schema.types.PhoenixArray

If I use BINARY I get the error:
org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type
mismatch. BINARY and BINARY ARRAY for CUSTOMER_ID = ARRAY[[...]]

Am I doing something exceedingly dumb?  Is there maybe just not support for
this type of IN clause in a prepared statement like this?  I'll have a
variable number of items to use in the IN clause, and I'd like to not have
to inject N number of ? marks, and then juggle parameter indexes if I can
avoid it.

Thanks
David McNelis

Reply via email to