HanumathRao commented on a change in pull request #1417: DRILL-6645: Transform TopN in Lateral Unnest pipeline to Sort and Limit. URL: https://github.com/apache/drill/pull/1417#discussion_r207628609
########## File path: exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/LateralUnnestRowIDVisitor.java ########## @@ -43,7 +43,7 @@ public static Prel insertRowID(Prel prel){ public Prel visitPrel(Prel prel, Boolean isRightOfLateral) throws RuntimeException { List<RelNode> children = getChildren(prel, isRightOfLateral); if (isRightOfLateral) { - return prel.addImplicitRowIDCol(children); + return prel.getRelForLateralUnnestPipeline(children); } else { return (Prel) prel.copy(prel.getTraitSet(), children); Review comment: Here is the plan for the query. 00-00 Screen : rowType = RecordType(ANY c_name, ANY c_address, ANY order_id, ANY order_amt, ANY itemName, ANY itemNum): rowcount = 4.0, cumulative cost = {17.4 rows, 160.4 cpu, 0.0 io, 0.0 network, 1.0 memory}, id = 747 00-01 Project(c_name=[$0], c_address=[$1], order_id=[$2], order_amt=[$3], itemName=[$4], itemNum=[$5]) : rowType = RecordType(ANY c_name, ANY c_address, ANY order_id, ANY order_amt, ANY itemName, ANY itemNum): rowcount = 4.0, cumulative cost = {17.0 rows, 160.0 cpu, 0.0 io, 0.0 network, 1.0 memory}, id = 746 00-02 LateralJoin(correlation=[$cor2], joinType=[inner], requiredColumns=[{0}], column excluded from output: =[`orders`]) : rowType = RecordType(ANY c_name, ANY c_address, ANY order_id, ANY order_amt, ANY itemName, ANY itemNum): rowcount = 4.0, cumulative cost = {13.0 rows, 136.0 cpu, 0.0 io, 0.0 network, 1.0 memory}, id = 745 00-04 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=classpath:/lateraljoin/nested-customer.parquet]], selectionRoot=classpath:/lateraljoin/nested-customer.parquet, numFiles=1, numRowGroups=1, usedMetadataFile=false, columns=[`orders`, `c_name`, `c_address`]]]) : rowType = RecordType(ANY orders, ANY c_name, ANY c_address): rowcount = 4.0, cumulative cost = {4.0 rows, 12.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 741 00-03 Project($drill_implicit_field$=[$0], order_id=[ITEM($1, 'o_id')], order_amt=[ITEM($1, 'o_amount')], itemName=[$2], itemNum=[$3]) : rowType = RecordType(INTEGER $drill_implicit_field$, ANY order_id, ANY order_amt, ANY itemName, ANY itemNum): rowcount = 1.0, cumulative cost = {5.0 rows, 28.0 cpu, 0.0 io, 0.0 network, 1.0 memory}, id = 744 00-05 LateralJoin(correlation=[$cor1], joinType=[inner], requiredColumns=[{0}]) : rowType = RecordType(INTEGER $drill_implicit_field$, ANY orders, ANY item_name, ANY item_num): rowcount = 1.0, cumulative cost = {4.0 rows, 23.0 cpu, 0.0 io, 0.0 network, 1.0 memory}, id = 743 00-07 Unnest [srcOp=00-02] : rowType = RecordType(INTEGER $drill_implicit_field$, ANY orders): rowcount = 1.0, cumulative cost = {1.0 rows, 2.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 726 00-06 Project($drill_implicit_field$=[$0], item_name=[ITEM($1, 'i_name')], item_num=[ITEM($1, 'i_number')]) : rowType = RecordType(INTEGER $drill_implicit_field$, ANY item_name, ANY item_num): rowcount = 1.0, cumulative cost = {2.0 rows, 5.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 742 00-08 Unnest [srcOp=00-05] : rowType = RecordType(INTEGER $drill_implicit_field$, ANY orders): rowcount = 1.0, cumulative cost = {1.0 rows, 2.0 cpu, 0.0 io, 0.0 network, 0.0 memory}, id = 727 ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services