Hao Zhu created HIVE-18312:
------------------------------
Summary: Create or Replace a View fails with "Unable to alter
table. The following columns have types incompatible with the existing columns
in their respective positions"
Key: HIVE-18312
URL: https://issues.apache.org/jira/browse/HIVE-18312
Project: Hive
Issue Type: Bug
Components: Database/Schema
Affects Versions: 2.1.0
Environment: Hive 2.1
Reporter: Hao Zhu
Create or Replace a view with different column types may fail with error :
{code}
FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following
columns have types incompatible with the existing columns in their respective
positions :
i
{code}
Here is minimum reproduce:
{code}
CREATE TABLE testtype(i int, s1 string);
DDL1:
create or replace view v1 (s1)
as Select s1 from testtype;
DDL2:
create or replace view v1 (i,s1)
as Select i, s1 from testtype ;
FAILED: Execution Error, return code 1 from
org.apache.hadoop.hive.ql.exec.DDLTask. Unable to alter table. The following
columns have types incompatible with the existing columns in their respective
positions :
i
{code}
Only Workaround is:
To drop the view and Create view again.
We should allow "Create or Replace View" to work even if the column types are
different.
It should work like "Drop View" and then "Create a View".
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)