Fix coordinate-bound support and safe partition pruning - #248
Open
ghostiee-11 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
@alxmrs Can you review this :) |
alxmrs
approved these changes
Sep 6, 2026
alxmrs
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks for supporting all these types.
| pyo3 = { version = "0.28.0", features = ["extension-module", "abi3-py310"] } | ||
| # platform works on all CPython >= 3.10 (matching `requires-python`). Maturin | ||
| # enables `pyo3/extension-module` through pyproject.toml for wheel builds; it | ||
| # must stay disabled for ordinary Cargo test binaries so they link libpython. |
|
|
||
| // TODO(alxmrs, Claude): Support every valid xarray coordinate type. | ||
| /// Scalar value for dimension bounds, supporting common xarray coordinate types. | ||
| /// Scalar value for orderable xarray dimension bounds. |
| DurationSecond(i64), | ||
| DurationMillisecond(i64), | ||
| DurationMicrosecond(i64), | ||
| DurationNanosecond(i64), |
Member
There was a problem hiding this comment.
|
|
||
| // Incompatible types | ||
| _ => None, | ||
| fn integer_bound(bound: &ScalarBound) -> Option<IntegerBound> { |
Member
There was a problem hiding this comment.
Do we promote to 128 for comparisons, then return back?
| let val = obj.extract::<i64>()?; | ||
| Ok(ScalarBound::Int64(val)) | ||
| } | ||
| "bool" => Ok(ScalarBound::Boolean(obj.extract::<bool>()?)), |
| TimeUnit::Second if v % 1_000_000_000 == 0 => Some(v / 1_000_000_000), | ||
| _ => None, | ||
| }?; | ||
| (ScalarBound::Utf8(v), DataType::Utf8) => Some(ScalarValue::Utf8(Some(v.clone()))), |
|
|
||
|
|
||
| def test_partition_metadata_skips_out_of_ns_datetime(): | ||
| # datetime64 coordinates outside the datetime64[ns] range (pre-1678 / |
| assert result["x"].tolist() == [6, 7] | ||
| assert tracker.iteration_count == 1 | ||
|
|
||
| @pytest.mark.parametrize("dtype", ["float32", "float64"]) |
Member
There was a problem hiding this comment.
Did you import half floats (float16)? If so, it might be good to test.
| if cft.is_cftime_index(ds, coord_name): | ||
| units, calendar = cft.encoding(ds, coord_name) | ||
| columns.append(cft.arrow_field(coord_name, units, calendar)) | ||
| elif isinstance(coord_var.dtype, pd.CategoricalDtype): |
Member
There was a problem hiding this comment.
I'm happy we're covering this case.
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.
Adds exact coordinate bounds for numeric, boolean, string, binary, timestamp, and duration types while keeping pruning and statistics conservative and overflow-safe.
Closes #121.