Skip to content

Support non-lowercase table names in Druid connector#15920

Merged
beinan merged 1 commit intoprestodb:masterfrom
imjalpreet:Issue-15587
Jun 1, 2021
Merged

Support non-lowercase table names in Druid connector#15920
beinan merged 1 commit intoprestodb:masterfrom
imjalpreet:Issue-15587

Conversation

@imjalpreet
Copy link
Member

@imjalpreet imjalpreet commented Apr 8, 2021

This PR introduces druid.case-insensitive-name-matching to allow querying tables with mixed case/uppercase names.

Fixes #15587

== RELEASE NOTES ==

General Changes
* Add support for querying non-lowercase table names in Druid connector (:pr:`15920`)

@imjalpreet imjalpreet self-assigned this Apr 8, 2021
@imjalpreet imjalpreet requested a review from beinan April 8, 2021 15:49
Copy link
Member

Choose a reason for hiding this comment

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

what's the benefit of using an Optional here? can we just put the remoteTableObject as the value directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am using Optional.empty() to mark a table which doesn't exist in Druid.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, it make sense. Thank you for the clarification!

Copy link
Member

Choose a reason for hiding this comment

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

hmmm, can we use cache's get(K key,
Callable<? extends V> valueLoader) to avoid returning a null? it's something like if cached, return; otherwise create, cache and return

Copy link
Member Author

Choose a reason for hiding this comment

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

@beinan In the current design, to create a new cache entry it involves looping through all the tables present in Druid. If I make use of cacheLoader to create, cache and return, it will result in looping through all the tables every time a new table is accessed as cache will be updated for only the table which is accessed. Whereas in my current implementation, if a cache reload takes place, I load all the tables into the cache which are present in Druid at the instant which means cache will only be reloaded again when a table is accessed which did not exist when the cache was refreshed the last time.

Please let me know your views on the same and correct me in case I misunderstood something.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, I'm convinced.

Copy link
Member

Choose a reason for hiding this comment

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

I assume the cache you're using is thread-safe, correct me if I'm wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

@beinan Yes, that's right the cache is thread-safe.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, thanks for the clarification.

Copy link
Member

Choose a reason for hiding this comment

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

I see, you're using Optional.empty to indicate the non-existing table name. Now I understand why you're using an Optional as the V.

But we don't have to update mapping here, am I right? if the mapping does not contains the key, we can just do remoteTables.put(schemaTableName,, Optional.empty() and then return Optional.empty(). the logic should be identical I think

Copy link
Member Author

Choose a reason for hiding this comment

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

@beinan I agree, I have made the changes as suggested by you.

@beinan
Copy link
Member

beinan commented May 5, 2021

Thank you so much for this great contribution! @imjalpreet
sorry for my delay, quite a few things on-going these days. Just left a couple comments for some minor issues, I will try to make a further review in the next 2~3 days.

Copy link
Member

@beinan beinan left a comment

Choose a reason for hiding this comment

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

It looks good to me except a couple of minor issue as I commented above. Thank you for the contribution!

@imjalpreet
Copy link
Member Author

@beinan thank you for the review. Sorry I couldn't look into it yet, but I will work on the comments and revert back soon.

Copy link
Member Author

@imjalpreet imjalpreet left a comment

Choose a reason for hiding this comment

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

@beinan Sorry, I couldn't revert back earlier. I have made some changes as you requested, can you have a look at my comments and let me know what are your views? Thanks again for the review.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, thanks for the clarification.

Copy link
Member

Choose a reason for hiding this comment

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

Got it, I'm convinced.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, it make sense. Thank you for the clarification!

@beinan beinan merged commit 42b9ef8 into prestodb:master Jun 1, 2021
@jainxrohit jainxrohit mentioned this pull request Jun 5, 2021
4 tasks
@ajaygeorge ajaygeorge mentioned this pull request Jun 9, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Druid connector fails to identify tables with uppercase names.

2 participants