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

liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new 36aedc6fb Remove wildcard pattern in exhaustive enums (#1925)
36aedc6fb is described below

commit 36aedc6fbccec5a25d649d1792923d140ed83cbd
Author: Landon Gingerich <[email protected]>
AuthorDate: Mon Dec 15 04:16:15 2025 -0600

    Remove wildcard pattern in exhaustive enums (#1925)
    
    ## Which issue does this PR close?
    
    - Closes https://github.com/apache/iceberg-rust/issues/1924.
    
    ## What changes are included in this PR?
    
    - For match expression on `PrimitiveType`, removes wildcard and
    explicitly handles all enum variants.
    - Removes support of `PrimititveType::TimestampzNs` for HMS and Glue.
    - Hive/HMS does not support timezone aware timestamps, per [Hive
    
docs](https://cwiki.apache.org/confluence/display/hive/languagemanual+types#LanguageManualTypes-TimestampstimestampTimestamps).
    - Glue uses the Hive type system so it should also be disabled for Glue.
    
    
    ## Are these changes tested?
    
    Tested with existing test suite
---
 crates/catalog/glue/src/schema.rs | 13 ++++++-------
 crates/catalog/hms/src/schema.rs  | 13 ++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/crates/catalog/glue/src/schema.rs 
b/crates/catalog/glue/src/schema.rs
index cfd748797..864320dae 100644
--- a/crates/catalog/glue/src/schema.rs
+++ b/crates/catalog/glue/src/schema.rs
@@ -165,7 +165,12 @@ impl SchemaVisitor for GlueSchemaBuilder {
             PrimitiveType::Date => "date".to_string(),
             PrimitiveType::Timestamp => "timestamp".to_string(),
             PrimitiveType::TimestampNs => "timestamp_ns".to_string(),
-            PrimitiveType::TimestamptzNs => "timestamptz_ns".to_string(),
+            PrimitiveType::Timestamptz | PrimitiveType::TimestamptzNs => {
+                return Err(Error::new(
+                    ErrorKind::FeatureUnsupported,
+                    format!("Conversion from {p:?} is not supported"),
+                ));
+            }
             PrimitiveType::Time | PrimitiveType::String | PrimitiveType::Uuid 
=> {
                 "string".to_string()
             }
@@ -173,12 +178,6 @@ impl SchemaVisitor for GlueSchemaBuilder {
             PrimitiveType::Decimal { precision, scale } => {
                 format!("decimal({precision},{scale})")
             }
-            _ => {
-                return Err(Error::new(
-                    ErrorKind::FeatureUnsupported,
-                    "Conversion from 'Timestamptz' is not supported",
-                ));
-            }
         };
 
         Ok(glue_type)
diff --git a/crates/catalog/hms/src/schema.rs b/crates/catalog/hms/src/schema.rs
index 8893a8052..c23b48719 100644
--- a/crates/catalog/hms/src/schema.rs
+++ b/crates/catalog/hms/src/schema.rs
@@ -122,7 +122,12 @@ impl SchemaVisitor for HiveSchemaBuilder {
             PrimitiveType::Date => "date".to_string(),
             PrimitiveType::Timestamp => "timestamp".to_string(),
             PrimitiveType::TimestampNs => "timestamp_ns".to_string(),
-            PrimitiveType::TimestamptzNs => "timestamptz_ns".to_string(),
+            PrimitiveType::Timestamptz | PrimitiveType::TimestamptzNs => {
+                return Err(Error::new(
+                    ErrorKind::FeatureUnsupported,
+                    format!("Conversion from {p:?} is not supported"),
+                ));
+            }
             PrimitiveType::Time | PrimitiveType::String | PrimitiveType::Uuid 
=> {
                 "string".to_string()
             }
@@ -130,12 +135,6 @@ impl SchemaVisitor for HiveSchemaBuilder {
             PrimitiveType::Decimal { precision, scale } => {
                 format!("decimal({precision},{scale})")
             }
-            _ => {
-                return Err(Error::new(
-                    ErrorKind::FeatureUnsupported,
-                    "Conversion from 'Timestamptz' is not supported",
-                ));
-            }
         };
 
         Ok(hive_type)

Reply via email to