You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Steven Talbot (Jira)" <ji...@apache.org> on 2020/09/01 16:28:00 UTC

[jira] [Created] (CALCITE-4209) RelBuilder: ability to avoid generating empty() on limit 0

Steven Talbot created CALCITE-4209:
--------------------------------------

             Summary: RelBuilder: ability to avoid generating empty() on limit 0
                 Key: CALCITE-4209
                 URL: https://issues.apache.org/jira/browse/CALCITE-4209
             Project: Calcite
          Issue Type: Improvement
            Reporter: Steven Talbot


When you call
{code:java}
relBuilder.limit(0, 0){code}
It triggers a call to RelBuilder.empty at [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)