java.lang.Object
org.apache.gravitino.rel.expressions.transforms.Transforms

public class Transforms extends Object
Helper methods to create logical transforms to pass into Apache Gravitino.
  • Field Details

    • EMPTY_TRANSFORM

      public static final Transform[] EMPTY_TRANSFORM
      An empty array of transforms.
    • NAME_OF_IDENTITY

      public static final String NAME_OF_IDENTITY
      The name of the identity transform.
      See Also:
    • NAME_OF_YEAR

      public static final String NAME_OF_YEAR
      The name of the year transform. The year transform returns the year of the input value.
      See Also:
    • NAME_OF_MONTH

      public static final String NAME_OF_MONTH
      The name of the month transform. The month transform returns the month of the input value.
      See Also:
    • NAME_OF_DAY

      public static final String NAME_OF_DAY
      The name of the day transform. The day transform returns the day of the input value.
      See Also:
    • NAME_OF_HOUR

      public static final String NAME_OF_HOUR
      The name of the hour transform. The hour transform returns the hour of the input value.
      See Also:
    • NAME_OF_BUCKET

      public static final String NAME_OF_BUCKET
      The name of the bucket transform. The bucket transform returns the bucket of the input value.
      See Also:
    • NAME_OF_TRUNCATE

      public static final String NAME_OF_TRUNCATE
      The name of the truncate transform. The truncate transform returns the truncated value of the
      See Also:
    • NAME_OF_LIST

      public static final String NAME_OF_LIST
      The name of the list transform. The list transform includes multiple fields in a list.
      See Also:
    • NAME_OF_RANGE

      public static final String NAME_OF_RANGE
      The name of the range transform. The range transform returns the range of the input value.
      See Also:
  • Method Details

    • identity

      public static Transforms.IdentityTransform identity(String[] fieldName)
      Create a transform that returns the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • identity

      public static Transforms.IdentityTransform identity(String columnName)
      Create a transform that returns the input value.
      Parameters:
      columnName - The column name to transform
      Returns:
      The created transform
    • year

      public static Transforms.YearTransform year(String[] fieldName)
      Create a transform that returns the year of the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • year

      public static Transforms.YearTransform year(String columnName)
      Create a transform that returns the year of the input value.
      Parameters:
      columnName - The column name to transform
      Returns:
      The created transform
    • month

      public static Transforms.MonthTransform month(String[] fieldName)
      Create a transform that returns the month of the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • month

      public static Transforms.MonthTransform month(String columnName)
      Create a transform that returns the month of the input value.
      Parameters:
      columnName - The column name to transform
      Returns:
      The created transform
    • day

      public static Transforms.DayTransform day(String[] fieldName)
      Create a transform that returns the day of the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • day

      public static Transforms.DayTransform day(String columnName)
      Create a transform that returns the day of the input value.
      Parameters:
      columnName - The column name to transform
      Returns:
      The created transform
    • hour

      public static Transforms.HourTransform hour(String[] fieldName)
      Create a transform that returns the hour of the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • hour

      public static Transforms.HourTransform hour(String columnName)
      Create a transform that returns the hour of the input value.
      Parameters:
      columnName - The column name to transform
      Returns:
      The created transform
    • bucket

      public static Transforms.BucketTransform bucket(int numBuckets, String[]... fieldNames)
      Create a transform that returns the bucket of the input value.
      Parameters:
      numBuckets - The number of buckets to use
      fieldNames - The field names to transform
      Returns:
      The created transform
    • list

      public static Transforms.ListTransform list(String[]... fieldNames)
      Create a transform that includes multiple fields in a list.
      Parameters:
      fieldNames - The field names to include in the list
      Returns:
      The created transform
    • list

      public static Transforms.ListTransform list(String[][] fieldNames, ListPartition[] assignments)
      Create a transform that includes multiple fields in a list with preassigned list partitions.
      Parameters:
      fieldNames - The field names to include in the list
      assignments - The preassigned list partitions
      Returns:
      The created transform
    • range

      public static Transforms.RangeTransform range(String[] fieldName)
      Create a transform that returns the range of the input value.
      Parameters:
      fieldName - The field name to transform
      Returns:
      The created transform
    • range

      public static Transforms.RangeTransform range(String[] fieldName, RangePartition[] assignments)
      Create a transform that returns the range of the input value with preassigned range partitions.
      Parameters:
      fieldName - The field name to transform
      assignments - The preassigned range partitions
      Returns:
      The created transform
    • truncate

      public static Transforms.TruncateTransform truncate(int width, String[] fieldName)
      Create a transform that returns the truncated value of the input value with the given width.
      Parameters:
      width - The width to truncate to
      fieldName - The field name to transform
      Returns:
      The created transform
    • truncate

      public static Transforms.TruncateTransform truncate(int width, String columnName)
      Create a transform that returns the truncated value of the input value with the given width.
      Parameters:
      width - The width to truncate to
      columnName - The column name to transform
      Returns:
      The created transform
    • apply

      public static Transforms.ApplyTransform apply(String name, Expression[] arguments)
      Create a transform that applies a function to the input value.
      Parameters:
      name - The name of the function to apply
      arguments - The arguments to the function
      Returns:
      The created transform