Open
Conversation
nuno-faria
commented
Mar 1, 2026
Comment on lines
24
to
36
| This version includes an upgraded version of `pyo3`, which changed the way to extract an FFI object. | ||
| Example: | ||
|
|
||
| Before: | ||
| .. code-block:: rust | ||
| let codec = unsafe { capsule.reference::<FFI_LogicalExtensionCodec>() }; | ||
| Now: | ||
| .. code-block:: rust | ||
| let data: NonNull<FFI_LogicalExtensionCodec> = capsule | ||
| .pointer_checked(Some(c_str!("datafusion_logical_extension_codec")))? | ||
| .cast(); | ||
| let codec = unsafe { data.as_ref() }; |
|
|
||
| #[pyclass(name = "MySumUDF", module = "datafusion_ffi_example", subclass)] | ||
| #[pyclass( | ||
| from_py_object, |
Contributor
Author
There was a problem hiding this comment.
| } | ||
|
|
||
| #[pyclass( | ||
| skip_from_py_object, |
Contributor
Author
There was a problem hiding this comment.
These ones do not implement Clone.
| }; | ||
|
|
||
| let capsule = capsule.downcast::<PyCapsule>()?; | ||
| let capsule = capsule.cast::<PyCapsule>()?; |
Contributor
Author
There was a problem hiding this comment.
Comment on lines
+39
to
+42
| let data: NonNull<FFI_LogicalExtensionCodec> = capsule | ||
| .pointer_checked(Some(c_str!("datafusion_logical_extension_codec")))? | ||
| .cast(); | ||
| let codec = unsafe { data.as_ref() }; |
| filter_expr: Option<Py<PyAny>>, | ||
| projected_statistics: Statistics, | ||
| plan_properties: datafusion::physical_plan::PlanProperties, | ||
| plan_properties: Arc<PlanProperties>, |
Contributor
Author
There was a problem hiding this comment.
| } | ||
|
|
||
| fn statistics(&self) -> DFResult<Statistics> { | ||
| fn partition_statistics(&self, _partition: Option<usize>) -> DFResult<Statistics> { |
Contributor
Author
There was a problem hiding this comment.
statistics has been removed: apache/datafusion#20319
Comment on lines
+145
to
+149
| impl<'source> FromPyObject<'_, 'source> for PyScalarValue { | ||
| type Error = PyErr; | ||
|
|
||
| fn extract(value: Borrowed<'_, 'source, PyAny>) -> Result<Self, Self::Error> { | ||
| Self::from_pyarrow_bound(&value) |
Contributor
Author
There was a problem hiding this comment.
| pytest.param( | ||
| col("d").cardinality(), | ||
| pa.array([3, 4, None, None], type=pa.uint64()), | ||
| pa.array([3, 4, 0, None], type=pa.uint64()), |
Contributor
Author
There was a problem hiding this comment.
cardinality now returns 0 for empty arrays: apache/datafusion#20533
| col("d").array_distinct(), | ||
| pa.array( | ||
| [[-1, 0, 1], [5, 10, 15, 20], [], None], type=pa.list_(pa.int64()) | ||
| [[-1, 1, 0], [5, 10, 15, 20], [], None], type=pa.list_(pa.int64()) |
Contributor
Author
There was a problem hiding this comment.
Order has changed for array_distinct/list_distinct: apache/datafusion#20364
25 tasks
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.
Which issue does this PR close?
N/A.
Rationale for this change
Keep in sync with the next major version of DataFusion.
What changes are included in this PR?
This PR is quite large, but most changes are related to the new version of PyO3.
datafusion,pyo3, andarrow(migrated the respective code as well).DataFusion 53.0.0section in the upgrade guide (sincePyCapsuleMethods::referenceis now deprecated).Are there any user-facing changes?
Yes, the behavior has changed in a few tests (the review comments below contain more info).