Github user hbdeshmukh commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/181#discussion_r104573225 --- Diff: query_optimizer/ExecutionGenerator.cpp --- @@ -679,13 +688,72 @@ void ExecutionGenerator::convertFilterJoin(const P::FilterJoinPtr &physical_plan std::piecewise_construct, std::forward_as_tuple(physical_plan), std::forward_as_tuple(probe_relation_info->producer_operator_index, - probe_relation_info->relation)); + probe_relation_info->relation, + probe_relation_info->output_destination_index)); DCHECK(lip_filter_generator_ != nullptr); lip_filter_generator_->addFilterJoinInfo(physical_plan, build_filter_operator_index); } +namespace { + +bool areSamePartitionSchemeHeaders(const PartitionSchemeHeader &lhs_partition_header, + const CatalogRelationSchema &lhs_scheme, + const PartitionSchemeHeader &rhs_partition_header, + const CatalogRelationSchema &rhs_scheme) { + if (lhs_partition_header.getPartitionType() != rhs_partition_header.getPartitionType()) { + return false; + } + + if (lhs_partition_header.getNumPartitions() != rhs_partition_header.getNumPartitions()) { + return false; + } + + // Check whether the underlying types in CatalogAttribute are the same. + if (!lhs_scheme.getAttributeById(lhs_partition_header.getPartitionAttributeId())->getType().equals( + rhs_scheme.getAttributeById(rhs_partition_header.getPartitionAttributeId())->getType())) { + return false; + } + + switch (lhs_partition_header.getPartitionType()) { + case PartitionSchemeHeader::PartitionType::kHash: + return true; + case PartitionSchemeHeader::PartitionType::kRange: { + const vector<TypedValue> &lhs_ranges = + static_cast<const RangePartitionSchemeHeader&>(lhs_partition_header).getPartitionRangeBoundaries(); + const vector<TypedValue> &rhs_ranges = + static_cast<const RangePartitionSchemeHeader&>(rhs_partition_header).getPartitionRangeBoundaries(); + + return lhs_ranges == rhs_ranges; + } + } + + return false; +} + + +// Note that this method will be deprecated once the partition scheme header +// supports multiple partition attributes. +size_t chooseBestRepartitionAttributeIndex(const CatalogRelationStatistics &stats, + const vector<attribute_id> &join_attributes) { + size_t chose_attr_index = static_cast<size_t>(-1); --- End diff -- This would assign ``chose_attr_index`` the value of ``MAX_INT``. Why do we want that?
--- 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. ---