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

Inconsistent parameter types for splittable agg function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • core

    Description

      The AggregateJoinTransposeRule rule often calls the SqlSplittableAggFunction#topSplit method to split the workload of a agg call. 

      This may involve generating a multiply operator (e.g. see https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/SqlSplittableAggFunction.java#L302)

      The problem is that the operands of the multiply can be different. For example, if the original agg call is a sum on double values, here we would multiply a double with a big integer. 

      This is undesirable, as the SqlStdOperatorTable#MULTIPLY uses InferTypes.FIRST_KNOWN to infer operand types. That is, it assumes all parameters have the same type, and it uses the first known type to infer other operand types. 

      In our system, it causes the sql processing to crash. 

      Attachments

        1. image-2020-10-10-10-36-50-697.png
          44 kB
          Liya Fan
        2. image-2020-10-10-10-34-37-193.png
          46 kB
          Liya Fan

        Issue Links

          Activity

            People

              fan_li_ya Liya Fan
              fan_li_ya Liya Fan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m