blackmwk commented on code in PR #3091:
URL: https://github.com/apache/iceberg-rust/pull/3091#discussion_r3881039936


##########
crates/iceberg/src/scan/task.rs:
##########
@@ -158,15 +252,31 @@ pub struct FileScanTask {
     ///
     /// Note on the trust boundary: for the standard encryption scheme this
     /// carries `StandardKeyMetadata`, whose payload is the *plaintext* DEK.
-    /// Because `FileScanTask` derives `Serialize`, that plaintext DEK is part
+    /// Because `FileScanTask` implements [`Serialize`], that plaintext DEK is 
part
     /// of the serialized scan plan should these tasks ever be serialized and 
sent
     /// over the network.
-    #[serde(default)]
-    #[serde(skip_serializing_if = "Option::is_none")]
     #[builder(default)]
     pub key_metadata: Option<Box<[u8]>>,
 }
 
+impl Serialize for FileScanTask {
+    fn serialize<__S>(&self, __serializer: __S) -> 
std::result::Result<__S::Ok, __S::Error>
+    where __S: serde::Serializer {
+        _serde::FileScanTaskSerde::try_from(self)
+            .map_err(serde::ser::Error::custom)?
+            .serialize(__serializer)
+    }
+}
+
+impl<'de> Deserialize<'de> for FileScanTask {

Review Comment:
   These can be simplifed with serde_with function in attribute.



##########
crates/iceberg/src/scan/task.rs:
##########
@@ -18,39 +18,153 @@
 use std::sync::Arc;
 
 use futures::stream::BoxStream;
-use serde::{Deserialize, Serialize, Serializer};
+use serde::{Deserialize, Serialize};
 use typed_builder::TypedBuilder;
 
 use crate::Result;
 use crate::expr::BoundPredicate;
 use crate::spec::{
-    DataContentType, DataFileFormat, ManifestEntryRef, NameMapping, 
PartitionSpec, Schema,
-    SchemaRef, Struct, StructType,
+    DataContentType, DataFileFormat, Literal, ManifestEntryRef, NameMapping, 
PartitionSpec,
+    RawLiteral, Schema, SchemaRef, Struct, StructType, Type,
 };
 
 /// A stream of [`FileScanTask`].
 pub type FileScanTaskStream = BoxStream<'static, Result<FileScanTask>>;
 
-/// Serialization helper that always returns NotImplementedError.
-/// Used for fields that should not be serialized but we want to be explicit 
about it.
-fn serialize_not_implemented<S, T>(_: &T, _: S) -> std::result::Result<S::Ok, 
S::Error>
-where S: Serializer {
-    Err(serde::ser::Error::custom(
-        "Serialization not implemented for this field",
-    ))
-}
+mod _serde {

Review Comment:
   Move this to place before tests mod



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to