简体   繁体   English

雅典娜 CTAS 用 \\N 替换表中的空值

[英]Athena CTAS replacing null values in tables with \N

When I use Athena CTAS to generate CSV files, I found that null values in the Athena table are replaced by "\\N".当我使用Athena CTAS 生成CSV 文件时,我发现Athena 表中的空值被“\\N”替换。 How do I get it to just leave these values as empty columns?我如何才能将这些值保留为空列?

The CTAS query I'm using is something like this:我正在使用的 CTAS 查询是这样的:

CREATE TABLE table_name WITH (format = 'TEXTFILE', field_delimiter=',', external_location='s3://bucket_name/location') AS SELECT * FROM "db_name"."src_table_name";

Am I doing something wrong?难道我做错了什么?

This is the default token for NULL for LazySimpleSerDe , and CTAS does not expose any mechanism for changing it unfortunately.这是LazySimpleSerDe NULL的默认标记, LazySimpleSerDe ,CTAS 没有公开任何更改它的机制。

If you'd rather have empty fields for your NULL values you have to ensure they are all empty strings, eg … AS SELECT COALESCE(col1, ''), COALESCE(col2, ''), … .如果您希望NULL值有空字段,则必须确保它们都是空字符串,例如… AS SELECT COALESCE(col1, ''), COALESCE(col2, ''), …

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM