Using a Custom Format
You specify a custom data format in the FORMAT
clause of CREATE EXTERNAL TABLE
.
FORMAT 'CUSTOM' (formatter=format_function, key1=val1,...keyn=valn)
Where the 'CUSTOM'
keyword indicates that the data has a custom format and formatter
specifies the function to use to format the data, followed by comma-separated parameters to the formatter function.
HAWQ provides functions for formatting fixed-width data, but you must author the formatter functions for variable-width data. The steps are as follows.
- Author and compile input and output functions as a shared library.
- Specify the shared library function with
CREATE FUNCTION
in HAWQ. - Use the
formatter
parameter ofCREATE EXTERNAL TABLE
’sFORMAT
clause to call the function.