Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to create partitioned view

How to create partitioned view

Expert Contributor

I got a 'log' table which is currently partitioned by year, month and day. I'm looking to create a partitioned view on top of 'log' table but running into this error:

 
~~~~

hive> CREATE VIEW log_view PARTITIONED ON (pagename,year,month,day) AS SELECT pagename year,month,day,uid,properties FROM log; 

FAILED: SemanticException [Error 10093]: Rightmost columns in view output do not match PARTITIONED ON clause

~~

 

Whats the right way to create a partitioned views? I'm using Hive 0.13 in CDH 5.3.2.

 

Thanks!

3 REPLIES 3

Re: How to create partitioned view

Contributor
It seems you missed a "," between pagename and year after SELECT.

Re: How to create partitioned view

Expert Contributor

Sorry, was a copy/paste error. I did have a comma between pagename and year but got the error I pasted.

 

Thanks!

Highlighted

Re: How to create partitioned view

New Contributor

@buntu

 

Try this:

hive> CREATE VIEW log_view PARTITIONED ON (pagename,year,month,day) AS SELECTuid,properties,pagename year,month,day FROM log; 

 

Reason:

The column names used in the partition must be available at the end of view creation in the same order as mentioned in as partitions.

Don't have an account?
Coming from Hortonworks? Activate your account here