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 2022/10/07 22:15:11 UTC
[GitHub] [spark] Amraneze opened a new pull request, #38154: [SPARK-40705] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Amraneze opened a new pull request, #38154:
URL: https://github.com/apache/spark/pull/38154
### What changes were proposed in this pull request?
I encountered an issue using Spark while reading JSON files based on a schema it throws every time an exception related to conversion of types.
>Note: This issue can be reproduced only with Scala `2.13`, I'm not having this issue with `2.12`
````
Failed to convert value ArraySeq(1, 2, 3) (class of class scala.collection.mutable.ArraySeq$ofRef}) with the type of ArrayType(StringType,true) to JSON.
java.lang.IllegalArgumentException: Failed to convert value ArraySeq(1, 2, 3) (class of class scala.collection.mutable.ArraySeq$ofRef}) with the type of ArrayType(StringType,true) to JSON.
````
If I add ArraySeq to the matching cases, the test that I added passed successfully

With the current code source, the test fails and we have this following error

### Why are the changes needed?
If the person is using Scala 2.13, they can't parse an array. Which means they need to fallback to 2.12 to keep the project functioning
### How was this patch tested?
I added a sample unit test for the case, but I can add more if you want to.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] Amraneze commented on a diff in pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
Amraneze commented on code in PR #38154:
URL: https://github.com/apache/spark/pull/38154#discussion_r990651105
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/RowTest.scala:
##########
@@ -29,8 +32,8 @@ class RowTest extends AnyFunSpec with Matchers {
val schema = StructType(
StructField("col1", StringType) ::
- StructField("col2", StringType) ::
- StructField("col3", IntegerType) :: Nil)
+ StructField("col2", StringType) ::
Review Comment:
Scalafmt formatted the file, should I revert the changes related to formatting the code ?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] Amraneze commented on a diff in pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
Amraneze commented on code in PR #38154:
URL: https://github.com/apache/spark/pull/38154#discussion_r990655814
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/RowTest.scala:
##########
@@ -29,8 +32,8 @@ class RowTest extends AnyFunSpec with Matchers {
val schema = StructType(
StructField("col1", StringType) ::
- StructField("col2", StringType) ::
- StructField("col3", IntegerType) :: Nil)
+ StructField("col2", StringType) ::
Review Comment:
I pushed a new commit with the revert of those changes
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen commented on a diff in pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
srowen commented on code in PR #38154:
URL: https://github.com/apache/spark/pull/38154#discussion_r990655063
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/RowTest.scala:
##########
@@ -29,8 +32,8 @@ class RowTest extends AnyFunSpec with Matchers {
val schema = StructType(
StructField("col1", StringType) ::
- StructField("col2", StringType) ::
- StructField("col3", IntegerType) :: Nil)
+ StructField("col2", StringType) ::
Review Comment:
Yeah revert all the formatting only changes please
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #38154: [SPARK-40705] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38154:
URL: https://github.com/apache/spark/pull/38154#issuecomment-1272199335
Can one of the admins verify this patch?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen closed pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
srowen closed pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
URL: https://github.com/apache/spark/pull/38154
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen commented on pull request #38154: [SPARK-40705][SQL] Handle case of using mutable array when converting Row to JSON for Scala 2.13
Posted by GitBox <gi...@apache.org>.
srowen commented on PR #38154:
URL: https://github.com/apache/spark/pull/38154#issuecomment-1273474375
Merged to master/3.3
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org