Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-2870

Fix return type of aggregate functions to be nullable

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0
    • Component/s: Execution - Data Types
    • Labels:
      None

      Description

      The output type of aggregate functions is required if the input is required which does not always hold true. Consider the case where input is a required type and we are performing sum(), however if all the rows are filtered out then we should return null instead of 0. This holds true for all aggregate functions (except count).

      As part of DRILL-2277 we are fixing the case when we have an aggregate function (without group by) and the input batch is empty we still need to produce one record with null as output (count function is an exception to this). If we don't fix the return type of aggregate functions then we will return wrong results in the case where we have an empty input with required columns.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mehant Mehant Baid
                Reporter:
                mehant Mehant Baid
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: