Sql 如何从两个配置单元阵列中获取不匹配的元素
我正在寻找一个配置单元函数和查询,以从配置单元中的两个数组中获取不匹配的元素。假设数组是Sql 如何从两个配置单元阵列中获取不匹配的元素,sql,arrays,hive,hiveql,Sql,Arrays,Hive,Hiveql,我正在寻找一个配置单元函数和查询,以从配置单元中的两个数组中获取不匹配的元素。假设数组是 A = ["Hello", "earth"] B = ["Hello", "mars"] Expected output is ["earth", "mars"] or ["mars", "earth"] 另一个例子 A = ["Hell
A = ["Hello", "earth"]
B = ["Hello", "mars"]
Expected output is ["earth", "mars"] or ["mars", "earth"]
另一个例子
A = ["Hello", "world"]
B = ["Hello", "world", "!"]
Expected output is ["!"]
分解子查询中的两个数组,完全联接子查询并筛选不匹配的记录,然后使用collect_set对它们进行聚合以获取数组 演示: 结果:
["earth","mars"]
["earth","mars"]