You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Confusing behavior now required to to refresh the files of a listing table #19573
As part of #19366, @BlakeOrth added a session (global) cache for the results of calling LIST on a remote directory.
This has a benefit that now this cache is visible, and we can report on it, and make it more aligned with the other session scoped caches. However, it has an unfortunate side effect, namely that there is no good way to force a refresh of the files that back an external table.
For example:
-- calls LIST to get the files
create external table foo...
droptable foo;
-- reuses the cached file list, but previously would actually call LIST to get a (potentially updated) version of the file.
create external table foo ...
Previously, the cache was local to each ListingTable and thus was recreated on each call to CREATE EXTERNAL TABLE. This means that a user could force a refresh of the file list by recreating the table. Reusing the same cached list I think is pretty confusing.
@jizezhang has helpfully volunteered to help with this feature and has another PR queued up so we merged #19366 and will fix this after the fact
Describe the solution you'd like
I think the caches should still be (logically) table scoped -- so that when a CREATE EXTERNAL TABLE command is issues, it will actually make a call to LIST to see the current contents of the remote table
Describe alternatives you've considered
One idea is to have "sub caches" or something that are all table scoped but that the session level cache has a handle to (so it can report on them)
By "table scoped", do we expect cache reuse in this case? If not, do we expect the cache key to be logically some "table identifier" instead of just table path?
By "table scoped", do we expect cache reuse in this case? If not, do we expect the cache key to be logically some "table identifier" instead of just table path?
I personally think that the cache should be table scoped -- so in this case I propose that the test2 table does not reuse the cache
In my mind the core usecase the cache is when querying partitioned tables -- so that when querying on partition columns, querying with LIST is not required. @BlakeOrth mostly completed this use case already, but there is no way to introspect (see) what is cached without a session scoped object
However, by creating a session scoped object we now have this unintended sharing
Hi @alamb@BlakeOrth I was experimenting with ways to make the cache table scoped, and would like to get some high level feedback from you.
I have a draft PR #19616 for one approach I considered, which is to continue using a session level cache as is currently but make the cache key table scoped. The PR contains a short description and some cli testing results to verify that.
Another approach I tried is to attach an independent cache to each table (e.g. add a field in ListingTable struct) and have a session level map from table reference to table cache to track and display at session level. However as I was experimenting, I found it a bit tricky to handle user-provided ListFileCache implementation, which is currently given as a Arc<dyn ListFilesCache>. To support independent table scoped cache, I think we may need some kind of ListFilesCacheFactory instead?
Please let me know your thoughts/suggestions, and correct me if anything does not make sense. Thank you!
I have a draft PR #19616 for one approach I considered, which is to continue using a session level cache as is currently but make the cache key table scoped. The PR contains a short description and some cli testing results to verify that.
Another approach I tried is to attach an independent cache to each table (e.g. add a field in ListingTable struct) and have a session level map from table reference to table cache to track and display at session level. However as I was experimenting, I found it a bit tricky to handle user-provided ListFileCache implementation, which is currently given as a Arc<dyn ListFilesCache>. To support independent table scoped cache, I think we may need some kind of ListFilesCacheFactory instead?
I agree this one sounds tricky and unecessary -- if we can make #19616 work let's go with that one
Edit: I reviewed #19616 and I think it looks good to me
Activity
jizezhang commentedon Dec 31, 2025
take
jizezhang commentedon Dec 31, 2025
Hi @alamb @BlakeOrth , those might uncommon cases, but I wonder what the expected behavior would be if
Thanks a lot!
alamb commentedon Jan 1, 2026
I personally think that the cache should be table scoped -- so in this case I propose that the
test2table does not reuse the cacheIn my mind the core usecase the cache is when querying partitioned tables -- so that when querying on partition columns, querying with LIST is not required. @BlakeOrth mostly completed this use case already, but there is no way to introspect (see) what is cached without a session scoped object
However, by creating a session scoped object we now have this unintended sharing
alamb commentedon Jan 1, 2026
(thank you for working on this ticket, by the way, it is most appreciated)
jizezhang commentedon Jan 3, 2026
Hi @alamb @BlakeOrth I was experimenting with ways to make the cache table scoped, and would like to get some high level feedback from you.
I have a draft PR #19616 for one approach I considered, which is to continue using a session level cache as is currently but make the cache key table scoped. The PR contains a short description and some cli testing results to verify that.
Another approach I tried is to attach an independent cache to each table (e.g. add a field in
ListingTablestruct) and have a session level map from table reference to table cache to track and display at session level. However as I was experimenting, I found it a bit tricky to handle user-providedListFileCacheimplementation, which is currently given as aArc<dyn ListFilesCache>. To support independent table scoped cache, I think we may need some kind ofListFilesCacheFactoryinstead?Please let me know your thoughts/suggestions, and correct me if anything does not make sense. Thank you!
alamb commentedon Jan 5, 2026
I agree this one sounds tricky and unecessary -- if we can make #19616 work let's go with that one
Edit: I reviewed #19616 and I think it looks good to me
Make default ListingFilesCache table scoped (#19616)
Make default ListingFilesCache table scoped (apache#19616)
[branch-52] Backport `list_files_cache`, and make default ListingFile…
[branch-52] fix: expose `ListFilesEntry` (#19818)
fix: expose `ListFilesEntry` (#19804)