@Override
    public void onMatch(RelOptRuleCall call) {
      final Project project = call.rel(0);

      VbuilderPAP vb = buildProcessor(call);
      RelNode newProject = vb.processProject(project);

      if (newProject == project) {
        return;
      } else {
        call.transformTo(newProject);
      }
    }
Generic support for rewriting Windowing expression into a different form usually using joins.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRewriteToDataSketchesRules.java