Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ rmp-serde = "1.3"
ryu = "1.0.13"
schemars = { version = "0.8.22", features = ["preserve_order"] }
serde = { version = "1.0.188", features = ["derive", "rc"] }
serde_ignored = "0.1.12"
serde_json = "1"
sha2 = "0.10"
simd-json = { version = "0.15", features = ["known-key"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-plan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ allow_unused = ["polars-io/allow_unused", "polars-ops/allow_unused", "polars-tim

bigidx = ["polars-core/bigidx", "polars-utils/bigidx"]
polars_cloud_client = ["serde"]
polars_cloud_server = ["serde", "polars-utils/polars_cloud_server"]
polars_cloud_server = ["serde"]
ir_serde = ["serde", "polars-utils/ir_serde"]

[package.metadata.docs.rs]
Expand Down
2 changes: 0 additions & 2 deletions crates/polars-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ regex = { workspace = true }
rmp-serde = { workspace = true, optional = true }
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
serde_ignored = { workspace = true, optional = true }
serde_json = { workspace = true, optional = true }
slotmap = { workspace = true }
stacker = { workspace = true }
Expand Down Expand Up @@ -57,7 +56,6 @@ serde = [
"uuid/serde",
]
dsl-schema = ["dep:schemars"]
polars_cloud_server = ["dep:serde_ignored"]
python = ["pyo3", "polars-error/python"]

[lints]
Expand Down
70 changes: 0 additions & 70 deletions crates/polars-utils/src/pl_serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@ where
}
}

#[cfg(feature = "polars_cloud_server")]
/// Deserializes the value and collects paths to all unknown fields.
fn deserialize_with_unknown_fields<T, R>(reader: R) -> PolarsResult<(T, Vec<String>)>
where
T: serde::de::DeserializeOwned,
R: std::io::Read,
{
let mut de = rmp_serde::Deserializer::new(reader);
let mut unknown_fields = Vec::new();
let t = serde_ignored::deserialize(&mut de, |path| {
unknown_fields.push(path.to_string());
});
t.map(|t| (t, unknown_fields)).map_err(to_compute_err)
}

/// Mainly used to enable compression when serializing the final outer value.
/// For intermediate serialization steps, the function in the module should
/// be used instead.
Expand Down Expand Up @@ -95,25 +80,6 @@ impl SerializeOptions {
}
}

/// Deserializes the value and collects paths to all unknown fields.
///
/// Supports only the future-compatible format (`FC: true`).
#[cfg(feature = "polars_cloud_server")]
pub fn deserialize_from_reader_with_unknown_fields<T, R>(
&self,
reader: R,
) -> PolarsResult<(T, Vec<String>)>
where
T: serde::de::DeserializeOwned,
R: std::io::Read,
{
if self.compression {
deserialize_with_unknown_fields(flate2::read::ZlibDecoder::new(reader))
} else {
deserialize_with_unknown_fields(reader)
}
}

pub fn serialize_to_bytes<T, const FC: bool>(&self, value: &T) -> PolarsResult<Vec<u8>>
where
T: serde::ser::Serialize,
Expand Down Expand Up @@ -327,40 +293,4 @@ mod tests {

assert_eq!(r, v);
}

#[cfg(feature = "polars_cloud_server")]
#[test]
fn test_serde_collect_unknown_fields() {
#[derive(Clone, Copy, serde::Serialize)]
struct A {
x: bool,
u: u8,
}

#[derive(serde::Serialize)]
enum E {
V { val: A, ch: char },
}

#[derive(serde::Deserialize)]
struct B {
u: u8,
}

#[derive(serde::Deserialize)]
enum F {
V { val: B },
}

let a = A { u: 42, x: true };
let e = E::V { val: a, ch: 'x' };

let buf: Vec<u8> = super::serialize_to_bytes::<_, true>(&e).unwrap();
let (f, unknown) = super::deserialize_with_unknown_fields::<F, _>(buf.as_slice()).unwrap();

let F::V { val: b } = f;

assert_eq!(a.u, b.u);
assert_eq!(unknown.as_slice(), &["val.x", "ch"]);
}
}
Loading