-
Notifications
You must be signed in to change notification settings - Fork 1
fix: handle where predicate contains list #158
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,7 +129,14 @@ def overwrite( | |
| predicate: str | None = None | ||
| filter = self._filters(partitions) | ||
| if filter is not None: | ||
| predicate = operator.join([" ".join(x) for x in filter]) | ||
| predicate_list: List[str] = [] | ||
| for tuple_value in filter: | ||
| if isinstance(tuple_value[-1], list): | ||
| in_list = ", ".join(tuple_value[-1]) | ||
| predicate_list.append(" ".join([tuple_value[0], tuple_value[1], f"({in_list})"])) | ||
| else: | ||
| predicate_list.append(" ".join(tuple_value)) | ||
|
Comment on lines
+134
to
+138
|
||
| predicate = operator.join(predicate_list) | ||
|
Comment on lines
+132
to
+139
|
||
|
|
||
| write_deltalake( | ||
| table, | ||
|
|
||
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.
If a partition key is provided with an empty list (len==0),
_filters()currently emits aninfilter and this code will producecol in (), which is typically an invalid Delta predicate. Consider filtering out empty lists in_filters()(skip the key) or raising a clear error before callingwrite_deltalake.