Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ object ScalaReflection extends ScalaReflection {
serializerFor(unwrapped, optType, newPath))
}

case t if t <:< localTypeOf[Seq[_]] =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some comment to the definedByConstructorParams case to explain it is sensitive to ordering, and why?

val TypeRef(_, _, Seq(elementType)) = t
toCatalystArray(inputObject, elementType)

case t if definedByConstructorParams(t) =>
val params = getConstructorParameters(t)
val nonNullOutput = CreateNamedStruct(params.flatMap { case (fieldName, fieldType) =>
Expand All @@ -524,10 +528,6 @@ object ScalaReflection extends ScalaReflection {
val TypeRef(_, _, Seq(elementType)) = t
toCatalystArray(inputObject, elementType)

case t if t <:< localTypeOf[Seq[_]] =>
val TypeRef(_, _, Seq(elementType)) = t
toCatalystArray(inputObject, elementType)

case t if t <:< localTypeOf[Map[_, _]] =>
val TypeRef(_, _, Seq(keyType, valueType)) = t

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2473,4 +2473,11 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
Row("r3c1x", "r3c2", "t1r3c3", "r3c2", "t1r3c3") :: Nil)
}
}

test("SPARK-15062") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should document the test case more than just the issue number

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to turn this into a unit test on scalareflection rather than an end-to-end test?

val dfComplicated = sparkContext.parallelize(
List((Map("1" -> "a"), List("b", "c")), (Map("2" -> "b"), List("d", "e")))).toDF
checkAnswer(dfComplicated, Row(Map("1" -> "a"), List("b", "c")) ::
Row(Map("2" -> "b"), List("d", "e")) :: Nil)
}
}