This project has retired. For details please refer to its Attic page.
PartitionTimeline (Lens 2.1.0-beta-incubating API)

org.apache.lens.cube.metadata.timeline
Class PartitionTimeline

java.lang.Object
  extended by org.apache.lens.cube.metadata.timeline.PartitionTimeline
All Implemented Interfaces:
Iterable<TimePartition>
Direct Known Subclasses:
EndsAndHolesPartitionTimeline, RangesPartitionTimeline, StoreAllPartitionTimeline

public abstract class PartitionTimeline
extends Object
implements Iterable<TimePartition>

Represents the in-memory data structure that represents timeline of all existing partitions for a given storage table, update period, partition column. Is an Abstract class. Can be implemented in multiple ways.

See Also:
EndsAndHolesPartitionTimeline, StoreAllPartitionTimeline

Constructor Summary
PartitionTimeline()
           
 
Method Summary
 boolean add(Collection<TimePartition> partitions)
          Add multiple partitions to timeline
abstract  boolean add(TimePartition partition)
          Add partition to timeline
 void addForBatchAddition(TimePartition partition)
          Add partition to local memory to be sent for batch addition.
 boolean commitBatchAdditions()
          Commit all partitions that were added to batch addition queue.
abstract  boolean drop(TimePartition toDrop)
          drop partition.
abstract  boolean exists(TimePartition partition)
          Checks partition existance
 Date getLatestDate()
          wrapper on latest data
 void init(org.apache.hadoop.hive.ql.metadata.Table table)
          Extracts timeline implementation class from table params and instantiates it with other arguments, also in table params.
abstract  boolean initFromProperties(Map<String,String> properties)
          deserialize member variables from given map
abstract  boolean isConsistent()
          whether timeline is in consistent state
abstract  boolean isEmpty()
          Whether No partitions have been registered
abstract  TimePartition latest()
          latest partition.
abstract  Map<String,String> toProperties()
          serialize member objects as map
 void updateTableParams(org.apache.hadoop.hive.ql.metadata.Table table)
          Sets PartitionTimeline implementation class's name and specific params in table param.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

PartitionTimeline

public PartitionTimeline()
Method Detail

getLatestDate

public Date getLatestDate()
wrapper on latest data


updateTableParams

public void updateTableParams(org.apache.hadoop.hive.ql.metadata.Table table)
Sets PartitionTimeline implementation class's name and specific params in table param.

Parameters:
table -
See Also:
init(org.apache.hadoop.hive.ql.metadata.Table)

init

public void init(org.apache.hadoop.hive.ql.metadata.Table table)
          throws LensException
Extracts timeline implementation class from table params and instantiates it with other arguments, also in table params.

Parameters:
table -
Throws:
LensException
See Also:
updateTableParams(org.apache.hadoop.hive.ql.metadata.Table)

addForBatchAddition

public void addForBatchAddition(TimePartition partition)
Add partition to local memory to be sent for batch addition.

See Also:
commitBatchAdditions()

commitBatchAdditions

public boolean commitBatchAdditions()
                             throws LensException
Commit all partitions that were added to batch addition queue. //TODO: improve batch addition implementation.

Returns:
true if all the partitions were added successfully, or no partitions needed to be added
Throws:
LensException

add

public abstract boolean add(@NonNull
                            TimePartition partition)
                     throws LensException
Add partition to timeline

Parameters:
partition -
Returns:
whether add was successful
Throws:
LensException

add

public boolean add(@NonNull
                   Collection<TimePartition> partitions)
            throws LensException
Add multiple partitions to timeline

Parameters:
partitions -
Returns:
whether add was successful
Throws:
LensException

drop

public abstract boolean drop(@NonNull
                             TimePartition toDrop)
                      throws LensException
drop partition.

Parameters:
toDrop -
Returns:
whether drop was successful
Throws:
LensException

latest

public abstract TimePartition latest()
latest partition. will be null if no partitions exist.

Returns:

toProperties

public abstract Map<String,String> toProperties()
serialize member objects as map

Returns:

initFromProperties

public abstract boolean initFromProperties(Map<String,String> properties)
                                    throws LensException
deserialize member variables from given map

Parameters:
properties -
Returns:
true if after deserializing, the timeline is in consistent state
Throws:
LensException
See Also:
isConsistent()

isEmpty

public abstract boolean isEmpty()
Whether No partitions have been registered

Returns:

isConsistent

public abstract boolean isConsistent()
whether timeline is in consistent state

Returns:

exists

public abstract boolean exists(TimePartition partition)
Checks partition existance

Parameters:
partition -
Returns:


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.