org.kitesdk.data.partition
Class CalendarFieldPartitioner

java.lang.Object
  extended by org.kitesdk.data.FieldPartitioner<Long,Integer>
      extended by org.kitesdk.data.partition.CalendarFieldPartitioner
All Implemented Interfaces:
com.google.common.base.Function<Long,Integer>, Comparator<Integer>
Direct Known Subclasses:
DayOfMonthFieldPartitioner, HourFieldPartitioner, MinuteFieldPartitioner, MonthFieldPartitioner, YearFieldPartitioner

@Beta
@NotThreadSafe
public class CalendarFieldPartitioner
extends FieldPartitioner<Long,Integer>

A FieldPartitioner that extracts the value of a Calendar field, such as Calendar.YEAR. The UTC timezone is assumed. See subclasses for convenience classes, e.g. YearFieldPartitioner. Note that we don't use SimpleDateFormat patterns since we want to keep the type information (values are ints).


Field Summary
protected  int calendarField
           
protected static TimeZone UTC
           
 
Constructor Summary
CalendarFieldPartitioner(String sourceName, String name, int calendarField, int cardinality)
           
 
Method Summary
 Integer apply(Long timestamp)
           Apply the partition function to the given value.
 int compare(Integer o1, Integer o2)
           
 boolean equals(Object o)
           
 int getCalendarField()
           
 int hashCode()
           
 com.google.common.base.Predicate<Integer> project(com.google.common.base.Predicate<Long> predicate)
          Projects a source-data constraint Predicate into the image of the backing partition function.
 String toString()
           
 Integer valueFromString(String stringValue)
          Deprecated. 
 
Methods inherited from class org.kitesdk.data.FieldPartitioner
getCardinality, getName, getSourceName, getSourceType, getType, valueToString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UTC

protected static final TimeZone UTC

calendarField

protected int calendarField
Constructor Detail

CalendarFieldPartitioner

public CalendarFieldPartitioner(String sourceName,
                                String name,
                                int calendarField,
                                int cardinality)
Method Detail

apply

public Integer apply(@Nonnull
                     Long timestamp)
Description copied from class: FieldPartitioner

Apply the partition function to the given value.

The type of value must be compatible with the field partitioner implementation. Normally, this is validated at the time of initial configuration rather than at runtime.

Specified by:
apply in interface com.google.common.base.Function<Long,Integer>
Specified by:
apply in class FieldPartitioner<Long,Integer>

project

public com.google.common.base.Predicate<Integer> project(com.google.common.base.Predicate<Long> predicate)
Description copied from class: FieldPartitioner
Projects a source-data constraint Predicate into the image of the backing partition function. If the function cannot be projected exactly, the resulting predicate must be more permissive than the original predicate.

Specified by:
project in class FieldPartitioner<Long,Integer>

getCalendarField

public int getCalendarField()

valueFromString

@Deprecated
public Integer valueFromString(String stringValue)
Deprecated. 

Description copied from class: FieldPartitioner

Retrieve the value for the field from the string representation.

Specified by:
valueFromString in class FieldPartitioner<Long,Integer>

equals

public boolean equals(Object o)
Specified by:
equals in interface com.google.common.base.Function<Long,Integer>
Specified by:
equals in interface Comparator<Integer>
Overrides:
equals in class Object

compare

public int compare(Integer o1,
                   Integer o2)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013–2014. All rights reserved.