You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/06/29 07:20:20 UTC

[GitHub] vvysotskyi commented on a change in pull request #1346: DRILL-6546: Allow unnest function with nested columns and complex expressions

vvysotskyi commented on a change in pull request #1346: DRILL-6546: Allow unnest function with nested columns and complex expressions
URL: https://github.com/apache/drill/pull/1346#discussion_r199072062
 
 

 ##########
 File path: exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/lateraljoin/TestE2EUnnestAndLateral.java
 ##########
 @@ -114,6 +115,57 @@ public void testMultiUnnestAtSameLevel() throws Exception {
     test(Sql);
   }
 
+  @Test
+  public void testUnnestWithItem() throws Exception {
+    String sql = "select u.item from\n" +
+        "cp.`lateraljoin/nested-customer.parquet` c," +
+        "unnest(c.orders['items']) as u(item)\n" +
+        "limit 1";
+
+    testBuilder()
+        .sqlQuery(sql)
+        .unOrdered()
+        .baselineColumns("item")
+        .baselineValues(
+            TestBuilder.mapOf("i_name", "paper towel",
+                "i_number", 2.0,
+                "i_supplier", "oregan"))
+        .go();
+  }
+
+  @Test
+  public void testUnnestWithFunctionCall() throws Exception {
+    String sql = "select u.ord.o_amount o_amount from\n" +
+        "cp.`lateraljoin/nested-customer.parquet` c," +
+        "unnest(convert_fromjson(convert_tojson(c.orders))) as u(ord)\n" +
+        "limit 1";
+
+    testBuilder()
+        .sqlQuery(sql)
+        .unOrdered()
+        .baselineColumns("o_amount")
+        .baselineValues(4.5)
+        .go();
+  }
+
+  @Test
+  public void testUnnestWithMap() throws Exception {
+    String sql = "select u.item from\n" +
 
 Review comment:
   Thanks, added `testMultiUnnestWithMap()` test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services