This is an automated email from the ASF dual-hosted git repository.
kontinuation 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 a0c6b9f8 chore(rust/sedona-geoparquet): Fix clippy errors (#540)
a0c6b9f8 is described below
commit a0c6b9f86d65a066cb1974e0309c3b14f40dc9c7
Author: Dewey Dunnington <[email protected]>
AuthorDate: Fri Jan 23 03:47:42 2026 -0600
chore(rust/sedona-geoparquet): Fix clippy errors (#540)
On main we have several clippy errors:
```
Checking sedona-geoparquet v0.3.0
(/home/runner/work/sedona-db/sedona-db/rust/sedona-geoparquet)
error: called `unwrap` on `item.value` after checking its variant with
`is_some`
--> rust/sedona-geoparquet/src/format.rs:210:57
|
208 | if item.key == "geo" && item.value.is_some() {
| -------------------- the
check is happening here
209 | let this_geoparquet_metadata =
210 |
GeoParquetMetadata::try_new(item.value.as_ref().unwrap())?;
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try using `match`
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap
= note: `-D clippy::unnecessary-unwrap` implied by `-D warnings`
= help: to override `-D warnings` add
`#[allow(clippy::unnecessary_unwrap)]`
error: called `unwrap` on `item.value` after checking its variant with
`is_some`
--> rust/sedona-geoparquet/src/metadata.rs:389:50
|
388 | if item.key == "geo" && item.value.is_some() {
| -------------------- the
check is happening here
389 | return
Ok(Some(Self::try_new(item.value.as_ref().unwrap())?));
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try using `match`
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap
error: could not compile `sedona-geoparquet` (lib) due to 2 previous errors
```
This PR fixes them!
---
rust/sedona-geoparquet/src/format.rs | 8 +++++---
rust/sedona-geoparquet/src/metadata.rs | 8 ++++++--
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/rust/sedona-geoparquet/src/format.rs
b/rust/sedona-geoparquet/src/format.rs
index c31b2d25..0da807b3 100644
--- a/rust/sedona-geoparquet/src/format.rs
+++ b/rust/sedona-geoparquet/src/format.rs
@@ -205,9 +205,11 @@ impl FileFormat for GeoParquetFormat {
for metadata in &metadatas {
if let Some(kv) = metadata.file_metadata().key_value_metadata() {
for item in kv {
- if item.key == "geo" && item.value.is_some() {
- let this_geoparquet_metadata =
-
GeoParquetMetadata::try_new(item.value.as_ref().unwrap())?;
+ if item.key != "geo" {
+ continue;
+ }
+ if let Some(value) = &item.value {
+ let this_geoparquet_metadata =
GeoParquetMetadata::try_new(value)?;
match geoparquet_metadata.as_mut() {
Some(existing) => {
diff --git a/rust/sedona-geoparquet/src/metadata.rs
b/rust/sedona-geoparquet/src/metadata.rs
index aee71ec2..39beddf0 100644
--- a/rust/sedona-geoparquet/src/metadata.rs
+++ b/rust/sedona-geoparquet/src/metadata.rs
@@ -385,8 +385,12 @@ impl GeoParquetMetadata {
pub fn try_from_parquet_metadata(metadata: &ParquetMetaData) ->
Result<Option<Self>> {
if let Some(kv) = metadata.file_metadata().key_value_metadata() {
for item in kv {
- if item.key == "geo" && item.value.is_some() {
- return
Ok(Some(Self::try_new(item.value.as_ref().unwrap())?));
+ if item.key != "geo" {
+ continue;
+ }
+
+ if let Some(value) = &item.value {
+ return Ok(Some(Self::try_new(value)?));
}
}
}