juripetersen commented on code in PR #640:
URL: https://github.com/apache/incubator-wayang/pull/640#discussion_r2605530437


##########
wayang-platforms/wayang-spark/src/main/java/org/apache/wayang/spark/operators/SparkObjectFileSource.java:
##########
@@ -79,7 +87,22 @@ public Tuple<Collection<ExecutionLineageNode>, 
Collection<ChannelInstance>> eval
         RddChannel.Instance output = (RddChannel.Instance) outputs[0];
 
         final String actualInputPath = 
FileSystems.findActualSingleInputPath(sourcePath);
-        final JavaRDD<Object> rdd = 
sparkExecutor.sc.objectFile(actualInputPath);
+        final ObjectFileSerializationMode serializationMode = 
this.getSerializationMode();
+        if (serializationMode == 
ObjectFileSerializationMode.LEGACY_JAVA_SERIALIZATION) {
+            // Warning is emitted by ObjectFileSource#getSerializationMode.
+        }
+        final JavaPairRDD<NullWritable, BytesWritable> rawRdd =
+                sparkExecutor.sc.sequenceFile(actualInputPath, 
NullWritable.class, BytesWritable.class);
+        final Class<T> typeClass = this.getTypeClass();
+        final JavaRDD<Object> rdd = rawRdd.flatMap(tuple -> {
+            byte[] payload = Arrays.copyOf(tuple._2.getBytes(), 
tuple._2.getLength());
+            try {
+                List<Object> chunk = 
ObjectFileSerialization.deserializeChunk(payload, serializationMode, typeClass);

Review Comment:
   Could be simplified to 
   
   `return ObjectFileSerialization.deserializeChunk(payload, serializationMode, 
typeClass).iterator()`



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