Github user brkyvz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16929#discussion_r104278223
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala
 ---
    @@ -372,6 +372,58 @@ class JsonExpressionsSuite extends SparkFunSuite with 
ExpressionEvalHelper {
         )
       }
     
    +  test("from_json - array") {
    +    val schema = ArrayType(StructType(StructField("a", IntegerType) :: 
Nil))
    +
    +    // json array: `Array(Row(...), ...)`
    +    val jsonData1 = """[{"a": 1}, {"a": 2}]"""
    +    val expected =
    +      InternalRow.fromSeq(1 :: Nil) ::
    +      InternalRow.fromSeq(2 :: Nil) :: Nil
    +    checkEvaluation(JsonToStruct(
    +      schema, Map.empty, Literal(jsonData1), gmtId), expected)
    +
    +    // json object: `Array(Row(...))`
    +    val jsonData2 = """{"a": 1}"""
    --- End diff --
    
    I would make each example a separate test. This way it's easier to figure 
out what breaks later.
    
    e.g.
      1. `from_json - input=array, schema=array, output=array`
      2. `from_json - input=object, schema=array, output=array of single object`
      3. `from_json - input=empty json array, schema=array, output=empty array`
    ...



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to