You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/01/20 13:36:08 UTC

[GitHub] [hive] kasakrisz opened a new pull request #1892: HIVE-24664: Support column aliases in Values clause

kasakrisz opened a new pull request #1892:
URL: https://github.com/apache/hive/pull/1892


   ### What changes were proposed in this pull request?
   1. Declare a list in `IdentifiersParser` for storing aliases specified after expressions in the values clause first row. If no alias is specified generate one implicitly.
   2. Add methods to manipulate and query the list.
   3. Create a new `firstValueRowConstructor` from parser rule `valueRowConstructor` to parse the first and rest of the rows in a different way. Inline the brackets to these new rules like in `expressionsInParenthesis`
   4. Create `firstExpressionsWithAlias` and `moreExpressionsWithAlias` rules and call them from `firstValueRowConstructor`/`valueRowConstructor` rules based on the merge of existing rules: `expressionsNotInParenthesis` and `expressionPart`: since `isStruct` and `forceStruct` is always true when calling from `valueRowConstructor` keep only the  branch which is used when these two parameters are true in the new rules.
   5. Create parser rule `expressionWithAlias`. This rule handles expressions with and without alias and it stores the parsed/generated alias in a list mentioned in 1.
   6. Create parser rule `expressionWithStoredAlias` to parse a single expression without an alias explicitly specified but assign one from the stored ones.
   7. Rename the first parameter of parser rule `expressionPart`.
   
   ### Why are the changes needed?
   Support column aliases in Values clause. See jira or `values_alias.q` for example.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, but existing queries are not affected. With this patch users can define column aliases in the first row of Values clause. This type of alias definition is not supported in `INSERT INTO <table>[<column alias list>] VALUES([actual values])` statements.
   
   ### How was this patch tested?
   ```
   mvn test -Dtest=TestValuesClause -pl parser
   mvn test -Dtest.output.overwrite -DskipSparkTests -Dtest=TestMiniLlapLocalCliDriver -Dqfile=values.q,values_alias.q -pl itests/qtest -Pitests
   ```


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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] kasakrisz commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r566647559



##########
File path: itests/hive-blobstore/src/test/results/clientpositive/insert_into_dynamic_partitions.q.out
##########
@@ -100,7 +100,7 @@ STAGE PLANS:
             Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Select Operator
-              expressions: array(const struct(1,'101'),const struct(2,'202'),const struct(3,'303'),const struct(4,'404'),const struct(5,'505')) (type: array<struct<col1:int,col2:string>>)
+              expressions: array(named_struct('col1',1,'col2','101'),named_struct('col1',2,'col2','202'),named_struct('col1',3,'col2','303'),named_struct('col1',4,'col2','404'),named_struct('col1',5,'col2','505')) (type: array<struct<col1:int,col2:string>>)

Review comment:
       Added an alternative branch to parser rule `valuesTableConstructor`: if there are no alias in the values clause at all go on the old path




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] kasakrisz commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564604533



##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -151,11 +182,46 @@ expressionsNotInParenthesis[boolean isStruct, boolean forceStruct]
     -> {$more.tree}
     ;
 
-expressionPart[CommonTree t, boolean isStruct]
+expressionPart[CommonTree firstExprTree, boolean isStruct]
     :
     (COMMA expression)+
-    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
-    -> {$t} expression+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$firstExprTree} expression+)
+    -> {$firstExprTree} expression+
+    ;
+
+// Parses comma separated list of expressions with optionally specified aliases and store the aliases for further usage.
+// <expression> [<alias>] [, <expression> [<alias>]]
+firstExpressionsWithAlias
+@init { initAliases(); }
+    :
+    first=expression colAlias=identifier? (COMMA expressionWithAlias)*
+    -> {colAlias != null}? ^(TOK_FUNCTION Identifier["named_struct"] { adaptor.create(Identifier, addAlias($colAlias.tree.getText())) } {$first.tree} expressionWithAlias*)

Review comment:
       I changed the rule `valuesTableConstructor` by adding an alternative: if there are no aliases defined for any of the values let's parse the values clause in the lagacy way which transforms to array of structs.
   This seems to revert lots of the q.out files.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor merged pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor merged pull request #1892:
