Repository navigation
Java SDK: Choose one of several tasks with a branch - #74439
Merged
jason810496 merged 7 commits intoOct 9, 2026
Merged
Conversation
jason810496
added this pull request to stack #74441
October 8, 2026 05:01
This was referenced Oct 8, 2026
jason810496
removed this pull request from stack #74441
October 8, 2026 05:06
jason810496
added this pull request to stack #74442
October 8, 2026 05:06
jason810496
force-pushed
the
jason/java-sdk/native-dag-branch
branch
from
October 8, 2026 05:33
80beb7a to
bc81537
Compare
kaxil
reviewed
Oct 8, 2026
guan404ming
approved these changes
Oct 8, 2026
A condition picks between two tasks, but a Dag that routes work by size or by region needs more than two, and splitting that into nested conditions makes the graph unreadable. `DagDef.Branch` and `@Builder.Branch` declare a task that chooses one of the tasks listed with `option(...)`; every other one is skipped. The chosen task's ID becomes the branch's return value, as it does for Python's branch operators. A branch chooses exactly one case, so a task that runs after several of them needs a trigger rule such as `none_failed_min_one_success`. Each authoring style names the case in the way that style can type-check. A `BranchTask` returns the case's own class, so javac checks it; two cases that share a class are rejected where the second is named, since the branch could not tell them apart. A `@Builder.Branch` method has no such class to name -- a task method's implementation is generated -- so it returns a `TaskId` from the generated `<Dag>Builder.TaskIds`, which holds one constant per task of the Dag. Either way nothing hard-codes a task id string, and the generated holder is emitted only for a Dag that declares a branch.
jason810496
force-pushed
the
jason/java-sdk/native-dag-branch
branch
from
October 8, 2026 11:46
bc81537 to
e643f06
Compare
jason810496
marked this pull request as ready for review
October 8, 2026 13:00
jason810496
commented
Oct 8, 2026
jason810496
left a comment
Member
Author
There was a problem hiding this comment.
Thanks for the review.
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A condition picks between two tasks, but a Dag that routes work by size or by region needs more than two, and nesting conditions to get there makes the graph unreadable.
What changes
DagDef.Branchand@Builder.Branchdeclare a task that chooses one of the tasks listed withoption(...); every other one is skipped. Neither style hard-codes a task id string.EtlBuilder.TaskIdsholds one constant per task of the Dag and is generated only for a Dag that declares a branch.none_failed_min_one_success.Taskclass are rejected where the second is named: aBranchTaskcould not tell them apart.switchDag.Was generative AI tooling used to co-author this PR?