[ https://issues.apache.org/jira/browse/HIVE-18312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314137#comment-16314137 ]
Janaki Lahorani edited comment on HIVE-18312 at 1/5/18 11:34 PM: ----------------------------------------------------------------- [~haozhu] Please check if this is a duplicate of HIVE-17764. was (Author: janulatha): [~haozhu]Please check if this is a duplicate of HIVE-17764. > 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)