Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/18023#discussion_r126607036 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala --- @@ -922,59 +922,61 @@ class JsonSuite extends QueryTest with SharedSQLContext with TestJsonData { } test("Applying schemas with MapType") { - val schemaWithSimpleMap = StructType( - StructField("map", MapType(StringType, IntegerType, true), false) :: Nil) - val jsonWithSimpleMap = spark.read.schema(schemaWithSimpleMap).json(mapType1) + withSQLConf(SQLConf.SUPPORT_QUOTED_REGEX_COLUMN_NAME.key -> "false") { + val schemaWithSimpleMap = StructType( + StructField("map", MapType(StringType, IntegerType, true), false) :: Nil) + val jsonWithSimpleMap = spark.read.schema(schemaWithSimpleMap).json(mapType1) - jsonWithSimpleMap.createOrReplaceTempView("jsonWithSimpleMap") + jsonWithSimpleMap.createOrReplaceTempView("jsonWithSimpleMap") - checkAnswer( - sql("select `map` from jsonWithSimpleMap"), - Row(Map("a" -> 1)) :: - Row(Map("b" -> 2)) :: - Row(Map("c" -> 3)) :: - Row(Map("c" -> 1, "d" -> 4)) :: - Row(Map("e" -> null)) :: Nil - ) + checkAnswer( + sql("select `map` from jsonWithSimpleMap"), + Row(Map("a" -> 1)) :: + Row(Map("b" -> 2)) :: + Row(Map("c" -> 3)) :: + Row(Map("c" -> 1, "d" -> 4)) :: + Row(Map("e" -> null)) :: Nil + ) - checkAnswer( - sql("select `map`['c'] from jsonWithSimpleMap"), - Row(null) :: - Row(null) :: - Row(3) :: - Row(1) :: - Row(null) :: Nil - ) + checkAnswer( + sql("select `map`['c'] from jsonWithSimpleMap"), + Row(null) :: + Row(null) :: + Row(3) :: + Row(1) :: + Row(null) :: Nil + ) - val innerStruct = StructType( - StructField("field1", ArrayType(IntegerType, true), true) :: - StructField("field2", IntegerType, true) :: Nil) - val schemaWithComplexMap = StructType( - StructField("map", MapType(StringType, innerStruct, true), false) :: Nil) + val innerStruct = StructType( + StructField("field1", ArrayType(IntegerType, true), true) :: + StructField("field2", IntegerType, true) :: Nil) + val schemaWithComplexMap = StructType( + StructField("map", MapType(StringType, innerStruct, true), false) :: Nil) - val jsonWithComplexMap = spark.read.schema(schemaWithComplexMap).json(mapType2) + val jsonWithComplexMap = spark.read.schema(schemaWithComplexMap).json(mapType2) - jsonWithComplexMap.createOrReplaceTempView("jsonWithComplexMap") + jsonWithComplexMap.createOrReplaceTempView("jsonWithComplexMap") - checkAnswer( - sql("select `map` from jsonWithComplexMap"), - Row(Map("a" -> Row(Seq(1, 2, 3, null), null))) :: - Row(Map("b" -> Row(null, 2))) :: - Row(Map("c" -> Row(Seq(), 4))) :: - Row(Map("c" -> Row(null, 3), "d" -> Row(Seq(null), null))) :: - Row(Map("e" -> null)) :: - Row(Map("f" -> Row(null, null))) :: Nil - ) + checkAnswer( + sql("select `map` from jsonWithComplexMap"), + Row(Map("a" -> Row(Seq(1, 2, 3, null), null))) :: + Row(Map("b" -> Row(null, 2))) :: + Row(Map("c" -> Row(Seq(), 4))) :: + Row(Map("c" -> Row(null, 3), "d" -> Row(Seq(null), null))) :: + Row(Map("e" -> null)) :: + Row(Map("f" -> Row(null, null))) :: Nil + ) --- End diff -- Could you revert back all the unneeded changes?
--- 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