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 #217: QUICKSTEP-73: Multi-attribute Partiti...
Date Fri, 24 Mar 2017 18:09:05 GMT
Github user zuyu commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/217#discussion_r107966844
  
    --- Diff: catalog/PartitionSchemeHeader.cpp ---
    @@ -77,32 +95,44 @@ PartitionSchemeHeader* PartitionSchemeHeader::ReconstructFromProto(
           << "Attempted to create PartitionSchemeHeader from an invalid proto description:\n"
           << proto.DebugString();
     
    +  PartitionAttributeIds partition_attribute_ids;
    +  for (int i = 0; i < proto.partition_attribute_ids_size(); ++i) {
    +    partition_attribute_ids.push_back(proto.partition_attribute_ids(i));
    +  }
    +
       switch (proto.partition_type()) {
         case serialization::PartitionSchemeHeader::HASH: {
    -      return new HashPartitionSchemeHeader(proto.num_partitions(), proto.partition_attribute_id());
    +      return new HashPartitionSchemeHeader(proto.num_partitions(), move(partition_attribute_ids));
         }
         case serialization::PartitionSchemeHeader::RANGE: {
    -      const Type &attr_type =
    -          TypeFactory::ReconstructFromProto(proto.GetExtension(
    -              serialization::RangePartitionSchemeHeader::partition_attr_type));
    -
    -      std::vector<TypedValue> partition_ranges;
    -      for (int i = 0;
    -           i < proto.ExtensionSize(serialization::RangePartitionSchemeHeader::partition_range_boundaries);
    -           ++i) {
    -        partition_ranges.emplace_back(
    -            TypedValue::ReconstructFromProto(
    -                proto.GetExtension(serialization::RangePartitionSchemeHeader::partition_range_boundaries,
i)));
    +      std::vector<const Type*> attr_types;
    +      for (int i = 0; i < proto.ExtensionSize(serialization::RangePartitionSchemeHeader::partition_attr_types);
++i) {
    +        attr_types.push_back(&TypeFactory::ReconstructFromProto(
    +            proto.GetExtension(serialization::RangePartitionSchemeHeader::partition_attr_types,
i)));
    +      }
    +
    +      const int partition_ranges_size =
    +          proto.ExtensionSize(serialization::RangePartitionSchemeHeader::partition_range_boundaries);
    +      std::vector<PartitionValues> partition_ranges(partition_ranges_size);
    +      for (int i = 0; i < partition_ranges_size; ++i) {
    +        const auto &proto_partition_values =
    +            proto.GetExtension(serialization::RangePartitionSchemeHeader::partition_range_boundaries,
i);
    +        for (int j = 0; j < proto_partition_values.partition_values_size(); ++j) {
    +          partition_ranges[i].emplace_back(TypedValue::ReconstructFromProto(
    +              proto_partition_values.partition_values(j)));
    +        }
           }
     
    -      return new RangePartitionSchemeHeader(attr_type,
    -                                            proto.num_partitions(),
    -                                            proto.partition_attribute_id(),
    -                                            std::move(partition_ranges));
    +      return new RangePartitionSchemeHeader(proto.num_partitions(),
    +                                            move(partition_attribute_ids),
    +                                            move(attr_types),
    +                                            move(partition_ranges));
         }
         default:
           LOG(FATAL) << "Invalid partition scheme header.";
       }
    +
    +  return nullptr;
    --- End diff --
    
    In [Travis CI](https://travis-ci.org/apache/incubator-quickstep/jobs/212429450#L1226),
the compiler complains `-Werror=return-type` here.


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