Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Dynamic partitions in Hive


Copy link to this message
-
Re: Dynamic partitions in Hive
According to

https://cwiki.apache.org/Hive/dynamicpartitions.html

for dynamic partitions the partition clause must look like

PARTITION(year, month, edate)

the actual expressions should be included in the select list. So in your
example the select list should look something like

SELECT sh.EVENT_TIME, sh.person_NAME, substring(event_time, 0, 4) as year,
.....

Ashish

On Wed, Apr 25, 2012 at 2:51 AM, Shin Chan <[EMAIL PROTECTED]> wrote:

> Hi
>
> While using dynamic partitions can we do something like this
>
> FROM stage_customer sh
> INSERT OVERWRITE TABLE Fact_Customer
> PARTITION(year
> =substring(event_time,0,4),month=substring(event_time,6,2),edate=substring(event_time,9,2),ehour=substring(event_time,12,2))
> SELECT sh.EVENT_TIME , sh.person_NAME;
>
> Basically I am trying to decide next partitions based on calculation by
> substring of field EVENT_TIME present in stage table , but its giving error
> as
>
> Parse Error: line 3:16 cannot recognize input near 'substring' '('
> 'event_time' in constant
>
> Is it possible to do ?
>
> We cannot use functions to decide partitions ?