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

Prune empty parts of a query by exploiting stats/metadata

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.33.0
    • core

    Description

      Currently there is a collection of rules (i.e., PruneEmptyRules) which remove sections of a query plan when it does not produce any rows.

      At the moment, the removal requires an empty Values operator to be in the plan in order to take effect. However, there are cases where queries involve empty relations/tables and in that case we could remove parts of the plan as well.

      The information if a relation is empty or not can be derived from metadata. For example, we could check if the  RelMdMaxRowCount returns zero to derive that the relation is empty.

      Implementation wise there are various alternatives to consider:

      • modify the existing PruneEmptyRule to consider metadata;
      • add new pruning rules relying exclusively on metadata;
      • add new rules checking metadata and turning the empty relation to an empty Values which can then be handled by existing rules

      Attachments

        Issue Links

          Activity

            People

              hanu.ncr Hanumath Rao Maduri
              zabetak Stamatis Zampetakis
              Votes:
              0 Vote for this issue
              Watchers:
              7 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 - 2h 10m
                  2h 10m