Github user zuyu commented on a diff in the pull request:
    --- Diff: query_optimizer/rules/ReuseAggregateExpressions.cpp ---
    @@ -0,0 +1,349 @@
    + * 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
    + *
    + *
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + **/
    +#include "query_optimizer/rules/ReuseAggregateExpressions.hpp"
    +#include <cstddef>
    +#include <list>
    +#include <map>
    +#include <memory>
    +#include <unordered_map>
    +#include <vector>
    +#include "expressions/aggregation/AggregateFunction.hpp"
    +#include "expressions/aggregation/AggregateFunctionFactory.hpp"
    +#include "expressions/aggregation/AggregationID.hpp"
    +#include "query_optimizer/OptimizerContext.hpp"
    +#include "query_optimizer/expressions/AggregateFunction.hpp"
    +#include "query_optimizer/expressions/Alias.hpp"
    +#include "query_optimizer/expressions/AttributeReference.hpp"
    +#include "query_optimizer/expressions/BinaryExpression.hpp"
    +#include "query_optimizer/expressions/ExpressionType.hpp"
    +#include "query_optimizer/expressions/ExpressionUtil.hpp"
    +#include "query_optimizer/expressions/NamedExpression.hpp"
    +#include "query_optimizer/expressions/Scalar.hpp"
    +#include "query_optimizer/physical/Aggregate.hpp"
    +#include "query_optimizer/physical/PatternMatcher.hpp"
    +#include "query_optimizer/physical/Physical.hpp"
    +#include "query_optimizer/physical/PhysicalType.hpp"
    +#include "query_optimizer/physical/Selection.hpp"
    +#include "query_optimizer/physical/TopLevelPlan.hpp"
    +#include "types/operations/binary_operations/BinaryOperation.hpp"
    +#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
    +#include "types/operations/binary_operations/BinaryOperationID.hpp"
    +#include "utility/HashError.hpp"
    +#include "gflags/gflags.h"
    +#include "glog/logging.h"
    +namespace quickstep {
    +namespace optimizer {
    +DEFINE_uint64(reuse_aggregate_group_size_threshold, 1000u,
    +              "The threshold on estimated number of groups for an 
aggregation "
    +              "below which the ReuseAggregateExpressions optimization will 
be "
    +              "performed.");
    +DEFINE_double(reuse_aggregate_ratio_threshold, 0.3,
    +              "The threshold on the ratio of (# of eliminable columns) to "
    +              "(# of original columns) for an aggregation above which the "
    +              "ReuseAggregateExpressions optimization will be performed.");
    +namespace E = ::quickstep::optimizer::expressions;
    +namespace P = ::quickstep::optimizer::physical;
    +void ReuseAggregateExpressions::init(const P::PhysicalPtr &input) {
    +  DCHECK(input->getPhysicalType() == P::PhysicalType::kTopLevelPlan);
    --- End diff --
    Change to `DCHECK_EQ(P::PhysicalType::kTopLevelPlan, 
input->getPhysicalType());`, if not defined as an enum class.

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 or file a JIRA ticket
with INFRA.

Reply via email to