You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/22 14:24:51 UTC

[GitHub] cloud-fan commented on a change in pull request #23854: [SPARK-22000][SQL] Inject necessary casts when data type of columns and matching type of fields are not equal

cloud-fan commented on a change in pull request #23854: [SPARK-22000][SQL] Inject necessary casts when data type of columns and matching type of fields are not equal
URL: https://github.com/apache/spark/pull/23854#discussion_r259361581
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/JavaTypeInference.scala
 ##########
 @@ -235,9 +236,6 @@ object JavaTypeInference {
           path :: Nil,
           returnNullable = false)
 
-      case c if c == classOf[java.lang.String] =>
-        Invoke(path, "toString", ObjectType(classOf[String]))
 
 Review comment:
   > The sample code tried to bind IntegerType column to String field in Java bean
   
   In scala, we can also do this and Spark will add `Upcast`. e.g. `spark.range(1).as[String].collect` works fine.
   
   I did a quick search and `JavaTypeInference` has no `Upcast`. We should fix it and follow `ScalaReflection`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org