kasakrisz commented on code in PR #4832:
URL: https://github.com/apache/hive/pull/4832#discussion_r1391244324


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/MergeSemanticAnalyzer.java:
##########
@@ -723,11 +588,88 @@ private String getPredicate() {
 
   @Override
   protected boolean allowOutputMultipleTimes() {
-    return conf.getBoolVar(HiveConf.ConfVars.SPLIT_UPDATE) || 
conf.getBoolVar(HiveConf.ConfVars.MERGE_SPLIT_UPDATE);
+    return conf.getBoolVar(HiveConf.ConfVars.SPLIT_UPDATE);
   }
 
   @Override
   protected boolean enableColumnStatsCollecting() {
     return numWhenMatchedUpdateClauses == 0 && numWhenMatchedDeleteClauses == 
0;
   }
+
+  /**
+   * This allows us to take an arbitrary ASTNode and turn it back into SQL 
that produced it.
+   * Since HiveLexer.g is written such that it strips away any ` (back ticks) 
around
+   * quoted identifiers we need to add those back to generated SQL.
+   * Additionally, the parser only produces tokens of type Identifier and never
+   * QuotedIdentifier (HIVE-6013).  So here we just quote all identifiers.
+   * (') around String literals are retained w/o issues
+   */
+  private static class IdentifierQuoter {

Review Comment:
   This class doesn't worthy for general purposes. This way we can not quote 
ids which has backtick:
   ```
           visitedNodes.put(n, n);
           trs.insertBefore(n.getToken(), "`");
           trs.insertAfter(n.getToken(), "`");
   ```
   
   So this class must be refactored in the future when we want to add full 
support of quoted Identifiers in acid tables. To do it we need something like 
this
   
https://github.com/apache/hive/blob/cbc5d2d7d650f90882c5c4ad0026a94d2e586acb/ql/src/java/org/apache/hadoop/hive/ql/ddl/table/constraint/ConstraintsUtils.java#L313C36-L345
   
   Currently one of the blockers is `ValidReadTxnList` uses characters `:` and 
`$` as seprarator characters in the string representation. According to 
standard these can be part of quoted identifier hence a table name.
   
https://github.com/apache/hive/blob/cbc5d2d7d650f90882c5c4ad0026a94d2e586acb/storage-api/src/java/org/apache/hadoop/hive/common/ValidReadTxnList.java#L190
   



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