aromanenko-dev commented on code in PR #24288:
URL: https://github.com/apache/beam/pull/24288#discussion_r1038134689


##########
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:
   Yes, I missed `@Override` there with this git diff representation since I 
thought it's related to `translate()` method .
   Then it's ok though still a bit confusing since it's not clear that it 
throws an exception without looking into the code.



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