private final void addProjectedFields() {
        for (int i = 0; i < aggregate.getGroupCount(); i++) {
          newProjectsAbove.add(rexBuilder.makeInputRef(aggregate, i));
        }
        int numInputFields = aggregate.getInput().getRowType().getFieldCount();
        for (int i = 0; i < numInputFields; i++) {
          newProjectsBelow.add(rexBuilder.makeInputRef(aggregate.getInput(), i));
        }
      }
The new projections expressions inserted belove the aggregate

These projections could be used to prepocess the incoming datastream.
For example a CAST might need to be injected.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java