deniskuzZ commented on code in PR #4672:
URL: https://github.com/apache/hive/pull/4672#discussion_r1335783132
##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/misc/truncate/TruncateTableAnalyzer.java:
##########
@@ -80,8 +86,25 @@ public void analyzeInternal(ASTNode root) throws
SemanticException {
checkTruncateEligibility(root, tableNode, tableNameString, table);
Map<String, String> partitionSpec = getPartSpec((ASTNode)
tableNode.getChild(1));
+
addTruncateTableOutputs(tableNode, table, partitionSpec);
+ if (table.getStorageHandler() != null &&
!table.getStorageHandler().shouldTruncate(table, partitionSpec)) {
+ // Transform the truncate query to delete query.
+ StringBuilder rewrittenQuery = constructDeleteQuery(table,
partitionSpec);
+ ReparseResult rr = ParseUtils.parseRewrittenQuery(conf, ctx,
rewrittenQuery);
+ Context rewrittenCtx = rr.rewrittenCtx;
+ ASTNode rewrittenTree = rr.rewrittenTree;
+
+ BaseSemanticAnalyzer deleteAnalyzer =
SemanticAnalyzerFactory.get(queryState, rewrittenTree);
Review Comment:
I am ok with that unless @kasakrisz doesn't have any concerns
--
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]