我在配置单元表中加载一个数据,其中一些列是空的,而我在配置单元中查看表时它显示为空。当我在hdfs中下载路径/apps/hive/warehouse/dbname/file name中的数据时。在下载的文件中有\n值而不是null。如何在我的文件中用空\n消除该值。我还想把我的文件保存成xlsx
dpiehjr41#
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)
1条答案
按热度按时间dpiehjr41#
演示