Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/58#discussion_r71250248
  
    --- 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_) {
    +    const Type &type = argument->getType();
    +
    +    if (NativeColumnVector::UsableForType(type)) {
    +      argument_vecs.push_back(new NativeColumnVector(type, num_tuples));
    +    } else {
    +      argument_vecs.push_back(new IndirectColumnVector(type, num_tuples));
    +    }
    +  }
    +
    +  // TODO(Shixuan): Add Support for Vector Copy Elision Selection.
    +  // Add tuples and arguments into ColumnVectors.
    +  for (block_id block_idx : block_ids) {
    --- End diff --
    
    Add `const` for `block_idx`.


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

Reply via email to