-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Initial globbing ranges support #2654
Conversation
f589bac
to
ea731c6
Compare
assert_eq!(&actual, expected); | ||
} | ||
|
||
// TODO: Add test cases for failed patterns... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about
{0..a}
and{a..0}
- what do we do for non-ascii alphabets?
{3..}
{r..}
{..72}
We can imagine bounded ranges that only have an upper or lower bound working as long as the type/value being ranged over had a well defined collation. I initially thought that we'd only want to have unbounded ranges over bounded values, but because this is matching within a list of objects that we can iterate through, we could make it work. We don't have to support all of these now, but having tests that we can change later seems good.
There are also a bunch of potential syntax errors that we should produce clear error messages to users (and maybe this were the things that I thought might go in the enum:
- mismatched bracket types.
- wrong number of
..
in glob - mismatched start/end types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more cases to handle the cases you mentioned.
I am not very keen on throwing an error since the "pattern" formation can be coincidental and we shouldn't throw an error until user opts-in or opts-out.
We definitely should have an "opt-out" from glob pattern so we can throw errors with confidence.
We support two kinds of glob ranges: * `{N..M}`: Here both `N` and `M` are valid integers and (`N <= M`). * `{str1,str2,str3}`: Three different strings: `"str1", "str2", "str3"` **Example:** ``` > select * from 'file_{2..3}.csv'; ┌─────────┐ │ column1 │ │ ── │ │ Int64 │ ╞═════════╡ │ 2 │ │ 3 │ └─────────┘ > select * from 'file{_1,_3}.csv'; ┌─────────┐ │ column1 │ │ ── │ │ Int64 │ ╞═════════╡ │ 1 │ │ 3 │ └─────────┘ ``` Signed-off-by: Vaibhav <[email protected]>
ea731c6
to
a11b7db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits.
I'd also sort of like to see the tests also do BSON because the object store integration is a bit different, but I'm fine if we don't, I think.
Signed-off-by: Vaibhav <[email protected]>
Signed-off-by: Vaibhav <[email protected]>
We support two kinds of glob ranges:
{N..M}
: Here bothN
andM
are valid integers and (N <= M
).{str1,str2,str3}
: Three different strings:"str1", "str2", "str3"
Example: