对字段值使用size() 方法
size(字段名称)=0
hive表中的默认空字段值使用\N填充,如果一个字段值为空,将改表中这个字段值
导入到PolarDB 、clickhouse 中后相应的会出现 \N 字样
如果一张表中有较多的空值存在,此时\N 比较占用空间,可以使用
alter table test_null set serdeproperties('serialization.null.format' = '');
修改一下表对空值的默认处理
1、字段类型为array(string)
CASE
when size(order_stat.order_book_id)=0
then array() else order_stat.order_book_id
end as order_book_id --充值书籍
或着
nvl(order_stat.order_book_id,array()) as order_book_id --充值书籍
2、字段类型为array(bigint)
CASE
when size(order_stat.order_book_id)=0
then array(1000000L) else order_stat.order_book_id
end as order_book_id --充值书籍