Github user ppadma commented on a diff in the pull request:
https://github.com/apache/drill/pull/1218#discussion_r182729279
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/test/rowSet/test/TestHyperVectorReaders.java
---
@@ -362,4 +363,136 @@ public void testRepeatedMap() {
RowSetUtilities.verify(expected, hyperSet);
}
+
+ @Test
+ public void testUnion() {
+ TupleMetadata schema = new SchemaBuilder()
+ .add("a", MinorType.INT)
+ .addUnion("u")
+ .addType(MinorType.INT)
+ .addType(MinorType.VARCHAR)
+ .resumeSchema()
+ .buildSchema();
+
+ SingleRowSet rowSet1 = fixture.rowSetBuilder(schema)
+ .addRow(2, 20)
+ .addRow(4, "fourth")
+ .build();
+
+ SingleRowSet rowSet2 = fixture.rowSetBuilder(schema)
+ .addRow(1, "first")
+ .addRow(3, 30)
+ .build();
+
+ // Build the hyper batch
+
+ HyperRowSet hyperSet =
HyperRowSetImpl.fromRowSets(fixture.allocator(), rowSet1, rowSet2);
+ assertEquals(4, hyperSet.rowCount());
+ SelectionVector4 sv4 = hyperSet.getSv4();
+ sv4.set(0, 1, 0);
+ sv4.set(1, 0, 0);
--- End diff --
do we have to manually map each index like this ? may be we can do this in
the fromRowSets method itself ?
---