yuanhang-dev commented on code in PR #9978:
URL: https://github.com/apache/incubator-gluten/pull/9978#discussion_r2148974803


##########
gluten-flink/runtime/src/main/java/org/apache/flink/streaming/runtime/translators/SourceTransformationTranslator.java:
##########
@@ -81,12 +82,29 @@ private Collection<Integer> translateInternal(
     final ExecutionConfig executionConfig = streamGraph.getExecutionConfig();
 
     // --- Begin Gluten-specific code changes ---
-    if 
(transformation.getSource().getClass().getSimpleName().equals("NexmarkSource")) 
{
+    Class<?> sourceClazz = transformation.getSource().getClass();
+    if (sourceClazz.getSimpleName().equals("NexmarkSource")) {
       RowType outputType =
           (RowType)
               LogicalTypeConverter.toVLType(
                   ((InternalTypeInfo) 
transformation.getOutputType()).toLogicalType());
       String id = PlanNodeIdGenerator.newId();
+      Object nexmarkSource = transformation.getSource();
+      List<?> nexmarkSourceSplits =
+          (List<?>)
+              ReflectUtils.invokeObjectMethod(
+                  sourceClazz,
+                  nexmarkSource,
+                  "getSplits",
+                  new Class<?>[] {Integer.class},
+                  new Object[] {transformation.getParallelism()});
+      Object nexmarkSourceSplit = nexmarkSourceSplits.get(0);
+      Object generatorConfig =
+          ReflectUtils.getObjectField(
+              nexmarkSourceSplit.getClass(), nexmarkSourceSplit, 
"generatorConfig");
+      Integer maxEvents =

Review Comment:
   When running nexmark q0, an exception will be thrown here. This feature can 
run nexmark q0 to ensure correctness.
   ```
   Caused by: java.lang.ClassCastException: class java.lang.Long cannot be cast 
to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module 
java.base of loader 'bootstrap')
        at 
org.apache.flink.streaming.runtime.translators.SourceTransformationTranslator.translateInternal(SourceTransformationTranslator.java:98)
 ~[gluten-flink-runtime-1.5.0-SNAPSHOT.jar:1.19.2]
        at 
org.apache.flink.streaming.runtime.translators.SourceTransformationTranslator.translateForStreamingInternal(SourceTransformationTranslator.java:69)
 ~[gluten-flink-runtime-1.5.0-SNAPSHOT.jar:1.19.2]
        at 
org.apache.flink.streaming.runtime.translators.SourceTransformationTranslator.translateForStreamingInternal(SourceTransformationTranslator.java:53)
 ~[gluten-flink-runtime-1.5.0-SNAPSHOT.jar:1.19.2]
        at 
org.apache.flink.streaming.api.graph.SimpleTransformationTranslator.translateForStreaming(SimpleTransformationTranslator.java:62)
 ~[flink-dist-1.19.2.jar:1.19.2]



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