File tree Expand file tree Collapse file tree
crates/fluss/src/metadata Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1170,6 +1170,11 @@ impl DataField {
11701170 pub fn data_type ( & self ) -> & DataType {
11711171 & self . data_type
11721172 }
1173+
1174+ /// Returns the description of the field, if any.
1175+ pub fn description ( & self ) -> Option < & str > {
1176+ self . description . as_deref ( )
1177+ }
11731178}
11741179
11751180impl Display for DataField {
@@ -1469,3 +1474,26 @@ fn test_timestamp_ltz_invalid_precision() {
14691474 . contains( "Timestamp with local time zone precision must be between 0 and 9" )
14701475 ) ;
14711476}
1477+
1478+ #[ test]
1479+ fn test_datafield_description ( ) {
1480+ // Test field with description
1481+ let field_with_desc = DataTypes :: field_with_description (
1482+ "user_id" ,
1483+ DataTypes :: bigint ( ) ,
1484+ "Unique identifier for the user" . to_string ( ) ,
1485+ ) ;
1486+ assert_eq ! (
1487+ field_with_desc. description( ) ,
1488+ Some ( "Unique identifier for the user" )
1489+ ) ;
1490+
1491+ // Test field without description
1492+ let field_no_desc = DataTypes :: field ( "name" , DataTypes :: string ( ) ) ;
1493+ assert_eq ! ( field_no_desc. description( ) , None ) ;
1494+
1495+ // Test that description() returns a reference to the description
1496+ let desc = field_with_desc. description ( ) ;
1497+ assert ! ( desc. is_some( ) ) ;
1498+ assert_eq ! ( desc. unwrap( ) , "Unique identifier for the user" ) ;
1499+ }
You can’t perform that action at this time.
0 commit comments