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


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/rewrite/CopyOnWriteUpdateRewriter.java:
##########
@@ -45,40 +45,51 @@ public class CopyOnWriteUpdateRewriter implements 
Rewriter<UpdateStatement> {
   private final SetClausePatcher setClausePatcher;
 
 
-  public CopyOnWriteUpdateRewriter(HiveConf conf, SqlGeneratorFactory 
sqlGeneratorFactory,
-                                   COWWithClauseBuilder cowWithClauseBuilder, 
SetClausePatcher setClausePatcher) {
+  public CopyOnWriteUpdateRewriter(HiveConf conf, SqlGeneratorFactory 
sqlGeneratorFactory) {
     this.conf = conf;
     this.sqlGeneratorFactory = sqlGeneratorFactory;
-    this.cowWithClauseBuilder = cowWithClauseBuilder;
-    this.setClausePatcher = setClausePatcher;
+    this.cowWithClauseBuilder = new COWWithClauseBuilder();
+    this.setClausePatcher = new SetClausePatcher();
   }
 
   @Override
   public ParseUtils.ReparseResult rewrite(Context context, UpdateStatement 
updateBlock)
       throws SemanticException {
 
-    Tree wherePredicateNode = updateBlock.getWhereTree().getChild(0);
-    String whereClause = context.getTokenRewriteStream().toString(
-        wherePredicateNode.getTokenStartIndex(), 
wherePredicateNode.getTokenStopIndex());
     String filePathCol = 
HiveUtils.unparseIdentifier(VirtualColumn.FILE_PATH.getName(), conf);
-
     MultiInsertSqlGenerator sqlGenerator = 
sqlGeneratorFactory.createSqlGenerator();
 
-    cowWithClauseBuilder.appendWith(sqlGenerator, filePathCol, whereClause);
-
-    sqlGenerator.append("insert into table ");
+    String whereClause = null;
+    int columnOffset = 0;
+    
+    boolean shouldOverwrite = updateBlock.getWhereTree() == null;

Review Comment:
   1. I would prefer to keep it here since I am enabling COW support for v1 and 
v2 and remove unnecessary code. 
   2. I don't see how could I link another rewriter without any query details 
(updateBlock.getWhereTree() == null). 
   rewriter impl construction is done before the analyze.
   Note, DeleteSemanticAnalyzer also contains only COW specific code: 
tryMetadataUpdate.



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