Class IcebergDataTypeParser


  • public class IcebergDataTypeParser
    extends Object
    This class is used to Iceberg data type (include primitive types and nested types) serialization and deserialization.

    This code is modified from GlobalServices/modules/data-lake/datalake-api/src/main/java/com/snowflake/metadata/iceberg /IcebergDataTypeParser.java

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.apache.iceberg.types.Type deserializeIcebergType​(String icebergDataType)
      Get Iceberg data type information by deserialization.
      static org.apache.iceberg.types.Type getTypeFromJson​(com.fasterxml.jackson.databind.JsonNode jsonNode)
      Get corresponding Iceberg data type from JsonNode.
      static org.apache.iceberg.types.Types.ListType listFromJson​(com.fasterxml.jackson.databind.JsonNode json)
      Get Iceberg list type information from JsonNode.
      static org.apache.iceberg.types.Types.MapType mapFromJson​(com.fasterxml.jackson.databind.JsonNode json)
      Get Iceberg map type from JsonNode.
      static org.apache.parquet.schema.Type parseIcebergDataTypeStringToParquetType​(String icebergDataType, org.apache.parquet.schema.Type.Repetition repetition, int id, String name)
      Get Iceberg data type information by deserialization.
      static org.apache.iceberg.types.Types.StructType structFromJson​(com.fasterxml.jackson.databind.JsonNode json)
      Get Iceberg struct type information from JsonNode.
    • Constructor Detail

      • IcebergDataTypeParser

        public IcebergDataTypeParser()
    • Method Detail

      • parseIcebergDataTypeStringToParquetType

        public static org.apache.parquet.schema.Type parseIcebergDataTypeStringToParquetType​(String icebergDataType,
                                                                                             org.apache.parquet.schema.Type.Repetition repetition,
                                                                                             int id,
                                                                                             String name)
        Get Iceberg data type information by deserialization.
        Parameters:
        icebergDataType - string representation of Iceberg data type
        repetition - repetition of the Parquet data type
        id - column id
        name - column name
        Returns:
        Iceberg data type
      • deserializeIcebergType

        public static org.apache.iceberg.types.Type deserializeIcebergType​(String icebergDataType)
        Get Iceberg data type information by deserialization.
        Parameters:
        icebergDataType - string representation of Iceberg data type
        Returns:
        Iceberg data type
      • getTypeFromJson

        public static org.apache.iceberg.types.Type getTypeFromJson​(@Nonnull
                                                                    com.fasterxml.jackson.databind.JsonNode jsonNode)
        Get corresponding Iceberg data type from JsonNode.
        Parameters:
        jsonNode - JsonNode parsed from Iceberg type string.
        Returns:
        Iceberg data type
      • structFromJson

        @Nonnull
        public static org.apache.iceberg.types.Types.StructType structFromJson​(@Nonnull
                                                                               com.fasterxml.jackson.databind.JsonNode json)
        Get Iceberg struct type information from JsonNode.
        Parameters:
        json - JsonNode parsed from Iceberg type string.
        Returns:
        struct type
      • listFromJson

        public static org.apache.iceberg.types.Types.ListType listFromJson​(com.fasterxml.jackson.databind.JsonNode json)
        Get Iceberg list type information from JsonNode.
        Parameters:
        json - JsonNode parsed from Iceberg type string.
        Returns:
        list type
      • mapFromJson

        public static org.apache.iceberg.types.Types.MapType mapFromJson​(com.fasterxml.jackson.databind.JsonNode json)
        Get Iceberg map type from JsonNode.
        Parameters:
        json - JsonNode parsed from Iceberg type string.
        Returns:
        map type