anoopj commented on code in PR #3483:
URL: https://github.com/apache/iceberg-rust/pull/3483#discussion_r4333179453


##########
crates/iceberg/src/spec/manifest/data_file.rs:
##########
@@ -427,4 +462,82 @@ mod test {
     fn test_data_content_type_default_value() {
         assert_eq!(DataContentType::default() as i32, 0);
     }
+
+    #[test]
+    fn promoted_partition_widens_int_and_float() {
+        // Partition columns promoted int -> long and float -> double; a file
+        // written before the promotion still carries the narrower types.
+        let partition_type = StructType::new(vec![
+            NestedField::required(1000, "b", 
Type::Primitive(PrimitiveType::Long)).into(),
+            NestedField::required(1001, "c", 
Type::Primitive(PrimitiveType::Double)).into(),
+        ]);
+
+        let data_file = DataFileBuilder::default()
+            .content(DataContentType::Data)
+            .file_path("x.parquet".to_string())
+            .file_format(DataFileFormat::Parquet)
+            .partition(Struct::from_iter([
+                Some(Literal::int(7)),
+                Some(Literal::float(1.5_f32)),
+            ]))
+            .record_count(1)
+            .file_size_in_bytes(1)
+            .partition_spec_id(0)
+            .build()
+            .unwrap();
+
+        assert_eq!(
+            data_file.promoted_partition(&partition_type),
+            Struct::from_iter([Some(Literal::long(7)), 
Some(Literal::double(1.5))])
+        );
+    }
+
+    #[test]
+    fn promoted_partition_widens_dropped_source_to_ceiling() {
+        // A dropped partition source resolves to `Unknown`, so there is no 
target
+        // type; the value still widens to its ceiling so it keeps matching 
deletes
+        // written while the source still existed.
+        let partition_type = StructType::new(vec![
+            NestedField::required(1000, "b", 
Type::Primitive(PrimitiveType::Unknown)).into(),

Review Comment:
    The real spec.partition_type(...) drop-to-Unknown mapping is now exercised 
end to end: the new scan tests drop the source via a helper that empties the 
spec and removes the field, then plan through the same partition_type call, so 
a change to that mapping would break them. 



-- 
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