marvinlanhenke commented on code in PR #309:
URL: https://github.com/apache/iceberg-rust/pull/309#discussion_r1543730206


##########
crates/iceberg/src/spec/transform.rs:
##########
@@ -398,6 +679,80 @@ mod tests {
         }
     }
 
+    #[test]
+    fn test_none_projection() -> Result<()> {
+        let name = "projected_name".to_string();
+        let preds = TestPredicates::new();
+
+        let transform = Transform::Void;
+        let result_unary = transform.project(name.clone(), &preds.unary)?;
+        assert!(result_unary.is_none());
+
+        let transform = Transform::Year;
+        let result_binary = transform.project(name.clone(), &preds.binary)?;
+        assert!(result_binary.is_none());
+
+        let transform = Transform::Month;
+        let result_set = transform.project(name.clone(), &preds.set)?;
+        assert!(result_set.is_none());
+
+        Ok(())
+    }
+
+    #[test]
+    fn test_truncate_project() -> Result<()> {
+        let name = "projected_name".to_string();
+        let preds = TestPredicates::new();
+
+        let transform = Transform::Truncate(10);
+
+        let result_unary = transform.project(name.clone(), 
&preds.unary)?.unwrap();
+        let result_binary = transform.project(name.clone(), 
&preds.binary)?.unwrap();
+        let result_set = transform.project(name.clone(), &preds.set)?.unwrap();
+
+        assert_eq!(format!("{}", result_unary), "projected_name IS NULL");
+        assert_eq!(format!("{}", result_binary), "projected_name = 0");
+        assert_eq!(format!("{}", result_set), "projected_name IN (0)");
+
+        Ok(())
+    }
+
+    #[test]
+    fn test_identity_project() -> Result<()> {
+        let name = "projected_name".to_string();
+        let preds = TestPredicates::new();
+
+        let transform = Transform::Identity;
+
+        let result_unary = transform.project(name.clone(), 
&preds.unary)?.unwrap();
+        let result_binary = transform.project(name.clone(), 
&preds.binary)?.unwrap();
+        let result_set = transform.project(name.clone(), &preds.set)?.unwrap();
+
+        assert_eq!(format!("{}", result_unary), "projected_name IS NULL");
+        assert_eq!(format!("{}", result_binary), "projected_name = 5");
+        assert_eq!(format!("{}", result_set), "projected_name IN (5, 6)");
+
+        Ok(())
+    }
+
+    #[test]
+    fn test_bucket_project() -> Result<()> {

Review Comment:
   @Fokko @liurenjie1024 
   ...I ported the suite for `Bucket` transforms - with all tests passing. So 
bucket impl seems to produce the correct results (at least no obvious bugs 
present). 
   
   However, PTAL. 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to