You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "kasakrisz (via GitHub)" <gi...@apache.org> on 2023/03/13 10:50:54 UTC

[GitHub] [hive] kasakrisz commented on a diff in pull request #4109: Iceberg: Optimise delete (entire) data from table

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


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/UpdateDeleteSemanticAnalyzer.java:
##########
@@ -99,14 +101,31 @@ protected void analyze(ASTNode tree, Table table, ASTNode tabNameNode) throws Se
    */
   private void reparseAndSuperAnalyze(ASTNode tree, Table mTable, ASTNode tabNameNode) throws SemanticException {
     List<? extends Node> children = tree.getChildren();
-
+    
+    boolean shouldTruncate = children.size() == 1 && deleting();
+    if (shouldTruncate) {
+      StringBuilder rewrittenQueryStr = new StringBuilder("truncate ").append(getFullTableNameForSQL(tabNameNode));
+      ReparseResult rr = parseRewrittenQuery(rewrittenQueryStr, ctx.getCmd());
+      Context rewrittenCtx = rr.rewrittenCtx;
+      ASTNode rewrittenTree = rr.rewrittenTree;
+
+      TruncateTableAnalyzer truncate = (TruncateTableAnalyzer) SemanticAnalyzerFactory.get(queryState, rewrittenTree);

Review Comment:
   Does this cast required? I don't see any TruncateTableAnalyzer specific calls.



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