想要在Hive/SQL中从数组中删除null值。 例如:数组为['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)