Repository navigation
Optimize glob iterator - #73518
Optimize glob iterator#73518
Conversation
|
This is an automated comment for commit bd7c1c5 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
72873a7 to
0e28575
Compare
de1ee10 to
2041b0f
Compare
zvonand
left a comment
There was a problem hiding this comment.
Why do you limit number of expandable globs to 1?
0f8e9f1 to
8ec585e
Compare
| local_context, is_archive ? nullptr : read_keys, query_settings.list_object_keys_size, | ||
| query_settings.throw_on_zero_files_match, file_progress_callback); | ||
| auto path = configuration->getPath(); | ||
| if (containsOnlyEnumGlobs(path)) |
There was a problem hiding this comment.
Why?
We can expand enum globs regardless of whether there are other globs. It is OK to expand e.g. prefix{1,2,3}/file*.csv
There was a problem hiding this comment.
Also, I think it is even OK to expand stuff like prefix{1?,2?,3?}/file*.csv. This is still better than having shorter prefix and matching it against regex
|
The code LGTM to me. Please, correct the failed tests |
|
@divanik thanks for looking into it. I thought at first to fix the test, but it seems that behavior with skipping missing files set in globs is rather desirable. I'll fall back to optimizing just the single glob instead, we can think about multiple globs later. |
But this is a pretty narrow case. It is only good for enumerating files (e.g. Or maybe you mean something different by "optimizing just the single glob"? |
This is causing an actual issue and is the reason I got here, so "pretty narrow" is quite relative. The reason I'm thinking about unwinding just one glob is that with a path like Also it seems that |
e4b8a41 to
953f4a7
Compare
|
Oh, I see the problem. Current semantics is: take all files which name corresponds to regex. Even with single enumeration glob we can meet non-existent files. Is it ok for us to throw the error in this case? |
Well, maybe it is and maybe it isn't -- actually a difficult question :) But this is the behavior that currently exists, and it has been here for a long time (due to how the globs were handled initially). This would be a very breaking change. We can throw exception in case there were no globs at all or if there was a glob but no files found after all the processing. Maybe introduce some setting like |
Yes, and I think it is more intuitive, isn't it? The same thing about range globs, which I think are even more natural to behave like a regex: |
|
Yes, but it will still be breaking. You never needed to set this setting, but after upgrade you have to, and this may not be obvious actually. Also, by enabling this setting exception will not be thrown even if no files were found at all, which is a different case. And there will not be a way to differentiate it.
Yes, sounds very reasonable |
I mean hardcoding true here. Also it makes sense to add throw_on_zero_match to comply KeysIterator's behavior with a GlobIterator's one in case nothing is matched. |
953f4a7 to
cfb82ad
Compare
da1926d to
1d6475c
Compare
|
Let's stop on strict expansion if just one enum glob is present. Further optimizations may be done in separate PRs. |
What do you mean by |
|
@divanik Right. |
All 22 failures in `Integration tests (amd_asan_ubsan, flaky)` reduce to three causes: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113396&sha=1c45aad21479ffccd7c9e5099a0aab2667981054&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 1. pyhdfs 0.4.0 (the runner image has it now; the tests were written against 0.3.1) no longer defaults `user_name` to the local user, so WebHDFS requests ran as `nobody` and every write to `/` failed with `HdfsAccessControlException`. Pass `user_name="root"` at every `HdfsClient` construction site. 2. `PartitionManager._add_rule` was renamed to `add_rule` while the tests were gone; `test_url_reconnect` used the old name. 3. Since #73518 an enum glob (single brackets expansion, e.g. `{1..5}` or `{1,2,3,4,5}`) expands into concrete paths without listing, and every expanded path must exist. Reference only the files the test actually creates, matching the `test_s3_enum_glob_should_not_list` adaptation in the same PR. Co-Authored-By: Claude Fable 5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Don't list blob storage keys if we only have curly brackets expansion in table function. Closes #73333
CI Settings (Only check the boxes if you know what you are doing):