Support non-lowercase table names in Druid connector#15920
Support non-lowercase table names in Druid connector#15920beinan merged 1 commit intoprestodb:masterfrom
Conversation
There was a problem hiding this comment.
what's the benefit of using an Optional here? can we just put the remoteTableObject as the value directly?
There was a problem hiding this comment.
I am using Optional.empty() to mark a table which doesn't exist in Druid.
There was a problem hiding this comment.
Ok, it make sense. Thank you for the clarification!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
I assume the cache you're using is thread-safe, correct me if I'm wrong.
There was a problem hiding this comment.
@beinan Yes, that's right the cache is thread-safe.
There was a problem hiding this comment.
Cool, thanks for the clarification.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@beinan I agree, I have made the changes as suggested by you.
|
Thank you so much for this great contribution! @imjalpreet |
beinan
left a comment
There was a problem hiding this comment.
It looks good to me except a couple of minor issue as I commented above. Thank you for the contribution!
|
@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. |
imjalpreet
left a comment
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
Cool, thanks for the clarification.
There was a problem hiding this comment.
Ok, it make sense. Thank you for the clarification!
This PR introduces druid.case-insensitive-name-matching to allow querying tables with mixed case/uppercase names.
Fixes #15587