Valid casts to/from Date type
cast(date as date)
Same date value
cast(timestamp as date)
The year/month/day of the timestamp is determined, based on the local timezone, and returned as a date value.
cast(string as date)
If the string is in the form 'YYYY-MM-DD', then a date value corresponding to that year/month/day is returned. If the string value does not match this formate, then NULL is returned.
cast(date as timestamp)
A timestamp value is generated corresponding to midnight of the year/month/day of the date value, based on the local timezone.
cast(date as string)
The year/month/day represented by the Date is formatted as a string in the form 'YYYY-MM-DD'.
CREATE TABLE foo ( a DECIMAL, -- Defaults to decimal(10,0) b DECIMAL(9, 7) )
Integral literals larger than BIGINT must be handled with Decimal(38,0). The Postfix BD is required. Example:
select CAST(18446744073709001000BD AS DECIMAL(38,0)) from my_table limit 1;
Decimal Type Incompatibilities between Hive 0.12.0 and 0.13.0