Skip to content

Conversation

@MBkkt
Copy link
Collaborator

@MBkkt MBkkt commented Nov 14, 2025

Adjust how do we pushdown and place conjuncts (filter expressions/predicates) instead of generate join columns.
"join columns" is design decision with different flaws:

  1. it forces projection to be created right after join (so it can be project earlier than needed)
  2. join columns will be projected separately from expressions where they used (so it can be unnecessary columns and project operations)
  3. it requires to write code in each join method
  4. it's probably slower, because a lot of allocations in this algorithm (in query graph and plan enumeration)

@MBkkt MBkkt requested review from Copilot and mbasmanova November 14, 2025 02:24
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 14, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the join optimization strategy by removing the "join columns" approach in favor of pushing down filter conjuncts (predicates). The change eliminates unnecessary projections and simplifies the join implementation.

Key Changes:

  • Removed join column generation logic and replaced it with direct conjunct pushdown
  • Refactored extractNonInnerJoinEqualities to return the left table and handle both single-table and multi-table cases
  • Simplified join edge logic by removing leftColumns/rightColumns vectors and their associated expressions
  • Modified join placement to handle filter pushdown based on join optionality

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
axiom/optimizer/tests/JoinTest.cpp Updated test expectations to reflect new behavior where right joins convert to left joins and projections are removed
axiom/optimizer/tests/DerivedTablePrinterTest.cpp Fixed aggregate expression to use correct table reference (t3.y instead of dt1.y)
axiom/optimizer/tests/CMakeLists.txt Removed JoinTest.cpp from build configuration
axiom/optimizer/ToGraph.h Renamed translateJoin to addJoin and removed addJoinColumns helper method
axiom/optimizer/ToGraph.cpp Refactored join translation logic to use conjunct pushdown instead of join columns
axiom/optimizer/QueryGraph.h Removed join column vectors and simplified join edge logic with updated isInner/isNonCommutative checks
axiom/optimizer/QueryGraph.cpp Fixed typo ('outr' → 'outer'), cleaned up template usage, and updated function signatures
axiom/optimizer/PlanObject.h Added null pointer checks to PlanObjectSet methods
axiom/optimizer/Plan.cpp Removed join column expressions from downstream column tracking
axiom/optimizer/Optimization.h Renamed placeConjuncts parameter from allowNondeterministic to joinsPlaced
axiom/optimizer/Optimization.cpp Removed ProjectionBuilder and join column mapping logic, simplified join construction
axiom/optimizer/DerivedTable.cpp Added logic to prevent pushdown to optional sides of joins during conjunct distribution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MBkkt MBkkt force-pushed the mbkkt/fix-pushdown-conjuncts branch from 75534a6 to 11aa549 Compare November 14, 2025 02:34
FeatureGen.cpp
Genies.cpp
TestConnectorQueryTest.cpp
JoinTest.cpp
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is written twice in the current main

@MBkkt MBkkt force-pushed the mbkkt/fix-pushdown-conjuncts branch 13 times, most recently from 122373d to 4e2fcb5 Compare November 18, 2025 20:22
@MBkkt MBkkt force-pushed the mbkkt/fix-pushdown-conjuncts branch 2 times, most recently from ad336ee to 5b51a78 Compare November 27, 2025 17:02
@MBkkt MBkkt force-pushed the mbkkt/fix-pushdown-conjuncts branch from 5b51a78 to eefd583 Compare November 27, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant