-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix ScalarValue::to_array_of_size
for DenseUnion
#13797
Fix ScalarValue::to_array_of_size
for DenseUnion
#13797
Conversation
I also validated in geoarrow/geoarrow-rs#951 that this is now working for storing geospatial geometries in a dense union! Mirroring the PostGIS
Under the hood this is stored as a rather complex dense union, but allows for any combination of geometry type and dimension with a unique DataType that's streaming-friendly. |
Ref apache/datafusion#13797. This is now working for geometries! ``` SELECT ST_GeomFromText('LINESTRING(-71.160281 42.258729,-71.160837 42.259113,-71.161144 42.25932)'); ``` ``` ---- udf::native::io::wkt::test::test stdout ---- +----------------------------------------------------------------------------------------------------+ | st_geomfromtext(Utf8("LINESTRING(-71.160281 42.258729,-71.160837 42.259113,-71.161144 42.25932)")) | +----------------------------------------------------------------------------------------------------+ | {=[{x: -71.160281, y: 42.258729}, {x: -71.160837, y: 42.259113}, {x: -71.161144, y: 42.25932}]} | +----------------------------------------------------------------------------------------------------+ ``` 🚀
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.
Thank you @kylebarron -- this looks great to me
new_null_array(dt, size) | ||
match mode { | ||
UnionMode::Sparse => new_null_array(dt, size), | ||
// In a dense union, only the child with values needs to be |
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.
I double checked the spec and I agree with this check: https://arrow.apache.org/docs/format/Columnar.html#dense-union
@@ -5642,14 +5650,12 @@ mod tests { | |||
// null array | |||
Arc::new(NullArray::new(3)), | |||
// dense union | |||
/* Dense union fails due to https://github.com/apache/datafusion/issues/13762 | |||
{ |
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.
🎉
Which issue does this PR close?
Closes #13762
Rationale for this change
Fix support for dense union.
What changes are included in this PR?
Fix
ScalarValue::to_array_of_size
for DenseUnionAre these changes tested?
Yes. The test from #13777 is uncommented.
Are there any user-facing changes?