Skip to content

Fix the bug in getIndexInfo for mysql#14750

Merged
clintropolis merged 1 commit intoapache:masterfrom
pranavbhole:fixGetIndex
Aug 4, 2023
Merged

Fix the bug in getIndexInfo for mysql#14750
clintropolis merged 1 commit intoapache:masterfrom
pranavbhole:fixGetIndex

Conversation

@pranavbhole
Copy link
Contributor

@pranavbhole pranavbhole commented Aug 3, 2023

Description

This PR fixes the bug in getIndex List on given table, mysql implementation of DatabaseMetadata has different behavior then Derby, default settings in mysql are strict and accept only case sensitive name of the tableName in databaseMetaData.getIndexInfo, while in derby it strictly accept the upper case.
I am moving this databaseMetaData.getIndexInfo to connector specific overrides.
I have tested this PR on docker based MySQL metadata connector, local docker based mariadb as well as Postgres and it works well.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@clintropolis clintropolis merged commit d31c04c into apache:master Aug 4, 2023
@abhishekagarwal87 abhishekagarwal87 added this to the 27.0 milestone Aug 4, 2023
return databaseMetaData.getIndexInfo(
null,
null,
tableName, // tableName is case-sensitive in mysql default setting
Copy link
Contributor

Choose a reason for hiding this comment

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

what was the reason for wrapping this in upperCase call anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default Derby settings needs tableName in uppercase, else it does not return the indexInfo.

AmatyaAvadhanula pushed a commit to AmatyaAvadhanula/druid that referenced this pull request Aug 4, 2023
abhishekagarwal87 pushed a commit that referenced this pull request Aug 4, 2023
Co-authored-by: Pranav <pranavbhole@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants