Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/9757#discussion_r45028150
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/RowEncoderSuite.scala
---
@@ -59,7 +61,12 @@ class ExamplePointUDT extends
UserDefinedType[ExamplePoint] {
override def deserialize(datum: Any): ExamplePoint = {
datum match {
case values: ArrayData =>
- new ExamplePoint(values.getDouble(0), values.getDouble(1))
+ if (values.numElements() > 1) {
+ new ExamplePoint(values.getDouble(0), values.getDouble(1))
+ } else {
+ val random = new Random()
+ new ExamplePoint(random.nextDouble(), random.nextDouble())
--- End diff --
We did check the results as we check input row and the row converted back.
Because this UDT `ExamplePoint` needs at least two double values. If the
array generated by the random generator contains only 1 or 0 elements.
`values.getDouble` will throw out of range exception.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]