quickstep-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zuyu <...@git.apache.org>
Subject [GitHub] incubator-quickstep pull request #58: QUICKSTEP-20: Supported Window Aggrega...
Date Mon, 18 Jul 2016 23:33:57 GMT
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/58#discussion_r71250202
  
    --- Diff: storage/WindowAggregationOperationState.cpp ---
    @@ -176,4 +171,122 @@ bool WindowAggregationOperationState::ProtoIsValid(const serialization::WindowAg
       return true;
     }
     
    +void WindowAggregationOperationState::windowAggregateBlocks(
    +    InsertDestination *output_destination,
    +    const std::vector<block_id> &block_ids) {
    +  // TODO(Shixuan): This is a quick fix for currently unsupported functions in
    +  // order to pass the query_optimizer test.
    +  if (window_aggregation_handle_.get() == nullptr) {
    +    std::cout << "The function will be supported in the near future :)\n";
    +    return;
    +  }
    +
    +  // TODO(Shixuan): RANGE frame mode should be supported to make SQL grammar
    +  // work. This will need Order Key to be passed so that we know where the
    +  // window should start and end.
    +  if (!is_row_) {
    +    std::cout << "Currently we don't support RANGE frame mode :(\n";
    +    return;
    +  }
    +
    +  // Get the total number of tuples.
    +  int num_tuples = 0;
    +  for (block_id block_idx : block_ids) {
    +    num_tuples +=
    +        storage_manager_->getBlock(block_idx, input_relation_)->getNumTuples();
    +  }
    +
    +  // Construct column vectors for attributes.
    +  std::vector<ColumnVector*> attribute_vecs;
    +  for (std::size_t attr_id = 0; attr_id < input_relation_.size(); ++attr_id) {
    +    const CatalogAttribute *attr = input_relation_.getAttributeById(attr_id);
    +    const Type &type = attr->getType();
    +
    +    if (NativeColumnVector::UsableForType(type)) {
    +      attribute_vecs.push_back(new NativeColumnVector(type, num_tuples));
    +    } else {
    +      attribute_vecs.push_back(new IndirectColumnVector(type, num_tuples));
    +    }
    +  }
    +
    +  // Construct column vectors for arguments.
    +  std::vector<ColumnVector*> argument_vecs;
    +  for (std::unique_ptr<const Scalar> &argument : arguments_) {
    --- End diff --
    
    Add `const` for `std::unique_ptr<const Scalar> &argument`.


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