gpt4 book ai didi

Athena Unload TEXTFILE with null(Athena使用NULL卸载TEXTFILE)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:43 29 4
gpt4 key购买 nike



I am currently utilizing the UNLOAD feature in AWS Athena, where I query something like:

我目前正在使用AWS Athena中的卸载功能,其中我查询的内容如下:


UNLOAD (SELECT * FROM sometable) TO 's3://<location>' WITH (format = 'TEXTFILE', field_delimeter = ',')

This generates a bunch of .gz files. My issue is that all the null/empty values have been converted to \N. Is there a way to replace this with just an empty string?

这将生成一系列.gz文件。我的问题是,所有的空/空值都已转换为\n。有没有办法只用一个空字符串来替换它?


I did notice that if I just do SELECT * FROM sometable, basically not using unload, it seems to be what I want (without \N). I would like to get similar results with the unload, if its possible. There seems to be a SERDEPROPERTIES with serialization.null.format (for creating a table), but not sure how to use it with unload.

我确实注意到,如果我只使用SELECT*from sometable,基本上不使用unload,它似乎就是我想要的(没有\N)。我希望得到类似的结果与卸载,如果可能的话。似乎有一个SERDEPROPERTIES带有Serialization.null.Format(用于创建表),但不确定如何将其与UNLOAD一起使用。


更多回答

I don't think there is a way to pass this property as per documentation. Have you tried coalesce or NULLIF instead to replace null values so that this doesn't happen?

我不认为有一种方法可以按照文档传递这个属性。您是否尝试过使用Coalesce或NULLIF来替换空值,以避免发生这种情况?

How do I go about doing that? Do I do that per column?

我该怎么做呢?我是按专栏这么做的吗?

yes in the select query. You need to add it for all the columns that has null values

SELECT查询中的是。您需要为所有具有空值的列添加它

优秀答案推荐
更多回答

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com