You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/08/06 17:00:00 UTC

[jira] [Commented] (CALCITE-4155) Simplify IN expression of discrete values

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

Julian Hyde commented on CALCITE-4155:
--------------------------------------

Can you please review CALCITE-4159, which is closely related, and see if there is an elegant solution to both.

I agree that we should exploit the fact that certain data types are discrete. Also the fact that they have a limited set of values (e.g. BOOLEAN).

I think we should do this in the context of ORs, not require the IN structure to be intact. The underlying concept is interval sets (see e.g. Calcite's [IntegerIntervalSet|https://calcite.apache.org/javadocAggregate/org/apache/calcite/util/IntegerIntervalSet.html] and Guava's [RangeSet|https://guava.dev/releases/23.0/api/docs/com/google/common/collect/RangeSet.html]).

> Simplify IN expression of discrete values
> -----------------------------------------
>
>                 Key: CALCITE-4155
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4155
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Major
>
> For example, given expressions like
> {{a in (1, 2, 3, 4, 5)}}
> or
> {{a = 1 or a = 2 or a = 3 or a = 4 or a = 5}},
> we can simplify it to
> {{a >= 1 and a <= 5}}
> Such simplification reduces the number of value comparisons from 5 to 2. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)