deniskuzZ commented on code in PR #4852:
URL: https://github.com/apache/hive/pull/4852#discussion_r1399074813


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/rewrite/MergeRewriter.java:
##########
@@ -217,13 +218,17 @@ public void 
appendWhenMatchedUpdateClause(MergeStatement.UpdateClause updateClau
     }
 
     protected void addValues(Table targetTable, String targetAlias, 
Map<String, String> newValues,
-                             List<String> values) {
+                             List<String> values, boolean aliasRhsExpr) {
       for (FieldSchema fieldSchema : targetTable.getCols()) {
+        String value = String.format("%s.%s", targetAlias, 
HiveUtils.unparseIdentifier(fieldSchema.getName(), conf));
         if (newValues.containsKey(fieldSchema.getName())) {
-          values.add(newValues.get(fieldSchema.getName()));
+          String rhsExp = newValues.get(fieldSchema.getName());
+          if (aliasRhsExpr){
+            rhsExp += String.format(" AS %s", value);
+          }
+          values.add(rhsExp);

Review Comment:
   refactored and then realized it looks more complicated than the generalized 
method. 
   "it's value is implementation specific" - it won't harm if we add alias in 
existing implementations, however' it's redundant there, but is required in 
case of "UNION"



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to