Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/22237#discussion_r223911893
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala
---
@@ -450,21 +456,24 @@ class JsonExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper with
test("from_json - input=array of single object, schema=struct,
output=single row") {
val input = """[{"a": 1}]"""
val schema = StructType(StructField("a", IntegerType) :: Nil)
- val output = InternalRow(1)
+ val output = InternalRow(null)
checkEvaluation(JsonToStructs(schema, Map.empty, Literal(input),
gmtId), output)
}
- test("from_json - input=array, schema=struct, output=null") {
+ test("from_json - input=array, schema=struct, output=single row") {
val input = """[{"a": 1}, {"a": 2}]"""
- val schema = StructType(StructField("a", IntegerType) :: Nil)
- val output = null
- checkEvaluation(JsonToStructs(schema, Map.empty, Literal(input),
gmtId), output)
+ val corrupted = "corrupted"
+ val schema = new StructType().add("a", IntegerType).add(corrupted,
StringType)
+ StructType(StructField("a", IntegerType) :: Nil)
--- End diff --
unnecessary line?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]