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

In RelBuilder, add a fluent API for building complex aggregate calls

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.18.0
    • Component/s: None
    • Labels:
      None

      Description

      In RelBuilder, add a fluent API for building complex aggregate calls. Currently, the RelBuilder.aggregateCall has arguments aggFunction, distinct, approximate, filter, orderKeys, alias and operands, and in CALCITE-2224 we're adding orderKeys. You have to specify all of them, whether or not your function is DISTINCT or has a FILTER(WHERE) clause.

      The new API would be simple:

      • RelBuilder.aggregateCall(op, operands)
      • RelBuilder.sum(operand)
      • RelBuilder.count(operands)
      • RelBuilder.min(operands)

      and so forth. Each of these returns an AggCall, and we propose to add fluent methods to that:

      • AggCall.distinct(boolean)
      • AggCall.approximate(boolean)
      • AggCall.alias(String)
      • AggCall.filter(RexNode)
      • AggCall.sort(RexNode...) (for CALCITE-2224)

      Thus you can write builder.sum(builder.field("SAL)).distinct(true).alias("SUM_SAL").

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: