Repository navigation
Raise a clear error for unsupported ROAPI partition column types - #76
Merged
saarthak2002 merged 1 commit intoOct 5, 2026
Merged
saarthak2002 merged 1 commit into
saarthak2002 merged 1 commit into
Conversation
py_type_to_roapi did a bare dict subscript, so any partition value type
outside {int, str, bool, float} (e.g. datetime.date) raised an opaque
KeyError: <class 'datetime.date'> instead of saying what was wrong.
Matches the ValueError-on-bad-input convention used elsewhere in the
filter/operator conversion code.
There was a problem hiding this comment.
No material issues. The change replaces an opaque KeyError with a ValueError that names the unsupported type, matching the rest of the filter/export conversion code, and the four previously supported mappings are unchanged. Coverage includes both the helper and the export_to_roapi_table path for a date partition value.
Posted by the code review bot. This is an automated review, not a maintainer approval.
saarthak2002
approved these changes
Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`py_type_to_roapi` (src/datarepo/export/roapi.py) maps a partition column's Python value type to a ROAPI data type via a bare dict subscript:
```python
return {int: "Int64", str: "Utf8", bool: "Boolean", float: "Float64"}[py_type]
```
Any `docs_filters` value whose type isn't one of those four (e.g. a `datetime.date` partition column, which is a very ordinary thing to partition by) blows up `export_to_roapi_table` with an opaque `KeyError: <class 'datetime.date'>`, instead of a message that says what's actually unsupported. The rest of this codebase's filter/operator conversion code (`_filter_to_expr`, `filter_to_sql_expr`, `ClickHouseTable._build_query`) consistently raises a `ValueError` naming the bad input — this was the one spot still doing a raw subscript.
Changes
Test plan