Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Join Bridge Not Created for Any Join Node After First in Query Plan #11516

Open
yjshen opened this issue Nov 12, 2024 · 1 comment
Open
Labels
bug Something isn't working triage Newly created issue that needs attention.

Comments

@yjshen
Copy link

yjshen commented Nov 12, 2024

Bug description

When executing a query plan with multiple join nodes that require custom join bridges, only the first join node successfully creates a join bridge. All subsequent join nodes fail with the "Join bridge not found" error.

The issue occurs in Task.cpp:

void Task::addCustomJoinBridgesLocked(
    uint32_t splitGroupId,
    const std::vector<core::PlanNodePtr>& planNodes) {
  auto& splitGroupState = splitGroupStates_[splitGroupId];
  for (const auto& planNode : planNodes) {
    if (auto joinBridge = Operator::joinBridgeFromPlanNode(planNode)) {
      auto const inserted = splitGroupState.custom_bridges
                                .emplace(planNode->id(), std::move(joinBridge))
                                .second;
      VELOX_CHECK(
          inserted,
          "Join bridge for node {} is already present",
          planNode->id());
      return;  // <-- Bug: Early return after first join bridge
    }
  }
}

The early return statement causes the function to exit after processing the first join bridge, preventing the creation of bridges for subsequent joins.

Expected Behavior:

Join bridges should be created for all join nodes in the plan that require them, regardless of their position in the plan.

System information

I'm using an old version of Velox, but I checked the code for Task::addCustomJoinBridgesLocked, and it is unchanged.

Velox System Info v0.0.2
Commit: 5d315fb
CMake Version: 3.28.3
System: Linux-6.8.0-1017-gcp
Arch: x86_64
C++ Compiler: /usr/bin/c++
C++ Compiler Version: 11.4.0
C Compiler: /usr/bin/cc
C Compiler Version: 11.4.0
CMake Prefix Path: /usr/local;/usr;/;/usr/local/lib/python3.10/dist-packages/cmake/data;/usr/local;/usr/X11R6;/usr/pkg;/opt

Relevant logs

No response

@yjshen yjshen added bug Something isn't working triage Newly created issue that needs attention. labels Nov 12, 2024
@Yuhta
Copy link
Contributor

Yuhta commented Nov 12, 2024

Would you add a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Newly created issue that needs attention.
Projects
None yet
Development

No branches or pull requests

2 participants