Class Expressions
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Transform
apply
(String name, Expression... args) Create a logical transform for applying a named transform.static Transform
Create a bucket transform for one or more columns.static NamedReference
Create a named reference expression for a (nested) column.static Transform
Create a daily transform for a timestamp or date column.static Transform
Create an hourly transform for a timestamp column.static Transform
Create an identity transform for a column.static <T> Literal<T>
literal
(T value) Create a literal from a value.static Transform
Create a monthly transform for a timestamp or date column.static SortOrder
sort
(Expression expr, SortDirection direction) Create a sort expression.static SortOrder
sort
(Expression expr, SortDirection direction, NullOrdering nullOrder) Create a sort expression.static Transform
Create a yearly transform for a timestamp or date column.
-
Method Details
-
apply
Create a logical transform for applying a named transform.This transform can represent applying any named transform.
- Parameters:
name
- the transform nameargs
- expression arguments to the transform- Returns:
- a logical transform
-
column
Create a named reference expression for a (nested) column.- Parameters:
name
- The column name. It refers to nested column if name contains dot.- Returns:
- a named reference for the column
-
literal
Create a literal from a value.The JVM type of the value held by a literal must be the type used by Spark's InternalRow API for the literal's
SQL data type
.- Type Parameters:
T
- the JVM type of the value- Parameters:
value
- a value- Returns:
- a literal expression for the value
-
bucket
Create a bucket transform for one or more columns.This transform represents a logical mapping from a value to a bucket id in [0, numBuckets) based on a hash of the value.
The name reported by transforms created with this method is "bucket".
- Parameters:
numBuckets
- the number of output bucketscolumns
- input columns for the bucket transform- Returns:
- a logical bucket transform with name "bucket"
-
identity
Create an identity transform for a column.This transform represents a logical mapping from a value to itself.
The name reported by transforms created with this method is "identity".
- Parameters:
column
- an input column- Returns:
- a logical identity transform with name "identity"
-
years
Create a yearly transform for a timestamp or date column.This transform represents a logical mapping from a timestamp or date to a year, such as 2018.
The name reported by transforms created with this method is "years".
- Parameters:
column
- an input timestamp or date column- Returns:
- a logical yearly transform with name "years"
-
months
Create a monthly transform for a timestamp or date column.This transform represents a logical mapping from a timestamp or date to a month, such as 2018-05.
The name reported by transforms created with this method is "months".
- Parameters:
column
- an input timestamp or date column- Returns:
- a logical monthly transform with name "months"
-
days
Create a daily transform for a timestamp or date column.This transform represents a logical mapping from a timestamp or date to a date, such as 2018-05-13.
The name reported by transforms created with this method is "days".
- Parameters:
column
- an input timestamp or date column- Returns:
- a logical daily transform with name "days"
-
hours
Create an hourly transform for a timestamp column.This transform represents a logical mapping from a timestamp to a date and hour, such as 2018-05-13, hour 19.
The name reported by transforms created with this method is "hours".
- Parameters:
column
- an input timestamp column- Returns:
- a logical hourly transform with name "hours"
-
sort
Create a sort expression.- Parameters:
expr
- an expression to produce values to sortdirection
- direction of the sortnullOrder
- null order of the sort- Returns:
- a SortOrder
- Since:
- 3.2.0
-
sort
Create a sort expression.- Parameters:
expr
- an expression to produce values to sortdirection
- direction of the sort- Returns:
- a SortOrder
- Since:
- 3.2.0
-