This is an automated email from the ASF dual-hosted git repository.

xushiyan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hudi-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 8d3c3e1  feat: remove table version 5 support (#409)
8d3c3e1 is described below

commit 8d3c3e1672248cd693b7b48df9d9b9ee7c5e1982
Author: Yunchi Pang <[email protected]>
AuthorDate: Sat Aug 23 20:03:01 2025 -0700

    feat: remove table version 5 support (#409)
    
    
    ---------
    
    Signed-off-by: Yunchi Pang <[email protected]>
---
 crates/core/src/table/validation.rs | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/crates/core/src/table/validation.rs 
b/crates/core/src/table/validation.rs
index 2694c62..a2564f5 100644
--- a/crates/core/src/table/validation.rs
+++ b/crates/core/src/table/validation.rs
@@ -45,9 +45,9 @@ pub fn validate_configs(hudi_configs: &HudiConfigs) -> 
crate::error::Result<()>
 
     // additional validation
     let table_version = hudi_configs.get(TableVersion)?.to::<isize>();
-    if !(5..=6).contains(&table_version) {
+    if table_version != 6 {
         return Err(CoreError::Unsupported(
-            "Only support table version 5 and 6.".to_string(),
+            "Only support table version 6.".to_string(),
         ));
     }
 
@@ -72,3 +72,29 @@ pub fn validate_configs(hudi_configs: &HudiConfigs) -> 
crate::error::Result<()>
 
     Ok(())
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::config::table::HudiTableConfig::{TableName, TableType, 
TableVersion};
+    use crate::config::HudiConfigs;
+    use std::collections::HashMap;
+
+    #[test]
+    fn test_table_version_5_unsupported() {
+        let mut options = HashMap::new();
+        options.insert(TableName.as_ref().to_string(), 
"test_table".to_string());
+        options.insert(TableType.as_ref().to_string(), 
"COPY_ON_WRITE".to_string());
+        options.insert(TableVersion.as_ref().to_string(), "5".to_string());
+
+        let configs = HudiConfigs::new(options);
+        let result = validate_configs(&configs);
+
+        assert!(result.is_err());
+        if let Err(CoreError::Unsupported(msg)) = result {
+            assert_eq!(msg, "Only support table version 6.");
+        } else {
+            panic!("Expected CoreError::Unsupported for table version 5");
+        }
+    }
+}

Reply via email to