URL: https://github.com/apache/hive/pull/1892


   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] kasakrisz commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r569163684



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/type/RexNodeExprFactory.java
##########
@@ -1000,6 +1003,21 @@ protected FunctionInfo getFunctionInfo(String funcName) throws SemanticException
     return functionHelper.getFunctionInfo(funcName);
   }
 
+  @Override
+  protected RexNode replaceFieldNamesInStruct(RexNode expr, List<String> newFieldNames) {
+    if (newFieldNames.isEmpty()) {
+      return expr;
+    }
+
+    RexCall structCall = (RexCall) expr;
+    List<RexNode> newOperands = structCall.operands.stream()
+            .filter(rexNode -> "_UTF-16LE'tok_alias':VARCHAR(2147483647) CHARACTER SET \"UTF-16LE\"".compareTo(rexNode.toString()) != 0)

Review comment:
       It cannot be skipped because `TypeCheckProcFactory` uses `SemanticGraphWalker` which requires a return value other than `null` from `SemanticNodeProcessor.process`.
   I introduced a placeholder and filter it out when collecting the children of a function node.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564181657



##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -151,11 +182,46 @@ expressionsNotInParenthesis[boolean isStruct, boolean forceStruct]
     -> {$more.tree}
     ;
 
-expressionPart[CommonTree t, boolean isStruct]
+expressionPart[CommonTree firstExprTree, boolean isStruct]
     :
     (COMMA expression)+
-    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
-    -> {$t} expression+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$firstExprTree} expression+)
+    -> {$firstExprTree} expression+
+    ;
+
+// Parses comma separated list of expressions with optionally specified aliases and store the aliases for further usage.
+// <expression> [<alias>] [, <expression> [<alias>]]
+firstExpressionsWithAlias
+@init { initAliases(); }
+    :
+    first=expression colAlias=identifier? (COMMA expressionWithAlias)*
+    -> {colAlias != null}? ^(TOK_FUNCTION Identifier["named_struct"] { adaptor.create(Identifier, addAlias($colAlias.tree.getText())) } {$first.tree} expressionWithAlias*)

Review comment:
       Could we maybe identify this construct with a specific token? Would that help to identify later in the plan generation this case?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r568302310



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/type/RexNodeExprFactory.java
##########
@@ -1000,6 +1003,21 @@ protected FunctionInfo getFunctionInfo(String funcName) throws SemanticException
     return functionHelper.getFunctionInfo(funcName);
   }
 
+  @Override
+  protected RexNode replaceFieldNamesInStruct(RexNode expr, List<String> newFieldNames) {
+    if (newFieldNames.isEmpty()) {
+      return expr;
+    }
+
+    RexCall structCall = (RexCall) expr;
+    List<RexNode> newOperands = structCall.operands.stream()
+            .filter(rexNode -> "_UTF-16LE'tok_alias':VARCHAR(2147483647) CHARACTER SET \"UTF-16LE\"".compareTo(rexNode.toString()) != 0)

Review comment:
       Have you considered skipping the token in `TypeCheckProcFactory` rather than here? I think you could do that if it would not extend `StrExprProcessor`. If you cannot, maybe you can return a 'placeholder' object (static final) that you can identify easily with == ?
   I think that would simplify the implementation.
   Also note that tokens are not handled directly by the `ExprFactory` implementation.
   




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564009586



##########
File path: ql/src/test/results/clientpositive/llap/values.q.out
##########
@@ -10,7 +10,7 @@ POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
 Explain
 CBO PLAN:
-HiveTableFunctionScan(invocation=[inline(ARRAY(ROW(1, 2, 3), ROW(4, 5, 6)))], rowType=[RecordType(INTEGER col1, INTEGER col2, INTEGER col3)])

Review comment:
       Related to the previous comment, then this would not change (it's important it is recognized as ROW).




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] kasakrisz commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r566648716



##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -151,11 +182,46 @@ expressionsNotInParenthesis[boolean isStruct, boolean forceStruct]
     -> {$more.tree}
     ;
 
-expressionPart[CommonTree t, boolean isStruct]
+expressionPart[CommonTree firstExprTree, boolean isStruct]
     :
     (COMMA expression)+
-    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
-    -> {$t} expression+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$firstExprTree} expression+)
+    -> {$firstExprTree} expression+
+    ;
+
+// Parses comma separated list of expressions with optionally specified aliases and store the aliases for further usage.
+// <expression> [<alias>] [, <expression> [<alias>]]
+firstExpressionsWithAlias
+@init { initAliases(); }
+    :
+    first=expression colAlias=identifier? (COMMA expressionWithAlias)*
+    -> {colAlias != null}? ^(TOK_FUNCTION Identifier["named_struct"] { adaptor.create(Identifier, addAlias($colAlias.tree.getText())) } {$first.tree} expressionWithAlias*)

