2013年8月7日星期三

HIVE Are there similar ORCLE NVL function ?

Some data from ORACLE guide to HDFS, there is a field of type date, the field may be empty , so HIVE query time , HIVE will check error because NULL is not he recognize the date format , I ask you this children generally is how to deal ? Is it time to export directly to fill empty to 0 ? Error Kusakabe
Hive Runtime Error while processing row [Error getting row data with exception java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd ; hh: mm: ss [. fffffffff]
------ Solution ------------------------------ --------------
1, the easiest way is to the data when filling out a default of NULL values, such as '1970 -01-01 00:00:00 ' , I always use this way ~ ~
2, the H-SQL query to filter for NULL values ​​:

select * from tableName where ColumnName is not null;

3, modify the descriptor NULL values ​​, this method is not tested , does not guarantee the line
ALTER TABLE tableName SET SERDEPROPERTIES('serialization.null.format' = '1970-01-01 00:00:00');

------ For reference only ----------------------------------- ----


ah, and I imagine the same. Method 1 is certainly no objection, Method 2 does not work , because I queried data contains this field rather than just query this field, method 3 ignominious failure. Estimated that only multi- point storage account , and fill in a default value , thank

没有评论:

发表评论