Skip to content

Commit fffe72b

Browse files
committed
Add test for struct as map key type
1 parent e67327a commit fffe72b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,23 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSparkSession
231231
}
232232
}
233233

234+
testStandardAndLegacyModes("nested map with struct as key type") {
235+
val data = (1 to 4).map { i =>
236+
Tuple1(
237+
Map(
238+
(i, s"kA_$i") -> s"vA_$i",
239+
(i, s"kB_$i") -> s"vB_$i"
240+
)
241+
)
242+
}
243+
withParquetDataFrame(data) { df =>
244+
// Structs are converted to `Row`s
245+
checkAnswer(df, data.map { case Tuple1(m) =>
246+
Row(m.map { case (k, v) => Row(k.productIterator.toSeq: _*) -> v })
247+
})
248+
}
249+
}
250+
234251
testStandardAndLegacyModes("nested map with struct as value type") {
235252
val data = (1 to 4).map { i =>
236253
Tuple1(

0 commit comments

Comments
 (0)