villebro opened a new pull request, #2278:
URL: https://github.com/apache/datafusion-ballista/pull/2278

   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements and this helps us generate change logs for our releases. You can 
link an issue to this PR using the GitHub syntax. For example `Closes #123` 
indicates that this PR will close issue #123.
   -->
   
   Closes #1859.
   
   # Rationale for this change
   <!--
   Why are you proposing this change? If this is already explained clearly in 
the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your 
changes and offer better suggestions for fixes.
   -->
   
   On the adaptive (AQE) path, `AdaptivePlanner` carried the job *name* where 
it needed the job *id*. At the two spots that require a `JobId` — 
`handle_explain_plan` and `BallistaAdapter::adapt_to_ballista` (which builds 
shuffle-writer output paths) — it recovered one with `job_name.clone().into()`, 
flagged in the code as a probable bug:
   
   ```rust
   // Note: the signature requires a JobId, but we are passing a JobName. The 
below is a
   // dirty fix but this seems like a bug or a design flaw.
   let job_id: JobId = job_name.clone().into();
   ```
   
   Since `job_name` is frequently empty (e.g. `"job_name": ""` from the REST 
API), a job's shuffle output was keyed by an empty string instead of its 
`job_id`. Because the output path is `work_dir / job_id / stage_id / …`, that 
key is the per-job directory that isolates one job's shuffle files from 
another's — so every job with an empty name shared the same `work_dir/ 
/stage_id/…` tree and concurrent **jobs could collide on the same 
stage/partition paths**. The static planner was already correct.
   
   # What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is 
sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   `AdaptivePlanner` now holds `job_id: JobId` instead of `job_name: String`, 
and `AdaptiveExecutionGraph::try_new` passes the `job_id` it already has. The 
two `job_name.clone().into()` placeholders are gone.
   
   Tests: existing planner tests just pass a `JobId` (`.to_owned()` → 
`.into()`); `should_split_plan_into_stages` now asserts the resolved shuffle 
writer is keyed by the job id; and a new 
`newly_built_adaptive_graph_has_expected_state` — the first test to build an 
`AdaptiveExecutionGraph` — checks a fresh graph reflects its constructor 
arguments (using a distinct job id and job name) and starts as a running job 
with runnable tasks once revived.
   
   # Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   Under adaptive query planning, a job's shuffle output is now keyed by its 
`job_id` rather than its (frequently empty) `job_name`. No API or documentation 
changes.
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to