当某些可能为空时,我可以合并 presto DB 中的列以获取所有可能对的列表吗?
Can I coalesce a column in presto DB to get a list of all possible pairs when some might be null?
我在 Athena 中有一个数据库,假设有一个 country
、region
和 data
列。
我想获取所有唯一 country
/region
对的列表,包括 region
可能为空的情况(当数据针对整个国家/地区时就是这种情况).
我尝试了 SELECT distinct(country, region) FROM ...
但我收到错误 NOT_SUPPORTED:具有空元素的字段不支持行比较
我认为这可能有效:
SELECT distinct(coalesce(country,"none"), coalesce(region, "none") region) FROM ...
但也不走运。知道这是否可能吗?
这应该有效(没有大括号):
SELECT DISTINCT country, region FROM ...
我在 Athena 中有一个数据库,假设有一个 country
、region
和 data
列。
我想获取所有唯一 country
/region
对的列表,包括 region
可能为空的情况(当数据针对整个国家/地区时就是这种情况).
我尝试了 SELECT distinct(country, region) FROM ...
但我收到错误 NOT_SUPPORTED:具有空元素的字段不支持行比较
我认为这可能有效:
SELECT distinct(coalesce(country,"none"), coalesce(region, "none") region) FROM ...
但也不走运。知道这是否可能吗?
这应该有效(没有大括号):
SELECT DISTINCT country, region FROM ...