[ https://issues.apache.org/jira/browse/CALCITE-7002?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mihai Budiu resolved CALCITE-7002. ---------------------------------- Fix Version/s: 1.40.0 Resolution: Fixed Fixed in [https://github.com/apache/calcite/commit/6748fc8deed0e0a9185145f5ac55bbdc598f218d] Thank you for the contribution [~jensen] Thank you for the reviews [~asolimando] [~nobigo] > Create an optimization rule to eliminate UNION from the same source with > different filters > ------------------------------------------------------------------------------------------ > > Key: CALCITE-7002 > URL: https://issues.apache.org/jira/browse/CALCITE-7002 > Project: Calcite > Issue Type: Improvement > Components: core > Affects Versions: 1.39.0 > Reporter: Mihai Budiu > Assignee: Zhen Chen > Priority: Minor > Labels: pull-request-available > Fix For: 1.40.0 > > > The following query > {code:sql} > SELECT * FROM T WHERE p0 > UNION > SELECT * FROM T WHERE p1 > {code} > can be rewritten as > {code:sql} > SELECT * FROM T WHERE p0 OR p1 > {code} > This works if the the left and right filtered inputs are the same collection. > This should work even when p0 and p1 return 'true' for the same rows, because > UNION eliminates the duplicates. > A similar rule should work for INTERSECT using AND > -- This message was sent by Atlassian Jira (v8.20.10#820010)