Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use drop and create to replace a function on Hive Metastore #24010

Merged

Conversation

findinpath
Copy link
Contributor

@findinpath findinpath commented Nov 2, 2024

Hive 3 does not actually replace the content of the function

https://github.com/apache/hive/blob/rel/release-3.1.2/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L9310

Fall-back to using two operations: drop function followed create function for effectively handling the replace operation for the function when working with Hive Metastore.

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Hive
* Use drop & create function when replacing an existing function backed by Hive Metastore  ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Nov 2, 2024
@github-actions github-actions bot added the hive Hive connector label Nov 2, 2024
// Hive 3 does not actually replace the content of the function
// https://github.com/apache/hive/blob/rel/release-3.1.2/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java#L9310
// Fall back to use drop & create for doing the replace function operation
dropFunction(function.getDbName(), function.getFunctionName());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another alternative would be to throw an NOT_SUPPORTED TrinoException in io.trino.plugin.hive.metastore.thrift.BridgingHiveMetastore#replaceFunction but this would make the CREATE OR REPLACE a bit cumbersome - it would succeed when the function does not exist and it would fail when the function already exists.

@ebyhr ebyhr merged commit efec93b into trinodb:master Nov 5, 2024
56 checks passed
@github-actions github-actions bot added this to the 465 milestone Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed hive Hive connector
Development

Successfully merging this pull request may close these issues.

3 participants