Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion servc/svc/com/storage/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})"]))
Comment on lines +133 to +136
Copy link

Copilot AI Apr 4, 2026

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 an in filter and this code will produce col in (), which is typically an invalid Delta predicate. Consider filtering out empty lists in _filters() (skip the key) or raising a clear error before calling write_deltalake.

Copilot uses AI. Check for mistakes.
else:
predicate_list.append(" ".join(tuple_value))
Comment on lines +134 to +138
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both branches build the predicate using str joins (, ".join(tuple_value[-1]) and " ".join(tuple_value)), which will raise TypeError if partition values aren’t already strings (e.g., int partitions). Since _filters() returns Any for the value, this should defensively stringify/format values (and ideally handle quoting/escaping for strings) instead of assuming pre-quoted string literals.

Copilot uses AI. Check for mistakes.
predicate = operator.join(predicate_list)
Comment on lines +132 to +139
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change adds new behavior for list-valued predicates (in (...)) but there’s no unit test coverage verifying overwrite(..., partitions={key: [v1, v2]}) actually deletes/overwrites only the intended partitions. Adding a test for the multi-value IN case would help prevent regressions (especially around literal formatting/quoting).

Copilot uses AI. Check for mistakes.

write_deltalake(
table,
Expand Down
Loading