This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git


The following commit(s) were added to refs/heads/main by this push:
     new c50de9a5 fix(rust/sedona-geoparquet): Ensure reading a Parquet file 
that doesn't exist errors (#366)
c50de9a5 is described below

commit c50de9a5c480557ee11c84240626e9e2bc7aaf1f
Author: Dewey Dunnington <[email protected]>
AuthorDate: Wed Nov 26 10:23:11 2025 -0600

    fix(rust/sedona-geoparquet): Ensure reading a Parquet file that doesn't 
exist errors (#366)
---
 rust/sedona-geoparquet/src/format.rs   | 16 ++++++++++++++++
 rust/sedona-geoparquet/src/provider.rs | 12 ++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/rust/sedona-geoparquet/src/format.rs 
b/rust/sedona-geoparquet/src/format.rs
index 75eafb9d..e20adb1c 100644
--- a/rust/sedona-geoparquet/src/format.rs
+++ b/rust/sedona-geoparquet/src/format.rs
@@ -172,6 +172,12 @@ impl FileFormat for GeoParquetFormat {
         store: &Arc<dyn ObjectStore>,
         objects: &[ObjectMeta],
     ) -> Result<SchemaRef> {
+        if objects.is_empty() {
+            return plan_err!(
+                "Can't infer Parquet schema for zero objects. Does the input 
path exist?"
+            );
+        }
+
         // First, try the underlying format without schema metadata. This 
should work
         // for regular Parquet reads and will at least ensure that the 
underlying schemas
         // are compatible.
@@ -681,6 +687,16 @@ mod test {
         assert_eq!(total_size, 244);
     }
 
+    #[tokio::test]
+    async fn file_that_does_not_exist() {
+        let ctx = setup_context();
+        let err = ctx.table("file_does_not_exist.parquet").await.unwrap_err();
+        assert_eq!(
+            err.message(),
+            "failed to resolve schema: file_does_not_exist"
+        );
+    }
+
     #[rstest]
     #[tokio::test]
     async fn pruning_geoparquet_metadata(#[values("st_intersects", 
"st_contains")] udf_name: &str) {
diff --git a/rust/sedona-geoparquet/src/provider.rs 
b/rust/sedona-geoparquet/src/provider.rs
index c76d7f56..84da6ea6 100644
--- a/rust/sedona-geoparquet/src/provider.rs
+++ b/rust/sedona-geoparquet/src/provider.rs
@@ -267,5 +267,17 @@ mod test {
         assert!(err
             .message()
             .ends_with("does not match the expected extension '.parquet'"));
+
+        let err = geoparquet_listing_table(
+            &ctx,
+            
vec![ListingTableUrl::parse("this_file_does_not_exist.parquet").unwrap()],
+            GeoParquetReadOptions::default(),
+        )
+        .await
+        .unwrap_err();
+        assert_eq!(
+            err.message(),
+            "Can't infer Parquet schema for zero objects. Does the input path 
exist?"
+        );
     }
 }

Reply via email to