[
https://issues.apache.org/jira/browse/CALCITE-4209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17189061#comment-17189061
]
Julian Hyde commented on CALCITE-4209:
--------------------------------------
See comments in {{RelBuilder.empty()}}. We thought of this case.
> 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
> Priority: Major
>
> 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)