...
As of Hive 0.14 a registration mechanism has been introduced for native Hive SerDe's to bind . This allows dynamic binding between a 'STORED AS' syntax naturally as a shorthand for keyword in place of a triplet of {SerDe, InputFormat, and OutputFormat} specification, in CreateTable statement statements.
The following mappings have been added through this registration mechanism:
Syntax | Equivalent |
---|---|
STORED AS AVRO/ STORED AS AVROFILE | ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat' |
STORED AS ORC/ STORED AS ORCFILE | ROW FORMAT SERDE
' STORED AS INPUTFORMAT
' OUTPUTFORMAT
' |
STORED AS PARQUET/ STORED AS PARQUETFILE | ROW FORMAT SERDE
' STORED AS INPUTFORMAT
' OUTPUTFORMAT
' |
STORED AS RCFILE | STORED AS INPUTFORMAT org.apache.hadoop.hive.ql.io.RCFileInputFormat' OUTPUTFORMAT
' |
STORED AS TEXTFILE | STORED AS INPUTFORMAT
' OUTPUTFORMAT
|
To add a new native SerDe with STORED AS syntaxkeyword, follow these steps:
Create a storage format descriptor class extending from AbstractStorageFormatDescriptor.java that returns a stored as keyword to {, and name of InputFormat, OutputFormat, and SerDe } triplet mappingclasses.
Add the name of the storage format descriptor class to StorageFormatDescriptor registration file.
...