Review comment:
       I removed the `name_struct` approach and developed a different one using `struct` and a new toke to identify aliases. This required some additional functionality in the `TypeCheckProcFactory`




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r568302310



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/type/RexNodeExprFactory.java
##########
@@ -1000,6 +1003,21 @@ protected FunctionInfo getFunctionInfo(String funcName) throws SemanticException
     return functionHelper.getFunctionInfo(funcName);
   }
 
+  @Override
+  protected RexNode replaceFieldNamesInStruct(RexNode expr, List<String> newFieldNames) {
+    if (newFieldNames.isEmpty()) {
+      return expr;
+    }
+
+    RexCall structCall = (RexCall) expr;
+    List<RexNode> newOperands = structCall.operands.stream()
+            .filter(rexNode -> "_UTF-16LE'tok_alias':VARCHAR(2147483647) CHARACTER SET \"UTF-16LE\"".compareTo(rexNode.toString()) != 0)

Review comment:
       Have you considered skipping the token in `TypeCheckProcFactory` rather than here? I think you could do that if it would not extend `StrExprProcessor`. If you cannot, maybe you can return a 'placeholder' object (static final) that you can identify easily with == ?
   I think that would simplify the implementation.
   Also note that tokens are not handled directly by the `ExprFactory` implementation.
   




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564004991



##########
File path: itests/hive-blobstore/src/test/results/clientpositive/insert_into_dynamic_partitions.q.out
##########
@@ -100,7 +100,7 @@ STAGE PLANS:
             Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Select Operator
-              expressions: array(const struct(1,'101'),const struct(2,'202'),const struct(3,'303'),const struct(4,'404'),const struct(5,'505')) (type: array<struct<col1:int,col2:string>>)
+              expressions: array(named_struct('col1',1,'col2','101'),named_struct('col1',2,'col2','202'),named_struct('col1',3,'col2','303'),named_struct('col1',4,'col2','404'),named_struct('col1',5,'col2','505')) (type: array<struct<col1:int,col2:string>>)

Review comment:
       This should not change, i.e., it seems we are failing to recognize constant structs now. Iirc this is important because there are specific optimization on execution for some of these specific data structures (also for translation to other engines). The consolidation could possibly be done in constant folding (`ConstantPropagateProcFactory`) if the changes in the parser need to be done this way.

##########
File path: itests/hive-blobstore/src/test/results/clientpositive/insert_into_dynamic_partitions.q.out
##########
@@ -100,7 +100,7 @@ STAGE PLANS:
             Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Select Operator
-              expressions: array(const struct(1,'101'),const struct(2,'202'),const struct(3,'303'),const struct(4,'404'),const struct(5,'505')) (type: array<struct<col1:int,col2:string>>)
+              expressions: array(named_struct('col1',1,'col2','101'),named_struct('col1',2,'col2','202'),named_struct('col1',3,'col2','303'),named_struct('col1',4,'col2','404'),named_struct('col1',5,'col2','505')) (type: array<struct<col1:int,col2:string>>)

Review comment:
       This should not change, i.e., it seems we are failing to recognize constant structs now. Iirc this is important because there are specific optimization on execution for some of these specific data structures (also for translation to other engines). The consolidation could possibly be done when we are creating the Calcite plan?

##########
File path: ql/src/test/results/clientpositive/llap/values.q.out
##########
@@ -10,7 +10,7 @@ POSTHOOK: Input: _dummy_database@_dummy_table
 #### A masked pattern was here ####
 Explain
 CBO PLAN:
-HiveTableFunctionScan(invocation=[inline(ARRAY(ROW(1, 2, 3), ROW(4, 5, 6)))], rowType=[RecordType(INTEGER col1, INTEGER col2, INTEGER col3)])

Review comment:
       Related to the previous comment, then this would not change (it's important it is recognized as ROW).

##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -151,11 +182,46 @@ expressionsNotInParenthesis[boolean isStruct, boolean forceStruct]
     -> {$more.tree}
     ;
 
-expressionPart[CommonTree t, boolean isStruct]
+expressionPart[CommonTree firstExprTree, boolean isStruct]
     :
     (COMMA expression)+
-    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$t} expression+)
-    -> {$t} expression+
+    -> {isStruct}? ^(TOK_FUNCTION Identifier["struct"] {$firstExprTree} expression+)
+    -> {$firstExprTree} expression+
+    ;
+
+// Parses comma separated list of expressions with optionally specified aliases and store the aliases for further usage.
+// <expression> [<alias>] [, <expression> [<alias>]]
+firstExpressionsWithAlias
+@init { initAliases(); }
+    :
+    first=expression colAlias=identifier? (COMMA expressionWithAlias)*
+    -> {colAlias != null}? ^(TOK_FUNCTION Identifier["named_struct"] { adaptor.create(Identifier, addAlias($colAlias.tree.getText())) } {$first.tree} expressionWithAlias*)

