Skip to content

Commit

Permalink
fix: use url encoder for serialize_encoded (#2705)
Browse files Browse the repository at this point in the history
# Description
First parse in path and then encode, otherwise Path::from does double
encoding if you do it reversed.

# Related Issue(s)
- closes #2634
  • Loading branch information
ion-elgreco authored Jul 25, 2024
1 parent 1e7b8da commit 384d898
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ tracing = { version = "0.1", features = ["log"] }
regex = { version = "1" }
thiserror = { version = "1" }
url = { version = "2" }
urlencoding = "2.1.3"
uuid = { version = "1" }

# runtime / async
Expand Down
1 change: 1 addition & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ regex = { workspace = true }
thiserror = { workspace = true }
uuid = { workspace = true, features = ["serde", "v4"] }
url = { workspace = true }
urlencoding = { workspace = true}

# runtime
async-trait = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/kernel/scalars.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Auxiliary methods for dealing with kernel scalars
//!
use std::cmp::Ordering;

use arrow_array::Array;
use arrow_schema::TimeUnit;
use chrono::{DateTime, TimeZone, Utc};
Expand All @@ -10,6 +8,8 @@ use delta_kernel::{
schema::StructField,
};
use object_store::path::Path;
use std::cmp::Ordering;
use urlencoding::encode;

use crate::NULL_PARTITION_VALUE_DATA_PATH;

Expand Down Expand Up @@ -76,7 +76,7 @@ impl ScalarExt for Scalar {
if self.is_null() {
return NULL_PARTITION_VALUE_DATA_PATH.to_string();
}
Path::from(self.serialize()).to_string()
encode(Path::from(self.serialize()).as_ref()).to_string()
}

/// Create a [`Scalar`] form a row in an arrow array.
Expand Down

0 comments on commit 384d898

Please sign in to comment.