[
https://issues.apache.org/jira/browse/CALCITE-6293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867043#comment-17867043
]
Tim Grein edited comment on CALCITE-6293 at 7/18/24 4:08 PM:
-------------------------------------------------------------
Hi,
I've started to look into supporting OR and I'm making fairly good progress and
things seem to work. One question I've is, if I can make _any_ assumptions
around the sql query when it arrives at the adapter (I guess it went through
some optimization passes?). Especially, when it comes to predicates in the
_where_ clause. Will those always be in DNF (Disjunctive Normal Form)? I'm
fairly new to the database internals world, but looking at other adapter
implementations it looks like the first step is to always decompose on
disjunctions, which in my head implies DNF.
Thank you!
was (Author: JIRAUSER306177):
Hi,
I've started to look into supporting OR and I'm making fairly good progress and
things seem to work. One question I've is, if I can make _any_ assumptions
around the sql query, especially when it comes to predicates in the _where_
clause. Will those always be in DNF (Disjunctive Normal Form)? I'm fairly new
to the database internals world, but looking at other adapter implementations
it looks like the first step is to always decompose on disjunctions, which in
my head implies DNF.
Thank you!
> 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)