Review comment:
       Could we maybe identify this construct with a specific token? Would that help to identify later in the plan generation this case?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor merged pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor merged pull request #1892:
URL: https://github.com/apache/hive/pull/1892


   


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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r569947228



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java
##########
@@ -1632,4 +1641,19 @@ public static String getFunctionText(ASTNode expr, boolean isFunction) {
     return BaseSemanticAnalyzer.unescapeIdentifier(funcText);
   }
 
+  private SemanticNodeProcessor getValueAliasProcessor() {
+    return new ValueAliasProcessor();
+  }
+
+  public static final Object ALIAS_PLACEHOLDER = new Object();

Review comment:
       Can we reduce the visibility of this object?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564004991



##########
File path: itests/hive-blobstore/src/test/results/clientpositive/insert_into_dynamic_partitions.q.out
##########
@@ -100,7 +100,7 @@ STAGE PLANS:
             Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Select Operator
-              expressions: array(const struct(1,'101'),const struct(2,'202'),const struct(3,'303'),const struct(4,'404'),const struct(5,'505')) (type: array<struct<col1:int,col2:string>>)
+              expressions: array(named_struct('col1',1,'col2','101'),named_struct('col1',2,'col2','202'),named_struct('col1',3,'col2','303'),named_struct('col1',4,'col2','404'),named_struct('col1',5,'col2','505')) (type: array<struct<col1:int,col2:string>>)

Review comment:
       This should not change, i.e., it seems we are failing to recognize constant structs now. Iirc this is important because there are specific optimization on execution for some of these specific data structures (also for translation to other engines). The consolidation could possibly be done when we are creating the Calcite plan?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] jcamachor commented on a change in pull request #1892: HIVE-24664: Support column aliases in Values clause

Posted by GitBox <gi...@apache.org>.
jcamachor commented on a change in pull request #1892:
URL: https://github.com/apache/hive/pull/1892#discussion_r564004991



##########
File path: itests/hive-blobstore/src/test/results/clientpositive/insert_into_dynamic_partitions.q.out
##########
@@ -100,7 +100,7 @@ STAGE PLANS:
             Statistics: Num rows: 1 Data size: 10 Basic stats: COMPLETE Column stats: COMPLETE
             GatherStats: false
             Select Operator
-              expressions: array(const struct(1,'101'),const struct(2,'202'),const struct(3,'303'),const struct(4,'404'),const struct(5,'505')) (type: array<struct<col1:int,col2:string>>)
+              expressions: array(named_struct('col1',1,'col2','101'),named_struct('col1',2,'col2','202'),named_struct('col1',3,'col2','303'),named_struct('col1',4,'col2','404'),named_struct('col1',5,'col2','505')) (type: array<struct<col1:int,col2:string>>)

Review comment:
       This should not change, i.e., it seems we are failing to recognize constant structs now. Iirc this is important because there are specific optimization on execution for some of these specific data structures (also for translation to other engines). The consolidation could possibly be done in constant folding (`ConstantPropagateProcFactory`) if the changes in the parser need to be done this way.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org