You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/29 17:36:55 UTC

[GitHub] [iceberg] lcspinter commented on a change in pull request #1607: Test out complex stuctures: MAP/LIST/STRUCT

lcspinter commented on a change in pull request #1607:
URL: https://github.com/apache/iceberg/pull/1607#discussion_r514444586



##########
File path: mr/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerBaseTest.java
##########
@@ -481,6 +482,287 @@ public void testCreateTableAboveExistingTable() throws TException, IOException,
     }
   }
 
+  @Test
+  public void testArrayOfPrimitivesInTable() throws IOException {
+    Schema schema =
+            new Schema(required(1, "arrayofprimitives", Types.ListType.ofRequired(2, Types.IntegerType.get())));
+    List<Record> records = createTableWithGeneratedRecords(schema, 1, 0L, "arraytable");
+    // access a single element from the array
+    for (int i = 0; i < records.size(); i++) {
+      List<?> expectedList = (List<?>) records.get(i).getField("arrayofprimitives");
+      for (int j = 0; j < expectedList.size(); j++) {
+        List<Object[]> queryResult = shell.executeStatement(
+                String.format("SELECT arrayofprimitives[%d] FROM default.arraytable " + "LIMIT 1 OFFSET %d", j, i));
+        Assert.assertEquals(expectedList.get(j), queryResult.get(0)[0]);
+      }
+    }
+    // drop test table
+    shell.executeStatement("DROP TABLE default.arraytable");

Review comment:
       @marton-bod Thanks for the review. I've removed all the drop statements. 




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org