mosche commented on code in PR #24288:
URL: https://github.com/apache/beam/pull/24288#discussion_r1037806111
##########
runners/spark/3/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/batch/ParDoTranslatorBatch.java:
##########
@@ -83,61 +86,74 @@
ClassTag.apply(Tuple2.class);
@Override
- public void translate(ParDo.MultiOutput<InputT, OutputT> transform, Context
cxt)
- throws IOException {
- String stepName = cxt.getCurrentTransform().getFullName();
-
- SparkCommonPipelineOptions opts =
cxt.getOptions().as(SparkCommonPipelineOptions.class);
- StorageLevel storageLevel =
StorageLevel.fromString(opts.getStorageLevel());
+ public boolean canTranslate(ParDo.MultiOutput<InputT, OutputT> transform) {
+ DoFn<InputT, OutputT> doFn = transform.getFn();
+ DoFnSignature signature = DoFnSignatures.signatureForDoFn(doFn);
- // Check for not supported advanced features
// TODO: add support of Splittable DoFn
- DoFn<InputT, OutputT> doFn = transform.getFn();
checkState(
- !DoFnSignatures.isSplittable(doFn),
+ !signature.processElement().isSplittable(),
"Not expected to directly translate splittable DoFn, should have been
overridden: %s",
doFn);
// TODO: add support of states and timers
checkState(
- !DoFnSignatures.isStateful(doFn), "States and timers are not supported
for the moment.");
+ !signature.usesState() && !signature.usesTimers(),
+ "States and timers are not supported for the moment.");
checkState(
- !DoFnSignatures.requiresTimeSortedInput(doFn),
+ signature.onWindowExpiration() == null, "onWindowExpiration is not
supported: %s", doFn);
+
+ checkState(
+ !signature.processElement().requiresTimeSortedInput(),
"@RequiresTimeSortedInput is not supported for the moment");
+
SparkSideInputReader.validateMaterializations(transform.getSideInputs().values());
+ return true;
Review Comment:
for ParDos yes 👍 false is used to tell the translator to not translate a
composite, but instead rather explode it further
--
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]