If your Databricks data contains non-display characters Line Feeds (LF or '0A'x) or Carriage Returns (CR '0D'x), BULKUNLOAD from Databricks might result in one or more of the following errors...
ERROR: Invalid data format in BULKUNLOAD stream. If the data contains the delimiter character you can use BL_USE_ESCAPE=YES to fix this error.
ERROR: read_and_convert_data_file(1): get_column_data failed, rc = 0xfffffc1a
ERROR: Message from TK: An invalid number was found in buffer.
ERROR: read_and_convert_data_file(1): tkzsu8ToDouble failed, rc = 0x803fe810
In addition, the following might occur:
- More rows are returned than expected.
- Wrong values occur in the result set.
- The position of the problem-column in the result set might affect the results that are returned.
- BL_USE_ESCAPE does not address the problem.
Workaround
To work around this issue, do any of the following:
- Do not include the columns that have values that contain the '0A'x and/or '0D'x non-display characters.
- Clean the source data to remove the embedded non-display characters.
- Create a Databricks view of the Databricks table that transforms those non-display characters to a character. Here is an example:
proc sql ;
connect to spark (connection-options) ;
execute by spark (CREATE OR REPLACE VIEW schema.view-name AS
SELECT other-columns,
CASE
WHEN problem-column RLIKE '[\r\n]' THEN regexp_replace(problem-column, '[\r\n]+', ' ')
ELSE problem-column
END AS problem-column,
other-columns
FROM schema.table-name; ) ;
quit ;
Resolution
With the hot fix for this issue, you will be able to use undocumented parameters to BL_OPTIONS. (That is, BL_OPTIONS='BL_ROW_DELIMITER=CR'.)