Athena UNLOAD and empty values

1

Im saving data to JSON using UNLOAD Athena command. Some of non-string fields are empty. UNLOAD command puts null's everywhere instead. Is there any way to tell Athena to skip serialization of a field if it is empty?

profile picture
Smotrov
質問済み 7ヶ月前299ビュー
1回答
0

When using the Amazon Athena UNLOAD command, it uses the default serializer LazySimpleSerDe. This serializer outputs empty values as Null, like you are experiencing, and cannot be changed.

One option is to specify each column in your select that you do not want to output to null and use a function to transform nulls. This would be instead of doing a SELECT *.

For example:

UNLOAD (SELECT col1, COALESCE(col2,'') FROM table)
TO 's3://my_athena_data_location/my_folder/'
WITH (format = 'JSON')

References:

profile pictureAWS
Jen_F
回答済み 7ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