[ 
https://issues.apache.org/jira/browse/CALCITE-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15888829#comment-15888829
 ] 

Julian Hyde commented on CALCITE-1655:
--------------------------------------

[~ashutoshc], Sure, it's nice if we can generate sargs for Hive and Druid and 
other runtimes.

However, we can and should do that without adding IN and BETWEEN to Calcite's 
RexNode language. SqlKind.OR is used in 27 places, so that gives you an idea of 
the scope of adding support for IN. BETWEEN would be similar. I'd estimate that 
the patch would be 1000-2000 lines. And even then, things would keep breaking, 
because we've increased the surface area (e.g. someone writes a query with 
{{JOIN ... ON ... BETWEEN}} and we haven't tested all of the 23 rules that 
handle Join).

My suggestion is write a converter from RexNode that contains only (AND, OR, =, 
<=, etc.) to one that also includes scalar-IN and BETWEEN. It would happen in 
the Druid adapter just before Rel-to-JSON generation, performance impact 
negligible, and a straightforward coding task. Plus it will work for queries 
that were originally written using OR. 

> Add In filter to druid adapter.
> -------------------------------
>
>                 Key: CALCITE-1655
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1655
>             Project: Calcite
>          Issue Type: Bug
>          Components: druid
>            Reporter: slim bouguerra
>            Assignee: Julian Hyde
>
> The druid calcite adapter throw an exception when an IN filter is used.
> This happens only in hive because in calcite project the IN filter is 
> transformed to OR automatically. 
> Since this rule does not kick in HIVE and it is better to use the native IN 
> filter from druid instead having huge number of OR clauses i will send a 
> patch that adds the IN filter.  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to