[英]Remove nulls from an array in SQL
想要從hive / sql中的數組中刪除空值
例如:在轉換為字符串值后,數組為['1',null],它應該只為'1'。
拆分我在下面使用的數組:
concat_ws( ",", array_val)
this gives : 1,null
required output : 1
謝謝您的幫助!
使用regexp_replace從連接字符串中刪除null:
hive> select regexp_replace('null,1,2,null,2,3,null','(,+null)|(^null,)','');
OK
1,2,2,3
Time taken: 6.006 seconds, Fetched: 1 row(s)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.