Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Error while adding partitions to views in hive

avatar
Explorer

Hi All,

 

We are trying to create partitioned views on hive partitioned external tables.Tables are partitioned on customerid,orderid where as view is partitioned on customerid.

 

While trying to add partitions to views, sometimes we will pass already existing customerid.Then we are getting the below error and not understanding why it is not chekcing IF NOT EXISTS and then ignore the partition.

 

Please suggest what is going wrong here and how to solve this.

 

Query :

alter view viewname add if not exists partition(customerid=123);

 

the above query when trying to run is giving the below error:

 

Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.NullPointerException) at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:380) at org.apache.hive.service.cli.operation.SQLOperation.runQuery(SQLOperation.java:257) at org.apache.hive.service.cli.operation.SQLOperation.access$800(SQLOperation.java:91) at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:348) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1669) at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:362) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.hadoop.hive.ql.metadata.HiveException:

1 REPLY 1

avatar
Super Guru
@Yeseswini

Hive's VIEW is ready only, please see below doc:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Create/Drop/Al...

>> Views are read-only and may not be used as the target of LOAD/INSERT/ALTER.

Insert or update is not supported.

Thanks
Eric