0

I'm using Avatica calcite as a JDBC driver to query Druid DB. I found the 'IN' syntax CAN NOT followed by more than 19 elements. e.g

SELECT * FROM ds1 WHERE city_id IN 
    (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19) 

this works, but this one errors:

SELECT * FROM ds1 WHERE city_id IN 
    (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) 

how can I use the 'IN' syntax with more than 19 elements ?

Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49
rellocs wood
  • 1,381
  • 4
  • 21
  • 36

1 Answers1

1

The reason this doesn't work is described in https://github.com/druid-io/druid/issues/4203. It should be fixed in Druid SQL after Calcite 1.14 is released, which will let us customize its behavior a bit more.

Until then, try the workaround suggested by @melpomene, which should work:

SELECT * FROM ds1 WHERE
     city_id IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
  OR city_id IN (20,21,22)