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

Fix getting views for Hive metastore 2.3+ #24466

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

imsayari404
Copy link
Contributor

@imsayari404 imsayari404 commented Jan 31, 2025

On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow = predicates over CLOB values. At the same time, they allow LIKE predicates over them.

cherry-picked : trinodb/trino#833

Description

Added a new private method getPrestoViews(String databaseName):

  1. Uses get_table_names_by_filter to fetch tables marked as Presto views.
  2. Introduced fallback logic:
    a. First attempts = predicate on PRESTO_VIEW_FLAG.
    b. If it fails, attempts LIKE predicate.
    c. Stores successful attempts in metastoreKnownToSupportTableParamEqualsPredicate and metastoreKnownToSupportTableParamLikePredicate.

Motivation and Context

Hive 2.3 metastore provides more space for table parameter values. On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow = predicates over CLOB values. At the same time, they allow LIKE predicates over them.

This fixes SHOW TABLES and queries over information_schema.tables.

Also, fixes #10735, nico-arianto/big-data-local#1.

Impact

Clob datatype issue resolved.

Test Plan

checked using presto-cli.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Hive Connector Changes
*  Fix getting views for Hive metastore 2.3+

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Jan 31, 2025
@imsayari404 imsayari404 marked this pull request as ready for review January 31, 2025 10:30
@imsayari404 imsayari404 requested a review from a team as a code owner January 31, 2025 10:30
Copy link
Contributor

@tdcmeehan tdcmeehan left a comment

Choose a reason for hiding this comment

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

Please follow the instructions for Backport Commits in our commit standards.

@imsayari404
Copy link
Contributor Author

@tdcmeehan , could you review this pr at your convenience?

On certain databases (e.g. Derby, Oracle) it uses CLOB and these databases disallow `=` predicates over CLOB values. At the same time, they allow
`LIKE` predicates over them.

Cherry-pick of prestodb@179ffe4
Co-authored-by: Piotr Findeisen <[email protected]>
Copy link
Contributor

@pratyakshsharma pratyakshsharma left a comment

Choose a reason for hiding this comment

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

There is a line break in second line of commit description. Will be good to correct that.

@steveburnett
Copy link
Contributor

New release note guidelines as of last week: PR #24354 automatically adds links to this PR to the release notes. Please remove the manual PR link in the following format from the release note entries for this PR.

:pr:`12345`

I have updated the Release Notes Guidelines to remove the examples of manually adding the PR link.

@agrawalreetika
Copy link
Member

There is a line break in second line of commit description. Will be good to correct that.

I think we leave a blank line at the end of the class variable?

@tdcmeehan tdcmeehan merged commit 1176ffd into prestodb:master Feb 4, 2025
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:IBM PR from IBM
Projects
None yet
6 participants