flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wuchong <...@git.apache.org>
Subject [GitHub] flink pull request #3111: [FLINK-3475] [Table] DISTINCT aggregate function s...
Date Wed, 18 Jan 2017 06:09:17 GMT
Github user wuchong commented on a diff in the pull request:

    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/dataSet/FlinkAggregateExpandDistinctAggregatesRule.java
    @@ -0,0 +1,1144 @@
    + * 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.dataSet;
    +import org.apache.calcite.plan.Contexts;
    +import org.apache.calcite.plan.RelOptCluster;
    +import org.apache.calcite.plan.RelOptRule;
    +import org.apache.calcite.plan.RelOptRuleCall;
    +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.JoinRelType;
    +import org.apache.calcite.rel.core.RelFactories;
    +import org.apache.calcite.rel.logical.LogicalAggregate;
    +import org.apache.calcite.rel.type.RelDataType;
    +import org.apache.calcite.rel.type.RelDataTypeFactory;
    +import org.apache.calcite.rel.type.RelDataTypeField;
    +import org.apache.calcite.rex.RexBuilder;
    +import org.apache.calcite.rex.RexInputRef;
    +import org.apache.calcite.rex.RexNode;
    +import org.apache.calcite.sql.SqlAggFunction;
    +import org.apache.calcite.sql.fun.SqlCountAggFunction;
    +import org.apache.calcite.sql.fun.SqlMinMaxAggFunction;
    +import org.apache.calcite.sql.fun.SqlStdOperatorTable;
    +import org.apache.calcite.sql.fun.SqlSumAggFunction;
    +import org.apache.calcite.sql.fun.SqlSumEmptyIsZeroAggFunction;
    +import org.apache.calcite.sql.type.SqlTypeName;
    +import org.apache.calcite.tools.RelBuilder;
    +import org.apache.calcite.tools.RelBuilderFactory;
    +import org.apache.calcite.util.ImmutableBitSet;
    +import org.apache.calcite.util.ImmutableIntList;
    +import org.apache.calcite.util.Pair;
    +import org.apache.calcite.util.Util;
    +import com.google.common.base.Preconditions;
    +import com.google.common.collect.ImmutableList;
    +import com.google.common.collect.Iterables;
    +import com.google.common.collect.Lists;
    +import java.math.BigDecimal;
    +import java.util.ArrayList;
    +import java.util.HashMap;
    +import java.util.LinkedHashSet;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.SortedSet;
    +import java.util.TreeSet;
    + * Planner rule that expands distinct aggregates
    + * (such as {@code COUNT(DISTINCT x)}) from a
    + * {@link org.apache.calcite.rel.logical.LogicalAggregate}.
    + *
    + * <p>How this is done depends upon the arguments to the function. If all
    + * functions have the same argument
    + * (e.g. {@code COUNT(DISTINCT x), SUM(DISTINCT x)} both have the argument
    + * {@code x}) then one extra {@link org.apache.calcite.rel.core.Aggregate} is
    + * sufficient.
    + *
    + * <p>If there are multiple arguments
    + * (e.g. {@code COUNT(DISTINCT x), COUNT(DISTINCT y)})
    + * the rule creates separate {@code Aggregate}s and combines using a
    + * {@link org.apache.calcite.rel.core.Join}.
    + */
    +public final class FlinkAggregateExpandDistinctAggregatesRule extends RelOptRule {
    --- End diff --
    Thank you. That's fine to me.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message