[ 
https://issues.apache.org/jira/browse/HIVE-26817?focusedWorklogId=832044&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-832044
 ]

ASF GitHub Bot logged work on HIVE-26817:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Dec/22 13:09
            Start Date: 08/Dec/22 13:09
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on code in PR #3843:
URL: https://github.com/apache/hive/pull/3843#discussion_r1043335467


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveValues.java:
##########
@@ -43,4 +45,18 @@ public HiveValues(RelOptCluster cluster, RelDataType 
rowType, ImmutableList<Immu
   public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
     return new HiveValues(getCluster(), getRowType(), tuples, getTraitSet());
   }
+
+  public RelNode copy(List<String> newColumnNames) throws 
CalciteSemanticException {
+    if (newColumnNames.size() != getRowType().getFieldCount()) {
+      throw new CalciteSemanticException("The number of new column names and 
columns in the schema does not match!");
+    }
+
+    RelDataTypeFactory.Builder builder = 
getCluster().getTypeFactory().builder();

Review Comment:
   Refactored this to use `RelDataTypeFactory.Builder.uniquify()`. Thanks





Issue Time Tracking
-------------------

    Worklog Id:     (was: 832044)
    Time Spent: 0.5h  (was: 20m)

> Set column names in result schema when plan has Values root
> -----------------------------------------------------------
>
>                 Key: HIVE-26817
>                 URL: https://issues.apache.org/jira/browse/HIVE-26817
>             Project: Hive
>          Issue Type: Improvement
>          Components: CBO
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> The query
> {code}
> select b1, count(a1) count1 from (select a1, b1 from t1) s where 1=0 group by 
> b1;
> {code}
> should have a result with column names
> {code}
> b1    count1
> {code}
> but it is
> {code}
> $f0   $f1
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to