How to replace an empty string(length 0 ) with some other value? Already used Nvl
and COALESCE
but both doesn't replace with the replacement value because the value is not null. i can use case
statement but looking for a built in function if there is any.
相关问题
-
hive: cast array
> into map - Find function in HIVE
- Hive Tez reducers are running super slow
- Set parquet snappy output file size is hive?
- Hive 'cannot alter table' error
相关文章
- 在hive sql里怎么把"2020-10-26T08:41:19.000Z"这个字符串转换成年月日
- SQL query Frequency Distribution matrix for produc
- Cloudera 5.6: Parquet does not support date. See H
- converting to timestamp with time zone failed on A
- Hive error: parseexception missing EOF
- ClassNotFoundException: org.apache.spark.SparkConf
- How to get previous day date in Hive
- Hive's hour() function returns 12 hour clock v
In Hive, empty string is treated like usual comparable value, not NULL. That is why there is no built-in function for this.
Using case statement:
As you are having empty strings so when we use coalesce or nvl works only if we are having null values in the data. These functions won't work with empty strings.
With Empty strings:
With null values:
Try to alter the table and add this property
if this property doesn't display empty string as null's then we need to use either
case/if
statement to replace empty strings.You can use
if statement
Example: