You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2025/12/19 17:07:10 UTC

[PR] chore: Update to Arrow 57, DataFusion 50 [sedona-db]

paleolimbot opened a new pull request, #466:
URL: https://github.com/apache/sedona-db/pull/466

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update to Arrow 57, DataFusion 50 [sedona-db]

Posted by "yutannihilation (via GitHub)" <gi...@apache.org>.
yutannihilation commented on PR #466:
URL: https://github.com/apache/sedona-db/pull/466#issuecomment-3707806229

   This compile error of R check on Windows might be fixed by adding `-lole32` to `PKG_LIBS` in `Makevars.win.in`.
   
   > `undefined reference to `CoTaskMemFree'`
   
   https://learn.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-cotaskmemfree


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update to Arrow 57, DataFusion 50 [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #466:
URL: https://github.com/apache/sedona-db/pull/466#discussion_r2660213339


##########
rust/sedona-spatial-join/src/exec.rs:
##########
@@ -652,7 +652,7 @@ mod tests {
         let bounds = Rect::new(Coord { x: 0.0, y: 0.0 }, Coord { x: 100.0, y: 100.0 });
 
         let left_data = RandomPartitionedDataBuilder::new()
-            .seed(1)
+            .seed(11584)

Review Comment:
   I updated these seeds because they generated at least one join with no results (such that it wouldn't be testing anything, which was tested for in our tests)



##########
rust/sedona-testing/src/datagen.rs:
##########
@@ -389,21 +387,23 @@ impl RandomPartitionedDataBuilder {
             .collect();
 
         // Generate random distances between 0.0 and 100.0
-        let distance_dist = Uniform::new(0.0, 100.0);
+        let distance_dist = Uniform::new(0.0, 100.0).expect("valid input to Uniform::new()");

Review Comment:
   The update to the `rand` crate was a bit disruptive here because creating a new distribution can now fail (plus, the random sequences are now different everywhere, so some seeds had to be updated, the reasons for which are noted inline).



##########
python/sedonadb/tests/test_sjoin.py:
##########
@@ -106,7 +106,7 @@ def test_spatial_join_geography(join_type, on):
                 "vertices_per_linestring_range": [2, 10],
                 "bounds": west_most_bound,
                 "size_range": [0.1, 5],
-                "seed": 43,
+                "seed": 958,

Review Comment:
   I updated this seed because the DWithin join test failed (SedonaDB considered some things within a distance and PostGIS did not). This is right at the equator (i.e., one of the largest deltas between the average radius and the actual ellipsoidal radius) I think there might be some pairs where the Ellipsoidal vs spherical distinction matters.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update to Arrow 57, DataFusion 50 [sedona-db]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #466:
URL: https://github.com/apache/sedona-db/pull/466#discussion_r2660223807


##########
rust/sedona-testing/src/datagen.rs:
##########
@@ -511,167 +514,178 @@ fn generate_random_wkb<R: rand::Rng>(rng: &mut R, options: &RandomGeometryOption
             endianness: Endianness::LittleEndian,
         },
     )
-    .unwrap();
-    out
+    .map_err(|e| DataFusionError::External(Box::new(e)))?;
+    Ok(out)
 }
 
 fn generate_random_geometry<R: rand::Rng>(
     rng: &mut R,
     options: &RandomGeometryOptions,
-) -> Geometry {
-    match options.geom_type {
-        GeometryTypeId::Point => Geometry::Point(generate_random_point(rng, options)),
+) -> Result<Geometry> {
+    Ok(match options.geom_type {
+        GeometryTypeId::Point => Geometry::Point(generate_random_point(rng, options)?),
         GeometryTypeId::LineString => {
-            Geometry::LineString(generate_random_linestring(rng, options))
+            Geometry::LineString(generate_random_linestring(rng, options)?)
         }
-        GeometryTypeId::Polygon => Geometry::Polygon(generate_random_polygon(rng, options)),
+        GeometryTypeId::Polygon => Geometry::Polygon(generate_random_polygon(rng, options)?),
         GeometryTypeId::MultiPoint => {
-            Geometry::MultiPoint(generate_random_multipoint(rng, options))
+            Geometry::MultiPoint(generate_random_multipoint(rng, options)?)
         }
         GeometryTypeId::MultiLineString => {
-            Geometry::MultiLineString(generate_random_multilinestring(rng, options))
+            Geometry::MultiLineString(generate_random_multilinestring(rng, options)?)
         }
         GeometryTypeId::MultiPolygon => {
-            Geometry::MultiPolygon(generate_random_multipolygon(rng, options))
+            Geometry::MultiPolygon(generate_random_multipolygon(rng, options)?)
         }
         GeometryTypeId::GeometryCollection => {
-            Geometry::GeometryCollection(generate_random_geometrycollection(rng, options))
+            Geometry::GeometryCollection(generate_random_geometrycollection(rng, options)?)
         }
         GeometryTypeId::Geometry => {
             let mut copy_options = options.clone();
             copy_options.geom_type = pick_random_geometry_type(rng);
-            generate_random_geometry(rng, &copy_options)
+            generate_random_geometry(rng, &copy_options)?
         }
-    }
+    })
 }
 
-fn generate_random_point<R: rand::Rng>(rng: &mut R, options: &RandomGeometryOptions) -> Point {
-    if rng.gen_bool(options.empty_rate) {
+fn generate_random_point<R: rand::Rng>(
+    rng: &mut R,
+    options: &RandomGeometryOptions,
+) -> Result<Point> {
+    if rng.random_bool(options.empty_rate) {
         // This is a bit of a hack because geo-types doesn't support empty point; however,
         // this does work with respect to sending this directly to the WKB reader and getting
         // the WKB result we want
-        Point::new(f64::NAN, f64::NAN)
+        Ok(Point::new(f64::NAN, f64::NAN))
     } else {
         // Generate random points within the specified bounds
-        let x_dist = Uniform::new(options.bounds.min().x, options.bounds.max().x);
-        let y_dist = Uniform::new(options.bounds.min().y, options.bounds.max().y);
+        let x_dist = Uniform::new(options.bounds.min().x, options.bounds.max().x)
+            .map_err(|e| DataFusionError::External(Box::new(e)))?;
+        let y_dist = Uniform::new(options.bounds.min().y, options.bounds.max().y)
+            .map_err(|e| DataFusionError::External(Box::new(e)))?;
         let x = rng.sample(x_dist);
         let y = rng.sample(y_dist);
-        Point::new(x, y)
+        Ok(Point::new(x, y))
     }
 }
 
 fn generate_random_linestring<R: rand::Rng>(
     rng: &mut R,
     options: &RandomGeometryOptions,
-) -> LineString {
-    if rng.gen_bool(options.empty_rate) {
-        LineString::new(vec![])
+) -> Result<LineString> {
+    if rng.random_bool(options.empty_rate) {
+        Ok(LineString::new(vec![]))
     } else {
-        let (center_x, center_y, half_size) = generate_random_circle(rng, options);
+        let (center_x, center_y, half_size) = generate_random_circle(rng, options)?;
         let vertices_dist = Uniform::new_inclusive(
             options.vertices_per_linestring_range.0,
             options.vertices_per_linestring_range.1,
-        );
+        )
+        .unwrap();

Review Comment:
   Using unwrap() here will panic with a generic message if Uniform::new_inclusive fails. Since other Uniform::new calls in this file use expect() with descriptive messages (e.g., line 615 'Valid input range'), these should also use expect() for consistency and better error messages, such as '.expect(\"valid vertices_per_linestring_range\")'.
   ```suggestion
           .expect("valid vertices_per_linestring_range");
   ```



##########
rust/sedona-testing/src/benchmark_util.rs:
##########
@@ -424,7 +424,7 @@ impl BenchmarkArgSpec {
             }
             BenchmarkArgSpec::Int32(lo, hi) => {
                 let mut rng = self.rng(i);
-                let dist = Uniform::new(lo, hi);
+                let dist = Uniform::new(lo, hi).unwrap();

Review Comment:
   Using unwrap() here will panic with a generic message if the range is invalid. Consider using expect() with a descriptive message such as '.expect(\"valid range for Uniform distribution\")' to provide better error context when Uniform::new fails.



##########
rust/sedona-testing/src/benchmark_util.rs:
##########
@@ -402,7 +402,7 @@ impl BenchmarkArgSpec {
             ),
             BenchmarkArgSpec::Int64(lo, hi) => {
                 let mut rng = self.rng(i);
-                let dist = Uniform::new(lo, hi);
+                let dist = Uniform::new(lo, hi).unwrap();

Review Comment:
   Using unwrap() here will panic with a generic message if the range is invalid. Consider using expect() with a descriptive message such as '.expect(\"valid range for Uniform distribution\")' to provide better error context when Uniform::new fails.



##########
rust/sedona-testing/src/datagen.rs:
##########
@@ -511,167 +514,178 @@ fn generate_random_wkb<R: rand::Rng>(rng: &mut R, options: &RandomGeometryOption
             endianness: Endianness::LittleEndian,
         },
     )
-    .unwrap();
-    out
+    .map_err(|e| DataFusionError::External(Box::new(e)))?;
+    Ok(out)
 }
 
 fn generate_random_geometry<R: rand::Rng>(
     rng: &mut R,
     options: &RandomGeometryOptions,
-) -> Geometry {
-    match options.geom_type {
-        GeometryTypeId::Point => Geometry::Point(generate_random_point(rng, options)),
+) -> Result<Geometry> {
+    Ok(match options.geom_type {
+        GeometryTypeId::Point => Geometry::Point(generate_random_point(rng, options)?),
         GeometryTypeId::LineString => {
-            Geometry::LineString(generate_random_linestring(rng, options))
+            Geometry::LineString(generate_random_linestring(rng, options)?)
         }
-        GeometryTypeId::Polygon => Geometry::Polygon(generate_random_polygon(rng, options)),
+        GeometryTypeId::Polygon => Geometry::Polygon(generate_random_polygon(rng, options)?),
         GeometryTypeId::MultiPoint => {
-            Geometry::MultiPoint(generate_random_multipoint(rng, options))
+            Geometry::MultiPoint(generate_random_multipoint(rng, options)?)
         }
         GeometryTypeId::MultiLineString => {
-            Geometry::MultiLineString(generate_random_multilinestring(rng, options))
+            Geometry::MultiLineString(generate_random_multilinestring(rng, options)?)
         }
         GeometryTypeId::MultiPolygon => {
-            Geometry::MultiPolygon(generate_random_multipolygon(rng, options))
+            Geometry::MultiPolygon(generate_random_multipolygon(rng, options)?)
         }
         GeometryTypeId::GeometryCollection => {
-            Geometry::GeometryCollection(generate_random_geometrycollection(rng, options))
+            Geometry::GeometryCollection(generate_random_geometrycollection(rng, options)?)
         }
         GeometryTypeId::Geometry => {
             let mut copy_options = options.clone();
             copy_options.geom_type = pick_random_geometry_type(rng);
-            generate_random_geometry(rng, &copy_options)
+            generate_random_geometry(rng, &copy_options)?
         }
-    }
+    })
 }
 
-fn generate_random_point<R: rand::Rng>(rng: &mut R, options: &RandomGeometryOptions) -> Point {
-    if rng.gen_bool(options.empty_rate) {
+fn generate_random_point<R: rand::Rng>(
+    rng: &mut R,
+    options: &RandomGeometryOptions,
+) -> Result<Point> {
+    if rng.random_bool(options.empty_rate) {
         // This is a bit of a hack because geo-types doesn't support empty point; however,
         // this does work with respect to sending this directly to the WKB reader and getting
         // the WKB result we want
-        Point::new(f64::NAN, f64::NAN)
+        Ok(Point::new(f64::NAN, f64::NAN))
     } else {
         // Generate random points within the specified bounds
-        let x_dist = Uniform::new(options.bounds.min().x, options.bounds.max().x);
-        let y_dist = Uniform::new(options.bounds.min().y, options.bounds.max().y);
+        let x_dist = Uniform::new(options.bounds.min().x, options.bounds.max().x)
+            .map_err(|e| DataFusionError::External(Box::new(e)))?;
+        let y_dist = Uniform::new(options.bounds.min().y, options.bounds.max().y)
+            .map_err(|e| DataFusionError::External(Box::new(e)))?;
         let x = rng.sample(x_dist);
         let y = rng.sample(y_dist);
-        Point::new(x, y)
+        Ok(Point::new(x, y))
     }
 }
 
 fn generate_random_linestring<R: rand::Rng>(
     rng: &mut R,
     options: &RandomGeometryOptions,
-) -> LineString {
-    if rng.gen_bool(options.empty_rate) {
-        LineString::new(vec![])
+) -> Result<LineString> {
+    if rng.random_bool(options.empty_rate) {
+        Ok(LineString::new(vec![]))
     } else {
-        let (center_x, center_y, half_size) = generate_random_circle(rng, options);
+        let (center_x, center_y, half_size) = generate_random_circle(rng, options)?;
         let vertices_dist = Uniform::new_inclusive(
             options.vertices_per_linestring_range.0,
             options.vertices_per_linestring_range.1,
-        );
+        )
+        .unwrap();
         // Always sample in such a way that we end up with a valid linestring
         let num_vertices = rng.sample(vertices_dist).max(2);
         let coords =
-            generate_circular_vertices(rng, center_x, center_y, half_size, num_vertices, false);
-        LineString::from(coords)
+            generate_circular_vertices(rng, center_x, center_y, half_size, num_vertices, false)?;
+        Ok(LineString::from(coords))
     }
 }
 
-fn generate_random_polygon<R: rand::Rng>(rng: &mut R, options: &RandomGeometryOptions) -> Polygon {
-    if rng.gen_bool(options.empty_rate) {
-        Polygon::new(LineString::new(vec![]), vec![])
+fn generate_random_polygon<R: rand::Rng>(
+    rng: &mut R,
+    options: &RandomGeometryOptions,
+) -> Result<Polygon> {
+    if rng.random_bool(options.empty_rate) {
+        Ok(Polygon::new(LineString::new(vec![]), vec![]))
     } else {
-        let (center_x, center_y, half_size) = generate_random_circle(rng, options);
+        let (center_x, center_y, half_size) = generate_random_circle(rng, options)?;
         let vertices_dist = Uniform::new_inclusive(
             options.vertices_per_linestring_range.0,
             options.vertices_per_linestring_range.1,
-        );
+        )
+        .unwrap();

Review Comment:
   Using unwrap() here will panic with a generic message if Uniform::new_inclusive fails. Since other Uniform::new calls in this file use expect() with descriptive messages (e.g., line 615 'Valid input range'), these should also use expect() for consistency and better error messages, such as '.expect(\"valid vertices_per_linestring_range\")'.



##########
rust/sedona/src/context.rs:
##########
@@ -509,12 +509,14 @@ struct ThreadSafeDialect {
 unsafe impl Send for ThreadSafeDialect {}
 
 impl ThreadSafeDialect {
-    pub fn try_new(dialect_str: &str) -> Result<Self> {
-        let dialect = dialect_from_str(dialect_str)
-            .ok_or_else(|| plan_datafusion_err!("Unsupported SQL dialect: {dialect_str}"))?;
-        Ok(Self {
-            inner: dialect.into(),
-        })
+    pub fn try_new(dialect: &datafusion::config::Dialect) -> Result<Self> {
+        if let Some(box_dialect) = dialect_from_str(dialect) {
+            Ok(Self {
+                inner: box_dialect.into(),
+            })
+        } else {
+            plan_err!("Unexpected dialect: {dialect}")

Review Comment:
   The error message 'Unexpected dialect' is unclear since this code path is reached when dialect_from_str returns None, not when an unexpected dialect is provided. Consider changing to 'Unsupported SQL dialect' or 'Failed to parse SQL dialect' to better reflect the actual error condition.
   ```suggestion
               plan_err!("Unsupported SQL dialect: {dialect}")
   ```



##########
rust/sedona-testing/src/benchmark_util.rs:
##########
@@ -413,7 +413,7 @@ impl BenchmarkArgSpec {
             }
             BenchmarkArgSpec::Float64(lo, hi) => {
                 let mut rng = self.rng(i);
-                let dist = Uniform::new(lo, hi);
+                let dist = Uniform::new(lo, hi).unwrap();

Review Comment:
   Using unwrap() here will panic with a generic message if the range is invalid. Consider using expect() with a descriptive message such as '.expect(\"valid range for Uniform distribution\")' to provide better error context when Uniform::new fails.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] chore: Update to Arrow 57, DataFusion 50 [sedona-db]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #466:
URL: https://github.com/apache/sedona-db/pull/466


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org