@@ -439,10 +439,11 @@ pub enum DataType {
439439 Custom ( ObjectName , Vec < String > ) ,
440440 /// Arrays.
441441 Array ( ArrayElemTypeDef ) ,
442- /// Map, see [ClickHouse].
442+ /// Map, see [ClickHouse], [Hive] .
443443 ///
444444 /// [ClickHouse]: https://clickhouse.com/docs/en/sql-reference/data-types/map
445- Map ( Box < DataType > , Box < DataType > ) ,
445+ /// [Hive]: https://hive.apache.org/docs/latest/language/languagemanual-types/
446+ Map ( Box < DataType > , Box < DataType > , MapBracketKind ) ,
446447 /// Tuple, see [ClickHouse].
447448 ///
448449 /// [ClickHouse]: https://clickhouse.com/docs/en/sql-reference/data-types/tuple
@@ -785,9 +786,14 @@ impl fmt::Display for DataType {
785786 DataType :: LowCardinality ( data_type) => {
786787 write ! ( f, "LowCardinality({data_type})" )
787788 }
788- DataType :: Map ( key_data_type, value_data_type) => {
789- write ! ( f, "Map({key_data_type}, {value_data_type})" )
790- }
789+ DataType :: Map ( key_data_type, value_data_type, bracket) => match bracket {
790+ MapBracketKind :: Parentheses => {
791+ write ! ( f, "Map({key_data_type}, {value_data_type})" )
792+ }
793+ MapBracketKind :: AngleBrackets => {
794+ write ! ( f, "MAP<{key_data_type}, {value_data_type}>" )
795+ }
796+ } ,
791797 DataType :: Tuple ( fields) => {
792798 write ! ( f, "Tuple({})" , display_comma_separated( fields) )
793799 }
@@ -904,6 +910,17 @@ pub enum StructBracketKind {
904910 AngleBrackets ,
905911}
906912
913+ /// Type of brackets used for `MAP` types.
914+ #[ derive( Debug , Clone , Copy , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
915+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
916+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
917+ pub enum MapBracketKind {
918+ /// Example: `Map(String, UInt16)`
919+ Parentheses ,
920+ /// Example: `MAP<STRING, INT>`
921+ AngleBrackets ,
922+ }
923+
907924/// Timestamp and Time data types information about TimeZone formatting.
908925///
909926/// This is more related to a display information than real differences between each variant. To
0 commit comments