[
https://issues.apache.org/jira/browse/DRILL-6546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16526982#comment-16526982
]
ASF GitHub Bot commented on DRILL-6546:
---------------------------------------
HanumathRao 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_r199027667
##########
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:
Can you also add multi unnest query to the testing. (something like this)
select u.item from cp.`lateraljoin/nested-customer.parquet` c,
unnest(c.orders.items) as u(item), unnest(c.orders.items) as u1(item1) limit 1
----------------------------------------------------------------
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:
[email protected]
> Allow unnest function with nested columns and complex expressions
> -----------------------------------------------------------------
>
> Key: DRILL-6546
> URL: https://issues.apache.org/jira/browse/DRILL-6546
> Project: Apache Drill
> Issue Type: Bug
> Reporter: Volodymyr Vysotskyi
> Assignee: Volodymyr Vysotskyi
> Priority: Major
> Fix For: 1.14.0
>
>
> Currently queries with unnest andĀ nested columnsĀ or complex expressions
> inside fails:
> {code:sql}
> select u.item from cp.`lateraljoin/nested-customer.parquet` c,
> unnest(c.orders.items) as u(item)
> {code}
> fails with error:
> {noformat}
> VALIDATION ERROR: From line 2, column 10 to line 2, column 21: Column
> 'orders.items' not found in table 'c'
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)