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/09/21 22:47:00 UTC

[jira] [Resolved] (CALCITE-4209) In RelBuilder, add an option to not simplify LIMIT 0 to an empty relation

     [ https://issues.apache.org/jira/browse/CALCITE-4209?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Hyde resolved CALCITE-4209.
----------------------------------
    Fix Version/s: 1.26.0
       Resolution: Fixed

Fixed in [02904822|https://github.com/apache/calcite/commit/02904822bf987206c660e2afcdcb6e299d307094].

> In RelBuilder, add an option to not simplify LIMIT 0 to an empty relation
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-4209
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4209
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Steven Talbot
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.26.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When you call {{relBuilder.limit(0, 0)}} it triggers a call to {{RelBuilder.empty}} [here|https://github.com/apache/calcite/blob/88d18185e6177c9df587bdd23dd4049f59adc2e4/core/src/main/java/org/apache/calcite/tools/RelBuilder.java#L2531].
> This is fine as the default behavior, but for cases where we intend to convert the relational algebra to SQL and display it somewhere, it would be preferable to turn this behavior off, either as an extra flag to this method or a configuration parameter. The call to {{empty()}} often results in a VALUES or a select list of literal NULLs, which looks ugly and can confuse a user.
> Moreover, there are certain databases (like BigQuery) that can cheaply handle a LIMIT 0 query as a form of validation, and if we munge the query with '{{empty()}}' we lose the ability to validate its correctness by going to the DB.



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