tkaymak opened a new pull request, #41902:
URL: https://github.com/apache/beam/pull/41902

   Part of #36841.
   
   The Spark 4 streaming translator now accepts side inputs over bounded 
PCollections, for stateless and stateful ParDo. A view is supported when every 
ancestor of its PCollection is bounded. The runner decides this from the 
pipeline, there is no new option. Before the streaming queries start, a batch 
pre pass translates the ancestry of these views with the batch translator and 
broadcasts the values, the same `SideInputValues` broadcast the batch runner 
uses. Transforms that feed nothing but a view are not translated in streaming, 
so they start no query. A side input over an unbounded PCollection is rejected 
before any Spark job runs and the message names the DoFn. `Combine.globally()` 
with defaults on an unbounded input keeps its message.
   
   The change to shared code is small. `PipelineTranslator` gets three hooks 
that do nothing in batch, `prepareSideInputs`, `shouldTranslate` and 
`precomputedSideInput`. The side input reader helper moves from 
`ParDoTranslatorBatch` to `SparkSideInputReader`. `SerializableCoder` is now 
registered with the Kryo `JavaSerializer`. The pre pass broadcasts views that 
batch never broadcast, and with `spark.kryo.registrationRequired` Kryo fails on 
the `Class` field of the coder for a user class. `SideInputValuesTest` has a 
row for it. `StringDelegateCoder` has the same field and is left as it is.
   
   The pre pass enters `Combine.Globally` with defaults and translates the 
inner `Combine.PerKey` with a `Void` key, which works since #41596.
   
   Not covered here. Side inputs over unbounded PCollections are rejected. A 
triggered side input is read once with its final content. A restart recomputes 
the view from the bounded source, the broadcast is not in the checkpoint. An 
ancestor shared by a view and the main input is computed twice, once in the pre 
pass and once in streaming, so its metrics double. A splittable DoFn in the 
ancestry of a view is rejected. Datasets cached by the pre pass are not 
unpersisted yet, tracked in #40243.
   
   The first commit removes seven stale `PAssertTest` exclusions. 
`PAssert.thatSingleton` does not use side inputs, the javadoc of 
`PCollectionSingletonAssert` says so, and the seven tests pass.
   
   The `UsesSideInputs` category is no longer excluded from the streaming 
ValidatesRunner suite. Six `CombineWithContext` tests, 
`testHotKeyCombineWithSideInputs` and 
`testGlobalCombineWithDefaultsAndTriggers` stay excluded by name. New cases in 
`StatelessParDoStreamingTest` and `StatefulParDoStreamingTest` cover an 
unbounded main input with a bounded map view, a bounded ancestor shared by a 
view and the main input, and a singleton view read by a stateful ParDo across 
micro batches. Locally the streaming suite runs 285 tests with 0 failures, 
master runs 213. The batch Structured Streaming suites run 311 tests on Spark 4 
and 311 on Spark 3 with 0 failures. The full `:runners:spark:4:test` runs 283 
tests and `:runners:spark:3:test` 252, both with 0 failures. Tests that assert 
through `PAssert.thatMap` compute the asserted PCollection in the pre pass, 
their streaming query is only the checker, among them `testCoGroupByKey` and 
`testCoGroupByKeyGetOnly`. The trigger files run both Valida
 tesRunner PostCommits here.
   


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

Reply via email to