WweiL commented on code in PR #41129:
URL: https://github.com/apache/spark/pull/41129#discussion_r1205894156


##########
sql/core/src/main/scala/org/apache/spark/sql/streaming/DataStreamWriter.scala:
##########
@@ -451,13 +451,17 @@ final class DataStreamWriter[T] private[sql](ds: 
Dataset[T]) {
     foreachImplementation(writer.asInstanceOf[ForeachWriter[Any]])
   }
 
-  private[sql] def foreachImplementation(writer: ForeachWriter[Any]): 
DataStreamWriter[T] = {
+  private[sql] def foreachImplementation(writer: ForeachWriter[Any],
+      encoder: Either[ExpressionEncoder[Any], InternalRow => Any] = null): 
DataStreamWriter[T] = {

Review Comment:
   Confirmed, I make the encoder to be null and run the `int` code
   ```
   Caused by: java.lang.ClassCastException: 
org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema cannot be cast 
to java.lang.Integer
   ```
   
   This is because on the server, the ds is always df (Dataset[Row]), and 
therefore ds.expenc doesn't cast the row to Int, which the `process` method uses



##########
sql/core/src/main/scala/org/apache/spark/sql/streaming/DataStreamWriter.scala:
##########
@@ -451,13 +451,17 @@ final class DataStreamWriter[T] private[sql](ds: 
Dataset[T]) {
     foreachImplementation(writer.asInstanceOf[ForeachWriter[Any]])
   }
 
-  private[sql] def foreachImplementation(writer: ForeachWriter[Any]): 
DataStreamWriter[T] = {
+  private[sql] def foreachImplementation(writer: ForeachWriter[Any],
+      encoder: Either[ExpressionEncoder[Any], InternalRow => Any] = null): 
DataStreamWriter[T] = {

Review Comment:
   Confirmed, I make the encoder to be null and run the `int` code
   ```
   Caused by: java.lang.ClassCastException: 
org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema cannot be cast 
to java.lang.Integer
   ```
   
   This is because on the server, the ds is always df (Dataset[Row]), and 
therefore ds.expenc doesn't cast the row to Int, which the `process` method 
expects



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