将数组转换为字符串 - Amazon Athena
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

将数组转换为字符串

要将数组转换为字符串,请使用 array_join 函数。下面的独立示例创建了一个名为的表 dataset,它包含一个名为 words 的已指定别名数组。该查询使用 array_join 将数组元素连接到 words,用空格分隔它们,然后将结果字符串返回到名为 welcome_msg 的别名列中。

WITH dataset AS ( SELECT ARRAY ['hello', 'amazon', 'athena'] AS words ) SELECT array_join(words, ' ') AS welcome_msg FROM dataset

此查询返回:

+---------------------+ | welcome_msg | +---------------------+ | hello amazon athena | +---------------------+