hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-29021: Update implementation for HMSHandler#get_databases

Open shuyouZZ opened this issue 8 months ago • 4 comments

What changes were proposed in this pull request?

Update implementation for HMSHandler#get_databases

Why are the changes needed?

HIVE-28921 modified the HMSHandler#get_databases and re-implemented it using get_databases_req.

Here does not need to use getMS().getDatabaseObjects to get databases and then extract the name, just get the name directly using getMS().getDatabases.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Use the existing unit tests.

shuyouZZ avatar Jun 16 '25 03:06 shuyouZZ

I understand this is reverting this change on HMSHandler. The intention is understandable and the implementation looks correct.

Yes, this PR revert the previous changes

shuyouZZ avatar Jun 16 '25 10:06 shuyouZZ

please wait for @dengzhhu653. I think some of the request objects allow filtering out what fields need to be fetched, maybe we can do the same here

GetTablesRequest req = new GetTablesRequest(dbName);
...
GetProjectionsSpec projectionsSpec = new GetProjectionsSpec();
projectionsSpec.setFieldList(Arrays.asList("dbName", "tableName", "owner", "ownerType"));

deniskuzZ avatar Jun 16 '25 11:06 deniskuzZ

please wait for @dengzhhu653. I think some of the request objects allow filtering out what fields need to be fetched, maybe we can do the same here

GetTablesRequest req = new GetTablesRequest(dbName);
...
GetProjectionsSpec projectionsSpec = new GetProjectionsSpec();
projectionsSpec.setFieldList(Arrays.asList("dbName", "tableName", "owner", "ownerType"));

Thank you @deniskuzZ @shuyouZZ. This this change on HMSHandler is trying to fix the Ranger stack overflow on retrieving the owner from the database, we get the whole database and push it to validate the owner(authorization), so the Ranger has the database owner info and skips pulling the database from HMS for the owner

dengzhhu653 avatar Jun 17 '25 01:06 dengzhhu653

@shuyouZZ, since it works as designed, can we close the PR? Or am I missing something, and it's still needed?

deniskuzZ avatar Jun 27 '25 13:06 deniskuzZ

No response received from the author, so closing this

deniskuzZ avatar Jul 31 '25 11:07 deniskuzZ