Big Query job fails with “Bad character (ASCII 0) encountered.”

后端 未结 3 663
孤街浪徒
孤街浪徒 2021-01-22 17:55

I have a job that is failing with the error

Line:14222274 / Field:1, Bad character (ASCII 0) encountered. Rest of file not processed.

<
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-22 18:47

    Bad character (ASCII 0) encountered. Rest of file not processed.

    Clearly states you have a UTF-16 character there which cannot be decoded. BigQuery service only supports UTF-8 and latin1 text encodings. So, the file is supposed to be UTF-8 encoded.

    There are only 14222273 lines in the file, so the line number that is printed in the error message is one line past the end of the file.

    Probably you have a UTF-16 encoded tab character at the end of the file, which cannot be decoded.


    Solution: Use the -a or --ascii flag with gzip command. It'll be decoded ok by bigquery.

提交回复
热议问题