spark-test commented on code in PR #60313:
URL: https://github.com/apache/spark/pull/60313#discussion_r4532489440


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/runtime/RealTimeModeAllowlist.scala:
##########
@@ -64,6 +64,8 @@ object RealTimeModeAllowlist extends Logging {
     // exchange is a supported member of a pipelined group rather than a 
materialization barrier.
     "org.apache.spark.sql.execution.exchange.ShuffleExchangeExec",
     "org.apache.spark.sql.execution.joins.BroadcastHashJoinExec",
+    // Stateless, joins rows in its input's task, and keeps its input's 
determinism level.
+    "org.apache.spark.sql.execution.joins.ExternalLookupJoinExec",

Review Comment:
   **Non-blocking (P2):** With this entry, real-time mode runs the external 
lookup join, but `docs/streaming/real-time-mode.md` is unchanged and now 
misdescribes such queries. It says the trigger duration is primarily a 
checkpoint interval and that records never wait for a batch boundary (lines 
46-49, 66-70 and 163-168), and its Supported Queries list, which it calls the 
full list, allows stream-static joins only with a broadcast static side (lines 
352-354).
   
   From the evaluator's code, in real-time mode a lookup join holds a stream 
row until its request is full (the connector's request size, at most 1000 rows, 
or `spark.sql.join.externalLookup.maxBatchBytes`) or the batch ends, 5 minutes 
by default. A range lookup's request, which holds the rows of one key, also 
goes out when a row with another key arrives. A full request's output then 
waits for the partition's next stream row. The lookup cache, the table version 
and `current_timestamp()` last for the whole batch, so with the default 
`spark.sql.join.externalLookup.cache.ttl` of 0 a cached result can be served 
for all of it. A user who picks real-time mode for enrichment based on the 
guide learns none of this, nor how request size bounds the waits. Results stay 
correct, and micro-batch queries are unaffected.
   
   The earlier real-time enablements updated the guide in the same commit 
(transformWithState, dropDuplicatesWithinWatermark) or in a documentation 
commit two days later (streaming aggregation). So the update can go in this PR 
or in a documentation follow-up before the release that ships the lookup join. 
It would list the lookup join among the supported stream-static joins, beside 
the broadcast rule; name its waits wherever the guide says records never wait 
for a batch boundary; and state that the cache, the table version and the 
current time last for the batch, along with the settings that bound them.
   
   **Verification:**
   - **Inspection:** Reading the real-time mode guide, a user finds the 
external lookup join among the supported stream-static joins, and each 
statement that records never wait for a batch boundary either excludes the 
lookup join or points to its stated waits.
   - **Inspection:** The guide's account of the lookup join matches the 
operator when the guide lands: a request goes out when it is full, when a row 
with another key arrives for a range lookup, or when the batch ends; a full 
request's output waits for the next stream row exactly when the operator still 
probes its input before reading the results; and the cache lasts for the batch 
while the table version and the current time are fixed for it.



-- 
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