[ 
https://issues.apache.org/jira/browse/DRILL-6773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16640231#comment-16640231
 ] 

ASF GitHub Bot commented on DRILL-6773:
---------------------------------------

vdiravka commented on a change in pull request #1492: DRILL-6773: The renamed 
schema with aliases is not shown for queries on empty directories
URL: https://github.com/apache/drill/pull/1492#discussion_r223112293
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/StarColumnConverter.java
 ##########
 @@ -118,13 +118,23 @@ private Prel insertProjUnderScreenOrWriter(Prel prel, 
RelDataType origRowType, P
     RelDataType newRowType = 
RexUtil.createStructType(child.getCluster().getTypeFactory(),
         exprs, origRowType.getFieldNames(), null);
 
-    int fieldCount = prel.getRowType().isStruct()? 
prel.getRowType().getFieldCount():1;
+    int fieldCount = prel.getRowType().isStruct() ? 
prel.getRowType().getFieldCount() : 1;
 
     // Insert PUS/PUW : remove the prefix and keep the original field name.
-    if (fieldCount > 1) { // // no point in allowing duplicates if we only 
have one column
-      proj = new ProjectAllowDupPrel(child.getCluster(), child.getTraitSet(), 
child, exprs, newRowType);
+    if (fieldCount > 1) { // no point in allowing duplicates if we only have 
one column
+      proj = new ProjectAllowDupPrel(child.getCluster(),
+          child.getTraitSet(),
+          child,
+          exprs,
+          newRowType,
+          true);
 
 Review comment:
   Done

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


> The renamed schema with aliases is not shown for queries on empty directories
> -----------------------------------------------------------------------------
>
>                 Key: DRILL-6773
>                 URL: https://issues.apache.org/jira/browse/DRILL-6773
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.14.0
>            Reporter: Vitalii Diravka
>            Assignee: Vitalii Diravka
>            Priority: Critical
>             Fix For: 1.15.0
>
>
> The query is not working:
> {code:java}
> 0: jdbc:drill:zk=local> select WeekId, Product as ProductName from (select 
> CAST(`dir0` as INT) AS WeekId, Product from dfs.`/tmp/empty_dir`);
> +--+
> | |
> +--+
> +--+
> No rows selected (0.197 seconds)
> {code}
> but the following query without aliases works fine:
> {code:java}
> 0: jdbc:drill:zk=local> select WeekId, Product from (select CAST(`dir0` as 
> INT) AS WeekId, Product from dfs.`/tmp/empty_dir`);
> +---------+----------+
> | WeekId | Product |
> +---------+----------+
> +---------+----------+
> No rows selected (0.276 seconds)
> {code}
> [_outProj_|https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/ProjectPrel.java#L51]
>  for _ProjectPrel_ was introduced in DRILL-5546. It marks top level Projects, 
> which schema should be shown in result output.
>  _ProjectAllowDupPrel_ should have the same.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to