Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/20450#discussion_r164993656
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/vectorized/ColumnarBatchSuite.scala
---
@@ -761,6 +761,43 @@ class ColumnarBatchSuite extends SparkFunSuite {
}
}
+ test("Int Map") {
+ (MemoryMode.ON_HEAP :: MemoryMode.OFF_HEAP :: Nil).foreach { memMode =>
+ val column = allocate(10, new MapType(IntegerType, IntegerType,
false), memMode)
+ (0 to 1).foreach { colIndex =>
+ val data = column.getChild(colIndex)
+ (0 to 5).foreach {i =>
+ data.putInt(i, i * (colIndex + 1))
+ }
+ }
+
+ // Populate it with maps [0->0], [1->2, 2->4], [], [3->6, 4->8,
5->10]
+ column.putArray(0, 0, 1)
+ column.putArray(1, 1, 2)
+ column.putNull(2)
+ column.putArray(3, 2, 0)
--- End diff --
the key array is: 0, 1, 2, 3, 4, 5
the value array is: 0, 2, 4, 6, 8, 10
Not that, map `[1->2, 2->4]` contributes 2 keys and values.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]