apache / kyuubi

Apache Kyuubi is a distributed and multi-tenant gateway to provide serverless SQL on data warehouses and lakehouses.
https://kyuubi.apache.org/
Apache License 2.0
2.04k stars 899 forks source link

[Bug] Presto TABLE_NOT_FOUND returns lower case table name causing has_table regex to fail #6485

Closed tboddyspargo closed 1 week ago

tboddyspargo commented 2 months ago

Code of Conduct

Search before asking

Describe the bug

Issue migrated from https://github.com/dropbox/PyHive/issues/302

     regex = r"Table\ \'.*{}\'\ does\ not\ exist".format(re.escape(table_name))

     if msg and re.search(regex, msg):
            raise exc.NoSuchTableError(table_name)
        else:
            raise

with presto and Oracle, Oracle has table name with upper case, but table name in error message which return from presto is with lower case, so re.search method will return None, then has_table method will exit with uncaught exception.

maybe we should use re.IGNORECASE in re.search method

Affects Version(s)

master (pyhive v0.7.0)

Kyuubi Server Log Output

No response

Kyuubi Engine Log Output

No response

Kyuubi Server Configurations

No response

Kyuubi Engine Configurations

No response

Additional context

No response

Are you willing to submit PR?

github-actions[bot] commented 2 months ago

Hello @tboddyspargo, Thanks for finding the time to report the issue! We really appreciate the community's efforts to improve Apache Kyuubi.

tboddyspargo commented 3 weeks ago

NOTE: A similar issue exists when connecting to databricks - the regex doesn't match the error message returned by the database for table not found (e.g .[TABLE_OR_VIEW_NOT_FOUND]).

pan3793 commented 3 weeks ago

Thanks for reporting this issue, @BruceWong96 do you have time to take a look at this issue?

BruceWong96 commented 3 weeks ago

Thanks for reporting this issue, @BruceWong96 do you have time to take a look at this issue?

Yes, I need some time to test it.

pan3793 commented 3 weeks ago

@BruceWong96 thank you in advance.

BruceWong96 commented 1 week ago

Hi, After testing, Presto did not correctly match "Table table_name does not exist" when linking to some engines that can contain uppercase letters in table names, such as Oracle. We can ignore case by adding re.IGNORECASE when matching. I also added UT in this PR.

PTAL. @pan3793

Thanks.

tboddyspargo commented 6 days ago

@pan3793 - Is this already part of a release on PyPI or do you know when we can expect this to be published in a release on PyPI?