| 1 | #include "duckdb/execution/operator/join/physical_comparison_join.hpp" |
|---|---|
| 2 | |
| 3 | using namespace duckdb; |
| 4 | using namespace std; |
| 5 | |
| 6 | PhysicalComparisonJoin::PhysicalComparisonJoin(LogicalOperator &op, PhysicalOperatorType type, |
| 7 | vector<JoinCondition> conditions_, JoinType join_type) |
| 8 | : PhysicalJoin(op, type, join_type) { |
| 9 | conditions.resize(conditions_.size()); |
| 10 | // we reorder conditions so the ones with COMPARE_EQUAL occur first |
| 11 | idx_t equal_position = 0; |
| 12 | idx_t other_position = conditions_.size() - 1; |
| 13 | for (idx_t i = 0; i < conditions_.size(); i++) { |
| 14 | if (conditions_[i].comparison == ExpressionType::COMPARE_EQUAL) { |
| 15 | // COMPARE_EQUAL, move to the start |
| 16 | conditions[equal_position++] = std::move(conditions_[i]); |
| 17 | } else { |
| 18 | // other expression, move to the end |
| 19 | conditions[other_position--] = std::move(conditions_[i]); |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | string PhysicalComparisonJoin::ExtraRenderInformation() const { |
| 25 | string extra_info = JoinTypeToString(type) + "\n"; |
| 26 | for (auto &it : conditions) { |
| 27 | string op = ExpressionTypeToOperator(it.comparison); |
| 28 | extra_info += it.left->GetName() + op + it.right->GetName() + "\n"; |
| 29 | } |
| 30 | return extra_info; |
| 31 | } |
| 32 |