在使用spark sql发现某些字段是数组字段,需要判断该字段是否包含某些值的写法:
spark.sql("select id, array_field from tmp_v where array_contains(array_field, 'hello')").show(200, false)
本文介绍如何使用SparkSQL查询数组字段中包含特定值的记录。通过示例代码展示使用array_contains函数的方法。
在使用spark sql发现某些字段是数组字段,需要判断该字段是否包含某些值的写法:
spark.sql("select id, array_field from tmp_v where array_contains(array_field, 'hello')").show(200, false)
2452
380

被折叠的 条评论
为什么被折叠?