Skip to content

HIVE-29452: Split get table from HMSHandler#6427

Merged
dengzhhu653 merged 7 commits intoapache:masterfrom
dengzhhu653:HIVE-29452
Apr 15, 2026
Merged

HIVE-29452: Split get table from HMSHandler#6427
dengzhhu653 merged 7 commits intoapache:masterfrom
dengzhhu653:HIVE-29452

Conversation

@dengzhhu653
Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Why are the changes needed?

Does this PR introduce any user-facing change?

How was this patch tested?

Copy link
Copy Markdown

Copilot AI left a comment

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 refactors Hive Metastore “get table”-related logic by moving several table retrieval/listing flows out of HMSHandler into a dedicated GetTableHandler request handler, aligning with the existing request-handler architecture used elsewhere in the standalone metastore server.

Changes:

  • Introduces GetTableHandler to centralize implementations for get_table_req, get_table_core, get_table_objects_by_name_req, and various table-name listing methods.
  • Updates HMSHandler to delegate these operations to GetTableHandler and removes now-duplicated helper logic.
  • Improves an UnsupportedOperationException message in GetPartitionsHandler to include the unsupported request object.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java Delegates multiple table APIs to the new GetTableHandler and removes inlined implementations.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/GetTableHandler.java New request handler consolidating table fetch/list logic previously in HMSHandler.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/GetPartitionsHandler.java Makes the “not yet implemented” exception include the request value for easier debugging.

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

Copy link
Copy Markdown

Copilot AI left a comment

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java:1449

  • In get_table_req, exceptions from GetTableHandler.getTable(...) aren't captured/passed to endFunction (the Exception argument is always null). This can hide failures from end-function listeners/metrics and produces misleading audit/telemetry. Capture the exception in a local Exception ex (as other HMSHandler methods do), rethrow it, and pass ex to endFunction.
  @Override
  public List<TableMeta> get_table_meta(String dbnames, String tblNames, List<String> tblTypes)
      throws MetaException, NoSuchObjectException {
    List<TableMeta> t = null;
    String[] parsedDbName = parseDbName(dbnames, conf);
    startTableFunction("get_table_metas", parsedDbName[CAT_NAME], parsedDbName[DB_NAME], tblNames);
    Exception ex = null;

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

Copy link
Copy Markdown
Contributor

@wecharyu wecharyu left a comment

Choose a reason for hiding this comment

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

Looks good overall, just left a few minor comments.

}
return t;
return GetTableHandler.getTables(
() -> startTableFunction("get_table_metas", parsedDbName[CAT_NAME], parsedDbName[DB_NAME], tblNames),
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.

nit: get_table_metas => get_table_meta

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

metastore metrics will use this field, changing it to a new one might break the old graph we built for this method

}
return tables;
List<Table> tables = GetTableHandler.getTables(
() -> startMultiTableFunction("get_multi_table", req.getDbName(), req.getTblNames()),
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.

nit: get_multi_table => get_table_objects

try {
Database database = handler.get_database_core(catName, dbname);
if (isDatabaseRemote(database)) {
return DataConnectorProviderFactory.getDataConnectorProvider(database).getTableNames();
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.

It does not filter out the result by possible filter or pattern.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good catch, we ignore the filter/pattern for remote database before the change, maybe we need to address it in the future.
added the missing authorization filter.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@wecharyu wecharyu left a comment

Choose a reason for hiding this comment

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

LGTM

@dengzhhu653 dengzhhu653 merged commit 78f50fd into apache:master Apr 15, 2026
3 of 4 checks passed
@dengzhhu653 dengzhhu653 deleted the HIVE-29452 branch April 15, 2026 22:39
@dengzhhu653
Copy link
Copy Markdown
Member Author

Thank you for the review @wecharyu!

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