-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-46615][CONNECT] Support s.c.immutable.ArraySeq in ArrowDeserializers #44618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| val myUdf2 = udf((a: immutable.ArraySeq[Int]) => | ||
| immutable.ArraySeq.unsafeWrapArray[Int](a.appended(5).appended(6).toArray)) | ||
| immutable.ArraySeq.unsafeWrapArray[Int]((a :+ 5 :+ 6).toArray)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only fix the comment related issues of another PR: #44591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a follow up of #44591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this change to a separate pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| testImplicit(booleans) | ||
| testImplicit(booleans.toSeq) | ||
| testImplicit(booleans.toSeq)(newBooleanSeqEncoder) | ||
| testImplicit(immutable.ArraySeq.unsafeWrapArray(booleans)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can just
import org.apache.spark.util.ArrayImplicits._
at the file header, and then
testImplicit(booleans.toImmutableArraySeq)
testImplicit(shorts.toImmutableArraySeq)
...
| mutable.ArraySeq.make(array.asInstanceOf[Array[T]]) | ||
| } | ||
|
|
||
| def toImmutableArraySeq[T](array: AnyRef): immutable.ArraySeq[T] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Perhaps we can directly use the implicit conversion defined in ArrayImplicits instead of add this new function, which is now a more generic conversion way in Spark code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
|
||
| val myUdf2 = udf((a: immutable.ArraySeq[Int]) => | ||
| immutable.ArraySeq.unsafeWrapArray[Int](a.appended(5).appended(6).toArray)) | ||
| immutable.ArraySeq.unsafeWrapArray[Int]((a :+ 5 :+ 6).toArray)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a follow up of #44591
|
Merged into master for Spark 4.0. Thanks @panbingkun @srowen |
What changes were proposed in this pull request?
The pr aims to support s.c.immutable.ArraySeq as customCollectionCls in ArrowDeserializers.
Why are the changes needed?
Because s.c.immutable.ArraySeq is a commonly used type in Scala 2.13, we should support it.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Update existed UT (SQLImplicitsTestSuite).
Was this patch authored or co-authored using generative AI tooling?
No.