[GitHub] spark pull request #13632: [SPARK-15910][SQL] Check schema consistency when ...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/13632 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #13632: [SPARK-15910][SQL] Check schema consistency when ...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/13632#discussion_r66882860 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/Encoders.scala --- @@ -209,7 +209,12 @@ object Encoders { BoundReference(0, ObjectType(classOf[AnyRef]), nullable = true), kryo = useKryo)), deserializer = DecodeUsingSerializer[T]( - GetColumnByOrdinal(0, BinaryType), classTag[T], kryo = useKryo), + UpCast( --- End diff -- I think we can just use `Cast`. `Upcast` is mainly for some numeric check, e.g. long should not be casted to int. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #13632: [SPARK-15910][SQL] Check schema consistency when ...
Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/13632#discussion_r66831601 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/Encoders.scala --- @@ -209,7 +209,12 @@ object Encoders { BoundReference(0, ObjectType(classOf[AnyRef]), nullable = true), kryo = useKryo)), deserializer = DecodeUsingSerializer[T]( - GetColumnByOrdinal(0, BinaryType), classTag[T], kryo = useKryo), + UpCast( +GetColumnByOrdinal(0, BinaryType), +BinaryType, +Seq(s"root object (class: ${classOf[BinaryType]}, name: value}")), --- End diff -- maybe just `input object to be serialized`? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #13632: [SPARK-15910][SQL] Check schema consistency when ...
GitHub user clockfly opened a pull request: https://github.com/apache/spark/pull/13632 [SPARK-15910][SQL] Check schema consistency when using Kryo encoder to convert DataFrame to Dataset ## What changes were proposed in this pull request? This PR enforces schema check when converting DataFrame to Dataset using Kryo encoder. For example. **Before the change:** Schema is NOT checked when converting DataFrame to Dataset using kryo encoder. ``` scala> case class B(b: Int) scala> implicit val encoder = Encoders.kryo[B] scala> val df = Seq((1)).toDF("b") scala> val ds = df.as[B] // Schema compatibility is NOT checked ``` **After the change:** Report AnalysisException since the schema is NOT compatible. ``` scala> val ds = Seq((1)).toDF("b").as[B] org.apache.spark.sql.AnalysisException: cannot resolve 'CAST(`b` AS BINARY)' due to data type mismatch: cannot cast IntegerType to BinaryType; ... ``` ## How was this patch tested? Unit test. You can merge this pull request into a Git repository by running: $ git pull https://github.com/clockfly/spark spark-15910 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/13632.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #13632 commit 50bb48d6f2a59e2e88fe68699fceac308153e08a Author: Sean ZhongDate: 2016-06-13T04:01:57Z SPARK-15910: Check schema --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org