Github user zuyu commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/217#discussion_r107980470 --- Diff: catalog/PartitionSchemeHeader.hpp --- @@ -288,22 +310,46 @@ class RangePartitionSchemeHeader : public PartitionSchemeHeader { * @brief Check if the partition range boundaries are in ascending order. **/ void checkPartitionRangeBoundaries() { + for (const PartitionValues &partition_range_boundary : partition_range_boundaries_) { + CHECK_EQ(partition_attribute_ids_.size(), partition_range_boundary.size()) + << "A partition boundary has different size than that of partition attributes."; + } + for (partition_id part_id = 1; part_id < partition_range_boundaries_.size(); ++part_id) { - if (less_unchecked_comparator_->compareTypedValues( - partition_range_boundaries_[part_id], - partition_range_boundaries_[part_id - 1])) { - LOG(FATAL) << "Partition boundaries are not in ascending order."; + CHECK(lessThan(partition_range_boundaries_[part_id - 1], partition_range_boundaries_[part_id])) + << "Partition boundaries are not in ascending order."; + } + } + + bool lessThan(const PartitionValues &lhs, const PartitionValues &rhs) const { + DCHECK_EQ(partition_attribute_ids_.size(), lhs.size()); + DCHECK_EQ(partition_attribute_ids_.size(), rhs.size()); + + for (std::size_t attr_index = 0; attr_index < partition_attribute_ids_.size(); ++attr_index) { + if (less_unchecked_comparators_[attr_index]->compareTypedValues(lhs[attr_index], rhs[attr_index])) { + break; --- End diff -- We use [lexicographical order](https://en.wikipedia.org/wiki/Lexicographical_order) here, `Given two different sequences of the same length, a1a2...ak and b1b2...bk, the first one is smaller than the second one for the lexicographical order, if ai<bi (for the order of A), for the first i where ai and bi differ.`
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---