HyukjinKwon commented on a change in pull request #33672:
URL: https://github.com/apache/spark/pull/33672#discussion_r684865267
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
##########
@@ -2943,6 +2943,34 @@ class DataFrameSuite extends QueryTest
.withSequenceColumn("default_index").collect().map(_.getLong(0))
assert(ids.toSet === Range(0, 10).toSet)
}
+
+ test("SPARK-35320 DataFrame read in Json format should fail if the schema
provided " +
+ "by the user contains a MapType with a key type different of StringType") {
+
+ Seq((MapType(IntegerType, StringType), """{"1": "test"}"""),
+ (StructType(Seq(StructField("test", MapType(IntegerType, StringType)))),
+ """"test": {"1": "test"}"""),
+ (ArrayType(MapType(IntegerType, StringType)), """[{"1": "test"}]"""),
+ (MapType(StringType, MapType(IntegerType, StringType)), """{"key": {"1"
: "test"}}""")
Review comment:
```suggestion
Seq(
(MapType(IntegerType, StringType), """{"1": "test"}"""),
(StructType(Seq(StructField("test", MapType(IntegerType,
StringType)))),
""""test": {"1": "test"}"""),
(ArrayType(MapType(IntegerType, StringType)), """[{"1": "test"}]"""),
(MapType(StringType, MapType(IntegerType, StringType)), """{"key":
{"1" : "test"}}""")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]