tblproperties ('serialization.null.format' = '')
演示
hive> create table t1 (i int,j int,k int);
hive> insert into t1 values (1,null,2);
hive> select * from t1;
+------+------+------+
| t1.i | t1.j | t1.k |
+------+------+------+
| 1 | NULL | 2 |
+------+------+------+
$ hdfs dfs -cat /user/hive/warehouse/t1/* | od -Anone -tacd1x1
1 soh \ N soh 2 nl # a = named characters
1 001 \ N 001 2 \n # c = ASCII characters or backslash escapes
49 1 92 78 1 50 10 # d1 = decimal (1-byte)
31 01 5c 4e 01 32 0a # x1 = hexadecimal (1-byte)
hive> create table t2 (i int,j int,k int) tblproperties ('serialization.null.format' = '');
hive> insert into t2 values (1,null,2);
hive> select * from t2;
+------+------+------+
| t2.i | t2.j | t2.k |
+------+------+------+
| 1 | NULL | 2 |
+------+------+------+
$ hdfs dfs -cat /user/hive/warehouse/t2/* | od -Anone -tacd1x1
1 soh soh 2 nl # a = named characters
1 001 001 2 \n # c = ASCII characters or backslash escapes
49 1 1 50 10 # d1 = decimal (1-byte)
31 01 01 32 0a # x1 = hexadecimal (1-byte)