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

Add MEASURE type and AGGREGATE aggregate function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.33.0
    • None

    Description

      In CALCITE-4496 we propose adding measures to SQL, and an "AS MEASURE" sub-clause to the SELECT clause so that you can define measures. This change is a first step in that direction: namely the ability to define the columns are measures and use validate queries that use measures.

      This change adds a MEASURE type, which is parameterized with the value type, so that in RelNode-and-RexNode-land a measure column whose value is of type INTEGER would have type MEASURE<INTEGER>. (In SqlNode-land its type would be INTEGER and we would tell that it was a measure by some other means.)

      This change also adds an aggregate function called AGGREGATE that evaluates measures in the current GROUP BY context. (You can think of this as letting the measures roll themselves up as only they know how. For example, if the sum_price measure is defined as SUM(price) then if I write AGGREGATE(sum_price) in my query it's as if I wrote SUM(price). But we also support measures that have more complex formulas.)

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 1h 20m
                  1h 20m