You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2025/10/14 08:42:00 UTC

[jira] [Commented] (CALCITE-7226) Convert IN to SEARCH in SqlToRelConverter

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

Stamatis Zampetakis commented on CALCITE-7226:
----------------------------------------------

Maybe we should make this transformation configurable to retain backwards compatibility and consumers that potentially don't want to deal with SEARCH.

> Convert IN to SEARCH in SqlToRelConverter
> -----------------------------------------
>
>                 Key: CALCITE-7226
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7226
>             Project: Calcite
>          Issue Type: Task
>          Components: core
>            Reporter: Stamatis Zampetakis
>            Priority: Major
>
> Currently, the SqlToRelConverter translates IN expressions to:
>  * a disjunctive expression (RexNode composed from OR operators)
>  * a join with inline table holding all values (Values+Join RelNodes)
> In CALCITE-4173, the SEARCH operator was introduced to represent many kind of range expressions and among those IN lists of constant values. The SEARCH representation is superior to both disjunctive expressions and joins with inline tables so it should be used whenever possible in SqlToRelConverter.
> RexSimplify is able to detect and collapse disjunctive expressions to SEARCH but if we can do this earlier, during sql-to-rel conversion, we could save the unnecessary perf overhead of the simplification and also somewhat satisfy use-cases that explicitly requested the addition of a specialized IN operator (e.g., CALCITE-2630). 



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