Whether we go into Calcite with IN/BETWEEN clauses, or we generate them via converter before generating the Druid JSON query, we need this fix, so I would suggest we check it in.
Concerning the IN/BETWEEN integration, it goes beyond the scope of the Druid adapter. As it is mentioned above, Hive has been sending calls to IN and BETWEEN to Calcite, which maybe it is preventing some optimizations from kicking in; we need to explore that.
My suggestion is write a converter from RexNode that contains only (AND, OR, =, <=, etc.) to one that also includes scalar-IN and BETWEEN.
In Hive, we already have such converter rule for IN clause, not for BETWEEN though. We are also missing the piece that would decompose IN/BETWEEN clauses into AND, OR, =, <=, etc.