SourabhBadhya commented on code in PR #4672:
URL: https://github.com/apache/hive/pull/4672#discussion_r1335527494
##########
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 think this is huge refactor since a lot of methods needs to be
implemented. Its a separate task.
--
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]