Class Hours<T>

java.lang.Object
org.apache.iceberg.transforms.Hours<T>
All Implemented Interfaces:
Serializable, Transform<T,Integer>

public class Hours<T> extends Object
See Also:
  • Constructor Details

    • Hours

      public Hours()
  • Method Details

    • granularity

      protected ChronoUnit granularity()
    • toEnum

      protected Transform<T,Integer> toEnum(Type type)
    • canTransform

      public boolean canTransform(Type type)
      Description copied from interface: Transform
      Checks whether this function can be applied to the given Type.
      Specified by:
      canTransform in interface Transform<T,Integer>
      Parameters:
      type - a type
      Returns:
      true if this transform can be applied to the type, false otherwise
    • getResultType

      public Type getResultType(Type sourceType)
      Description copied from interface: Transform
      Returns the Type produced by this transform given a source type.
      Parameters:
      sourceType - a type
      Returns:
      the result type created by the apply method for the given type
    • toHumanString

      public String toHumanString(Type alwaysInt, Integer value)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromSourceType

      protected static <R> R fromSourceType(Type type, R dateResult, R microsResult, R nanosResult)
    • bind

      public SerializableFunction<T,Integer> bind(Type type)
      Description copied from interface: Transform
      Returns a function that applies this transform to values of the given type.
      Specified by:
      bind in interface Transform<S,Integer>
      Parameters:
      type - an Iceberg Type
      Returns:
      a Function that applies this transform to values of the given type.
    • preservesOrder

      public boolean preservesOrder()
      Description copied from interface: Transform
      Whether the transform preserves the order of values (is monotonic).

      A transform preserves order for values when for any given a and b, if a < b then apply(a) <= apply(b).

      Specified by:
      preservesOrder in interface Transform<S,Integer>
      Returns:
      true if the transform preserves the order of values
    • satisfiesOrderOf

      public boolean satisfiesOrderOf(Transform<?,?> other)
      Description copied from interface: Transform
      Whether ordering by this transform's result satisfies the ordering of another transform's result.

      For example, sorting by day(ts) will produce an ordering that is also by month(ts) or year(ts). However, sorting by day(ts) will not satisfy the order of hour(ts) or identity(ts).

      Specified by:
      satisfiesOrderOf in interface Transform<S,Integer>
      Returns:
      true if ordering by this transform is equivalent to ordering by the other transform
    • project

      public UnboundPredicate<Integer> project(String name, BoundPredicate<T> predicate)
      Description copied from interface: Transform
      Transforms a predicate to an inclusive predicate on the partition values produced by the transform.

      This inclusive transform guarantees that if pred(v) is true, then projected(apply(v)) is true.

      Specified by:
      project in interface Transform<S,Integer>
      Parameters:
      name - the field name for partition values
      predicate - a predicate for source values
      Returns:
      an inclusive predicate on partition values
    • projectStrict

      public UnboundPredicate<Integer> projectStrict(String name, BoundPredicate<T> predicate)
      Description copied from interface: Transform
      Transforms a predicate to a strict predicate on the partition values produced by the transform.

      This strict transform guarantees that if strict(apply(v)) is true, then pred(v) is also true.

      Specified by:
      projectStrict in interface Transform<S,Integer>
      Parameters:
      name - the field name for partition values
      predicate - a predicate for source values
      Returns:
      an inclusive predicate on partition values
    • dedupName

      public String dedupName()
      Description copied from interface: Transform
      Return the unique transform name to check if similar transforms for the same source field are added multiple times in partition spec builder.
      Specified by:
      dedupName in interface Transform<S,Integer>
      Returns:
      a name used for dedup