I am creating a temp table from another table using AS
clause where I am including the partition column of another table also be part of temp table and then I am getting the below error. Below is the table create statement where col4
is the partition column of table xyz
.
And while running the create statement i am getting the below error. And when I am removing the col4
from the create statement its running fine.
Error:
Error while compiling statement: FAILED: NumberFormatException For input string: "HIVE_DEFAULT_PARTITION" (state=42000,code=40000)
Please help.
Example:
CREATE TEMPORARY TABLE abc STORED AS PARQUET AS SELECT
col1 AS col1,
col2 AS col2,
col3 AS col3,
col4 AS col4
FROM xyz;
This is a problem with source table
xyz
because it contains partition__HIVE_DEFAULT_PARTITION__
Hive creates a partition with value
__HIVE_DEFAULT_PARTITION__
when in dynamic partition mode inserted partition value is NULL.Partition
__HIVE_DEFAULT_PARTITION__
is not compatible with numeric type and this causing error because it cannot be cast to numeric type.To remove or query this partition, you need to change the column type to string first:
Of course you may want to backup table and check the data before removing and decide what to do with this data.
To remove partition:
After removing partition you can change the type of partition column back to numeric type.