Class HiveToSnowflakeType
- java.lang.Object
-
- net.snowflake.hivemetastoreconnector.util.HiveToSnowflakeType
-
public class HiveToSnowflakeType extends Object
A util to convert Hive types such as the hive datatype to Snowflake types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHiveToSnowflakeType.SnowflakeFileFormatTypeThe file format types suppported by Snowflake
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.ImmutableMap<String,String>hiveToSnowflakeDataTypeMapThe mapping from a Hive datatype to a Snowflake datatypestatic com.google.common.collect.ImmutableSet<String>hiveTypesWithSpecificationsThe Hive data types with specifications, e.g.
-
Constructor Summary
Constructors Constructor Description HiveToSnowflakeType()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringtoSnowflakeColumnDataType(String hiveType)converts a Hive column data type to a Snowflake datatypestatic StringtoSnowflakeFileFormat(HiveToSnowflakeType.SnowflakeFileFormatType sfFileFmtType, org.apache.hadoop.hive.metastore.api.SerDeInfo serDeInfo, Map<String,String> tableProps)converts a Hive file format to a Snowflake file formatstatic HiveToSnowflakeType.SnowflakeFileFormatTypetoSnowflakeFileFormatType(String serDeLib, String hiveFileFormat)Determines the most appropriate Snowflake file format type for a given Hive file format and SerDe.static StringtoSnowflakeURL(String hiveUrl)Converts a Hive URL to a Snowflake URL.
-
-
-
Field Detail
-
hiveToSnowflakeDataTypeMap
public static final com.google.common.collect.ImmutableMap<String,String> hiveToSnowflakeDataTypeMap
The mapping from a Hive datatype to a Snowflake datatype
-
hiveTypesWithSpecifications
public static final com.google.common.collect.ImmutableSet<String> hiveTypesWithSpecifications
The Hive data types with specifications, e.g. precision/scale or length
-
-
Method Detail
-
toSnowflakeColumnDataType
public static String toSnowflakeColumnDataType(String hiveType)
converts a Hive column data type to a Snowflake datatype- Parameters:
hiveType- The data type of the column according to Hive- Returns:
- The corresponding Snowflake data type
-
toSnowflakeURL
public static String toSnowflakeURL(String hiveUrl)
Converts a Hive URL to a Snowflake URL. Notably, - s3://, s3n://, s3a:// becomes s3:// - wasb[s]://container@account.blob.(endpoint suffix)/... becomes azure://account.blob.(endpoint suffix)/container/... Note: WASB with default storage (i.e. wasbs:///...) is not supported - gs:// becomes gcs://- Parameters:
hiveUrl- The Hive URL- Returns:
- The URL as understood by Snowflake
-
toSnowflakeFileFormat
public static String toSnowflakeFileFormat(HiveToSnowflakeType.SnowflakeFileFormatType sfFileFmtType, org.apache.hadoop.hive.metastore.api.SerDeInfo serDeInfo, Map<String,String> tableProps) throws UnsupportedOperationException
converts a Hive file format to a Snowflake file format- Parameters:
sfFileFmtType- Snowflake's file format typeserDeInfo- Details about the SerDetableProps- Table properties the table was created with- Returns:
- Snippet representing a Snowflake file format
- Throws:
UnsupportedOperationException- Thrown when the input is invalid or unsupported
-
toSnowflakeFileFormatType
public static HiveToSnowflakeType.SnowflakeFileFormatType toSnowflakeFileFormatType(String serDeLib, String hiveFileFormat) throws UnsupportedOperationException
Determines the most appropriate Snowflake file format type for a given Hive file format and SerDe.- Parameters:
serDeLib- The SerDe class that the table was created withhiveFileFormat- The file format according to Hive- Returns:
- The corresponding Snowflake file format type
- Throws:
UnsupportedOperationException- Thrown when the SerDe is invalid or unsupported.
-
-