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

Jesus Camacho Rodriguez commented on CALCITE-1777:
--------------------------------------------------

[~julianhyde], {{substring}} should not be pushed, as it is not part of the 
supported operators in _isValidFilter_.

[~bslim], in this specific case, translation was failing because 'false' is a 
constant and we are assuming that constants can be translated in every case, 
but actually we cannot translate them if they are at the top level of a 
predicate. This patch has fixed the 'false' constant issue, but if the constant 
is 'true' we will face the same problem (probably difficult to reproduce 
because a filter with condition 'true' will be removed from the operator tree 
by other rules). I expect a simple Filter condition CAST on a constant, if it 
is not folded by other rules, to fail too. IMO the right approach was to fix 
this in _isValidFilter_ to skip the pushdown translation in these cases, till 
we have a more robust unified logic like you propose above (which seems a 
better solution altogether).

> Druid adapter: "WHERE FALSE" causes AssertionError
> --------------------------------------------------
>
>                 Key: CALCITE-1777
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1777
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: slim bouguerra
>             Fix For: 1.13.0
>
>
> Query with "WHERE FALSE" gives AssertionError in Druid adapter.
> Originally logged as part of CALCITE-1775. Test case in {{DruidAdapterIT}}:
> {code}
>   @Test public void testSelectCountFalse() {
>     sql("select count(*) as c from \"foodmart\" where 1 < 0")
>         .returnsUnordered("C=0");
>   }
> {code}
> gives
> {noformat}
> java.lang.AssertionError: cannot translate filter: false
>       at 
> org.apache.calcite.adapter.druid.DruidQuery$Translator.translateFilter(DruidQuery.java:1067)
>       at 
> org.apache.calcite.adapter.druid.DruidQuery$Translator.access$000(DruidQuery.java:933)
>       at 
> org.apache.calcite.adapter.druid.DruidQuery.getQuery(DruidQuery.java:497)
>       at 
> org.apache.calcite.adapter.druid.DruidQuery.deriveQuerySpec(DruidQuery.java:470)
>       at 
> org.apache.calcite.adapter.druid.DruidQuery.getQuerySpec(DruidQuery.java:414)
>       at 
> org.apache.calcite.adapter.druid.DruidQuery.deriveRowType(DruidQuery.java:308)
>       at 
> org.apache.calcite.rel.AbstractRelNode.getRowType(AbstractRelNode.java:224)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:857)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:883)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:1769)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.transformTo(VolcanoRuleCall.java:135)
>       at 
> org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:225)
>       at 
> org.apache.calcite.adapter.druid.DruidRules$DruidFilterRule.onMatch(DruidRules.java:228)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:211)
> {noformat}



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

Reply via email to