Skip to content

HIVE-29423: Move delete_column_statistics_req out from HMSHandler - #6661

Open
rtrivedi12 wants to merge 1 commit into
apache:masterfrom
rtrivedi12:HIVE-29423
Open

HIVE-29423: Move delete_column_statistics_req out from HMSHandler#6661
rtrivedi12 wants to merge 1 commit into
apache:masterfrom
rtrivedi12:HIVE-29423

Conversation

@rtrivedi12

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Extract delete_column_statistics_req logic from HMSHandler into a new DeleteColumnStatisticsHandler, following the existing @RequestHandler / AbstractRequestHandler

  • Add DeleteColumnStatisticsHandler for table- and partition-level column statistics deletion, including transactional listener events and post-commit notification.
  • HMSHandler.delete_column_statistics_req() used to audit logging (startFunction / endFunction) and delegation via AbstractRequestHandler.offer(this, req).

Why are the changes needed?

HMSHandler is being decomposed into focused request handlers (HIVE-27224).

Does this PR introduce any user-facing change?

No

How was this patch tested?

mvn test -pl standalone-metastore/metastore-server -am
-Dtest=TestStats,TestStatisticsManagement

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the metastore handler decomposition by extracting the delete_column_statistics_req implementation out of HMSHandler into a dedicated DeleteColumnStatisticsHandler based on the existing @RequestHandler / AbstractRequestHandler framework.

Changes:

  • Refactors HMSHandler.delete_column_statistics_req() to delegate execution to AbstractRequestHandler.offer(this, req) while preserving audit start/end behavior and standard exception translation.
  • Adds DeleteColumnStatisticsHandler to implement table- and partition-level column statistics deletion, including transactional listener notifications and post-commit event publication.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java Delegates delete_column_statistics_req to the request-handler framework and routes exceptions through standard handling while ensuring endFunction receives any thrown exception.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/DeleteColumnStatisticsHandler.java New request handler implementing the delete column statistics logic formerly in HMSHandler, including transaction and listener event logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +148 to +156
@Override
protected void afterExecute(DeleteColumnStatisticsResult result) throws TException, IOException {
if (result != null && !handler.getListeners().isEmpty()) {
for (ListenerEvent event : result.events()) {
MetaStoreListenerNotifier.notifyEvent(handler.getTransactionalListeners(), result.eventType(), event);
}
}
super.afterExecute(result);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take care of this typo fix

@dengzhhu653
dengzhhu653 requested a review from Copilot July 30, 2026 07:59
return ret;
} catch (Exception e) {
ex = e;
throw handleException(e).throwIfInstance(MetaException.class, NoSuchObjectException.class)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we just transform the exception to TException? throw handleException(e).defaultTException()

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/DeleteColumnStatisticsHandler.java:154

  • Post-commit listener notification is using the transactional listener list. Transactional listeners are already notified during execution; after commit this should notify the regular listeners (handler.getListeners()). As written, non-transactional listeners will never receive DELETE_*_COLUMN_STAT events and transactional listeners may receive duplicate notifications.
  protected void afterExecute(DeleteColumnStatisticsResult result) throws TException, IOException {
    if (result != null && !handler.getListeners().isEmpty()) {
      for (ListenerEvent event : result.events()) {
        MetaStoreListenerNotifier.notifyEvent(handler.getTransactionalListeners(), result.eventType(), event);
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants