[
https://issues.apache.org/jira/browse/SPARK-61454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ferdinand Xu updated SPARK-61454:
---------------------------------
Epic Name: Extend Real-Time Mode to Distributed Batch SQL and
DataFrame Queries
Shepherd: DB Tsai
Affects Version/s: 5.0.0
(was: 4.0.5)
Description:
*Description*
Spark’s Real-Time Mode (RTM) already supports pipelined shuffle across
executors for Structured Streaming. This umbrella tracks an opt-in extension to
read-only batch SQL and DataFrame queries. For an eligible shuffle exchange,
downstream tasks can begin consuming records while upstream tasks are still
producing them. Other exchanges remain materialized where required for
correctness, adaptive planning, or resource management.
*Milestones*
M1 — Minimal distributed batch pipeline. Add a default-off opt-in for a
single-consumer, hash-partitioned shuffle in a read-only batch SQL or DataFrame
query. Reuse the existing RTM transport and full-group admission policy to run
the producer and consumer stages across executors. Verify that a downstream
task consumes records before the final producer completes, that results match
ordinary batch execution, and that query-owned resources are released on
success, cancellation, and failure.
M2 — Planner rules for AQE decision costs. Track targeted rules for cases where
pipelining removes a useful materialization point or Spark performs work before
Adaptive Query Execution (AQE) has enough information to choose a plan. Initial
examples include deferring a large probe shuffle until the build size is known,
retaining a blocking exchange when its statistics can enable a broadcast join,
and starting a reused scalar aggregate alongside independent stages. Each rule
should identify its trigger, demonstrate the work or wait it saves, and include
a case where the benefit disappears. These rules can be evaluated under the
existing full-group gate.
M3 — Resident readers with rolling producers. Evaluate a shared RTM scheduling
enhancement for streaming and batch. Reserve capacity for the required readers
and a bounded window of producers, then admit additional producers as earlier
ones finish. The design should cover executor buffer limits, backpressure,
cancellation, and coexistence with ordinary batch work. The implementation test
is a group whose producer count exceeds cluster capacity and that completes in
bounded waves.
M4 — Reader resource rotation. Evaluate whether a waiting reader can yield
compute capacity, retain bounded execution state, and resume when input
arrives. This would allow groups whose reader count itself exceeds the
available slots. The required evidence is an observable sequence in which a
reader yields capacity, another task uses it, and the original reader resumes
safely.
SPIP design document
(https://docs.google.com/document/d/1sRHXxDeeO-bLazZpIuyH60I_DDtMn7iP9TsaNEHlf5w/edit)
was:
{{This SPIP proposes extending Spark's Real-Time Mode (RTM) execution
infrastructure to eligible distributed batch SQL and DataFrame queries.}}
{{The goal is to reduce query latency and improve completed-query throughput on
a fixed cluster for interactive and agentic workloads, such as retrieval,
feature generation, ranking, and analytical tool calls, while preserving exact
Spark SQL results and bounded resource use. }}{{The proposed execution path
allows downstream stages to consume intermediate data as it arrives across
eligible shuffle boundaries, overlapping producer computation, cross-executor
transfer, and consumer computation while avoiding unnecessary shuffle
materialization.}}
{{The proposal builds on RTM's existing connected-stage execution and
distributed transport, adding batch-specific plan selection, consumer-first
bounded admission, aggregate buffer accounting, and execution-attempt lifecycle
management.}}
{{This is an opt-in execution path, disabled by default. Materialized shuffle
remains the default, and unsupported plans and exchanges retain ordinary batch
execution. The initial scope targets shorter, read-only queries for which
restarting the whole query after a transient failure is acceptable; AQE
integration and automatic group retry are follow-up work.}}
{{Early prototype results include a 1.64x speedup on distributed TPC-H
scale-factor 10,000 Q3, with physical shuffle writes reduced by 95.6%. These
results are workload-specific; fixed-cluster concurrent-session latency and
throughput validation remain part of the proposed qualification work.}}
{{SPIP doc:
[https://docs.google.com/document/d/1sRHXxDeeO-bLazZpIuyH60I_DDtMn7iP9TsaNEHlf5w/edit?tab=t.0#heading=h.bbeudbgc60le]
}}
Summary: Extend Real-Time Mode to Distributed Batch SQL and
DataFrame Queries (was: SPIP: Extend Real-Time Mode to Distributed Batch SQL
and DataFrame Queries)
> Extend Real-Time Mode to Distributed Batch SQL and DataFrame Queries
> --------------------------------------------------------------------
>
> Key: SPARK-61454
> URL: https://issues.apache.org/jira/browse/SPARK-61454
> Project: Spark
> Issue Type: Epic
> Components: SQL
> Affects Versions: 5.0.0
> Reporter: Ferdinand Xu
> Priority: Major
>
> *Description*
> Spark’s Real-Time Mode (RTM) already supports pipelined shuffle across
> executors for Structured Streaming. This umbrella tracks an opt-in extension
> to read-only batch SQL and DataFrame queries. For an eligible shuffle
> exchange, downstream tasks can begin consuming records while upstream tasks
> are still producing them. Other exchanges remain materialized where required
> for correctness, adaptive planning, or resource management.
>
> *Milestones*
> M1 — Minimal distributed batch pipeline. Add a default-off opt-in for a
> single-consumer, hash-partitioned shuffle in a read-only batch SQL or
> DataFrame query. Reuse the existing RTM transport and full-group admission
> policy to run the producer and consumer stages across executors. Verify that
> a downstream task consumes records before the final producer completes, that
> results match ordinary batch execution, and that query-owned resources are
> released on success, cancellation, and failure.
> M2 — Planner rules for AQE decision costs. Track targeted rules for cases
> where pipelining removes a useful materialization point or Spark performs
> work before Adaptive Query Execution (AQE) has enough information to choose a
> plan. Initial examples include deferring a large probe shuffle until the
> build size is known, retaining a blocking exchange when its statistics can
> enable a broadcast join, and starting a reused scalar aggregate alongside
> independent stages. Each rule should identify its trigger, demonstrate the
> work or wait it saves, and include a case where the benefit disappears. These
> rules can be evaluated under the existing full-group gate.
> M3 — Resident readers with rolling producers. Evaluate a shared RTM
> scheduling enhancement for streaming and batch. Reserve capacity for the
> required readers and a bounded window of producers, then admit additional
> producers as earlier ones finish. The design should cover executor buffer
> limits, backpressure, cancellation, and coexistence with ordinary batch work.
> The implementation test is a group whose producer count exceeds cluster
> capacity and that completes in bounded waves.
> M4 — Reader resource rotation. Evaluate whether a waiting reader can yield
> compute capacity, retain bounded execution state, and resume when input
> arrives. This would allow groups whose reader count itself exceeds the
> available slots. The required evidence is an observable sequence in which a
> reader yields capacity, another task uses it, and the original reader resumes
> safely.
> SPIP design document
> (https://docs.google.com/document/d/1sRHXxDeeO-bLazZpIuyH60I_DDtMn7iP9TsaNEHlf5w/edit)
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]