You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "deniskuzZ (via GitHub)" <gi...@apache.org> on 2023/11/21 09:17:03 UTC
Re: [PR] HIVE-27794: Iceberg: Implement Copy-On-Write for Merge queries, enable CRUD for V1 tables [hive]
deniskuzZ commented on code in PR #4852:
URL: https://github.com/apache/hive/pull/4852#discussion_r1400255192
##########
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:
I would prefer to keep the IOW optimization in COWUpdateRewriter in that PR, however, in follow-up PR we could move it to UpdateSemanticAnalyzer and use the same optimization for ACID
--
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: gitbox-unsubscribe@hive.apache.org
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