kyuubi icon indicating copy to clipboard operation
kyuubi copied to clipboard

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

Open tboddyspargo opened this issue 1 year ago • 1 comments

Code of Conduct

Search before asking

  • [X] I have searched in the issues and found no similar issues.

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?

  • [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
  • [X] No. I cannot submit a PR at this time.

tboddyspargo avatar Jun 19 '24 17:06 tboddyspargo

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

github-actions[bot] avatar Jun 19 '24 17:06 github-actions[bot]

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]).

tboddyspargo avatar Jul 30 '24 16:07 tboddyspargo

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

pan3793 avatar Jul 31 '24 03:07 pan3793

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.

BruceWong96 avatar Jul 31 '24 03:07 BruceWong96

@BruceWong96 thank you in advance.

pan3793 avatar Jul 31 '24 03:07 pan3793

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.

BruceWong96 avatar Aug 12 '24 02:08 BruceWong96

@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?

tboddyspargo avatar Aug 15 '24 20:08 tboddyspargo