quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shixuan-fan <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #39: QUICKSTEP-20: Resolver support for Win...
Date Fri, 24 Jun 2016 15:36:45 GMT
Github user shixuan-fan commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/39#discussion_r68416644
  
    --- Diff: query_optimizer/expressions/WindowAggregateFunction.cpp ---
    @@ -0,0 +1,193 @@
    +/**
    + *   Copyright 2015 Pivotal Software, Inc.
    + *   Copyright 2016, Quickstep Research Group, Computer Sciences Department,
    + *     University of Wisconsin—Madison.
    + *
    + *   Licensed 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.
    + **/
    +
    +#include "query_optimizer/expressions/WindowAggregateFunction.hpp"
    +
    +#include <string>
    +#include <utility>
    +#include <vector>
    +
    +#include "expressions/aggregation/AggregateFunction.hpp"
    +#include "query_optimizer/expressions/AttributeReference.hpp"
    +#include "query_optimizer/expressions/Expression.hpp"
    +#include "query_optimizer/expressions/PatternMatcher.hpp"
    +#include "query_optimizer/expressions/Scalar.hpp"
    +#include "types/Type.hpp"
    +#include "utility/Cast.hpp"
    +
    +#include "glog/logging.h"
    +
    +namespace quickstep {
    +namespace optimizer {
    +namespace expressions {
    +
    +bool WindowAggregateFunction::isNullable() const {
    +  std::vector<const Type*> argument_types;
    +  for (const ScalarPtr &argument : arguments_) {
    +    argument_types.emplace_back(&argument->getValueType());
    +  }
    +
    +  const Type *return_type = window_aggregate_.resultTypeForArgumentTypes(argument_types);
    +  DCHECK(return_type != nullptr);
    +  return return_type->isNullable();
    +}
    +
    +const Type& WindowAggregateFunction::getValueType() const {
    +  std::vector<const Type*> argument_types;
    +  for (const ScalarPtr &argument : arguments_) {
    +    argument_types.emplace_back(&argument->getValueType());
    +  }
    +
    +  const Type *return_type = window_aggregate_.resultTypeForArgumentTypes(argument_types);
    +  DCHECK(return_type != nullptr);
    +  return *return_type;
    +}
    +
    +WindowAggregateFunctionPtr WindowAggregateFunction::Create(
    +    const ::quickstep::AggregateFunction &window_aggregate,
    +    const std::vector<ScalarPtr> &arguments,
    +    const WindowInfo window_info,
    +    const std::string window_name,
    --- End diff --
    
    Do you mean (window_aggregate and arguments) or (window_info and window_name)? The "above
two" is a little bit vague...


---
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.
---

Mime
View raw message