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

Julian Hyde commented on CALCITE-6293:
--------------------------------------

We don't require DNF, for the reasons [~mbudiu] mentioned. In my experience, 
various normal/canonical forms may be good for particular tasks but no form is 
good for all purposes. 

Our assumptions about RexNodes (i.e. requirements we place on people handing us 
RexNodes) are very minimal, including that ANDs and ORs are flattened (that is, 
"a OR b OR c" is represented as "OR(a, b, c)" rather than "OR(a, OR(b, c))" or 
"OR(OR(a, b), c)") and that each argument to a function/operator is the exact 
type required by the operator (i.e. no implicit casts).

If you want the RexNode to be in a particular format, there are plenty of 
functions in RexUtil and RexSimplify to get it into that format. I don't 
recommend DNF or CNF. You should consider converting calls to SEARCH using Sarg 
literals (see CALCITE-4173). They are well suited for column formats like 
Arrow. Expressions like 'x IS NULL OR x IN (2, 3, 5, 8)' are very compact and 
efficient in Sarg form.

> Support OR condition in Arrow adapter
> -------------------------------------
>
>                 Key: CALCITE-6293
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6293
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: arrow-adapter
>            Reporter: hongyu guo
>            Assignee: Tim Grein
>            Priority: Major
>
> For example
> {code:java}
> String sql = "select \"intField\", \"stringField\"\n"
>     + "from arrowdata\n"
>     + "where \"intField\"=12 or \"stringField\"='12'"; {code}
> will throw an exception:
> {code:java}
> java.lang.AssertionError: cannot translate OR(=($0, 12), =($1, '12'))
>       at 
> org.apache.calcite.adapter.arrow.ArrowTranslator.translateMatch(ArrowTranslator.java:70)
>       at 
> org.apache.calcite.adapter.arrow.ArrowFilter.<init>(ArrowFilter.java:43)
>       at 
> org.apache.calcite.adapter.arrow.ArrowRules$ArrowFilterRule.convert(ArrowRules.java:97)
>       at 
> org.apache.calcite.adapter.arrow.ArrowRules$ArrowFilterRule.onMatch(ArrowRules.java:87)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to