-- This is the Hive table
> desc hive_tbl;
col_name data_type
h1 string
h2 string
h3 string
h4 string
-- This is the query that interprets h2 having 'NULL' as another character.
-- In this case, 'X' is used instead of '' so that it prints in the display.
> SELECT h1, h2, h3, h4, TRANSLATE(h2,'NULL','X') h2_updated FROM hive_tbl;
h1 h2 h3 h4 h2_updated
1 foo 100 entry-foo foo
2 NULL 200 The data is absent for second column NULL
3 NULL 300 The value in second column is the string NULL X
1条答案
按热度按时间unguejic1#
可以使用此查询将基础数据中的“null”解释为空字符串。
插图: