Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-26901

Add COUNTN aggregate to count only number values

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 5.5.0
    • 5.5.0
    • query

    Description

      COUNT (expr), COUNT( DISTINCT expr) counts when the expression IS NOT NULL or IS NOT MISSING.
      In json the types can be mixed and COUNT counts all of them
      SUM(expr), AVG(expr) adds only number values.

      If average is rewritten as AVG(expr) = SUM(expr)/COUNT(expr) the results will not match for mixed types.
      Introducing COUNTN(expr), COUNTN( DISTINCT expr) which does on number values so that AVG(expr) can be used as SUM(expr)/COUNTN(expr)
      This is needed for GROUP BY and aggregate pushdown . Same thing exposing to user also

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-26901
          # Subject Branch Project Status CR V

          Activity

            People

              korrigan.clark Korrigan Clark (Inactive)
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty