Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4209

In RelBuilder, add an option to not simplify LIMIT 0 to an empty relation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.26.0
    • None

    Description

      When you call relBuilder.limit(0, 0) it triggers a call to RelBuilder.empty here.

      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.

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              swtalbot Steven Talbot
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m