You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/04/16 12:16:34 UTC

[GitHub] [flink] twalthr commented on a change in pull request #8162: [FLINK-12174][table] Introduce FlinkAggregateExtractProjectRule and remove extractFieldReferences

twalthr commented on a change in pull request #8162: [FLINK-12174][table] Introduce FlinkAggregateExtractProjectRule and remove extractFieldReferences
URL: https://github.com/apache/flink/pull/8162#discussion_r275759835
 
 

 ##########
 File path: flink-table/flink-table-planner/src/main/java/org/apache/flink/table/plan/rules/logical/FlinkAggregateExtractProjectRule.java
 ##########
 @@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.plan.rules.logical;
+
+import org.apache.flink.table.expressions.ResolvedFieldReference;
+import org.apache.flink.table.plan.logical.LogicalWindow;
+import org.apache.flink.table.plan.logical.rel.LogicalWindowAggregate;
+
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelOptRuleOperand;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Aggregate;
+import org.apache.calcite.rel.core.AggregateCall;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.logical.LogicalAggregate;
+import org.apache.calcite.rel.rules.AggregateExtractProjectRule;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.tools.RelBuilder;
+import org.apache.calcite.tools.RelBuilderFactory;
+import org.apache.calcite.util.ImmutableBitSet;
+import org.apache.calcite.util.mapping.Mapping;
+import org.apache.calcite.util.mapping.MappingType;
+import org.apache.calcite.util.mapping.Mappings;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Rule to extract a {@link org.apache.calcite.rel.core.Project}
+ * from a {@link LogicalAggregate} or a {@link LogicalWindowAggregate}
+ * and push it down towards the input.
+ *
+ * <p>Note: Most of the logic in this rule is same with {@link AggregateExtractProjectRule}. The
+ * difference is this rule has also taken the {@link LogicalWindowAggregate} into consideration.
+ * Furthermore, this rule also creates trivial {@link Project}s unless the input node is already
+ * a {@link Project}.
+ */
+public class FlinkAggregateExtractProjectRule extends AggregateExtractProjectRule {
 
 Review comment:
   nit: Can we remove the "Flink" prefix? Every class in this repository could be prefixed with Flink, it does not add information. Maybe `ExtendedAggregateExtractProjectRule`?  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services