Package io.substrait.expression
Class ExpressionCreator
java.lang.Object
io.substrait.expression.ExpressionCreator
-
Method Summary
Modifier and TypeMethodDescriptionstatic AggregateFunctionInvocationaggregateFunction(SimpleExtension.AggregateFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, FunctionArg... arguments) static AggregateFunctionInvocationaggregateFunction(SimpleExtension.AggregateFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, Iterable<? extends FunctionArg> arguments) UseAggregateFunctionInvocation.builder()directly to specify other parameters, e.g.static Expression.BinaryLiteralbinary(boolean nullable, byte[] value) static Expression.BinaryLiteralbinary(boolean nullable, com.google.protobuf.ByteString value) static Expression.BoolLiteralbool(boolean nullable, boolean value) static Expressioncast(Type type, Expression expression, Expression.FailureBehavior failureBehavior) static Expression.DateLiteraldate(boolean nullable, int value) static Expression.DecimalLiteraldecimal(boolean nullable, com.google.protobuf.ByteString value, int precision, int scale) static Expression.DecimalLiteraldecimal(boolean nullable, BigDecimal value, int precision, int scale) static Expression.EmptyListLiteralstatic Expression.EmptyMapLiteralfixedBinary(boolean nullable, byte[] bytes) fixedBinary(boolean nullable, com.google.protobuf.ByteString bytes) static Expression.FixedCharLiteralstatic Expression.FP32Literalfp32(boolean nullable, float value) static Expression.FP64Literalfp64(boolean nullable, double value) static Expression.I16Literali16(boolean nullable, int value) static Expression.I32Literali32(boolean nullable, int value) static Expression.I64Literali64(boolean nullable, long value) static Expression.I8Literali8(boolean nullable, int value) static Expression.IfClauseifThenClause(Expression conditionExpression, Expression resultExpression) static Expression.IfThenifThenStatement(Expression elseExpression, Expression.IfClause... conditionClauses) static Expression.IfThenifThenStatement(Expression elseExpression, Iterable<? extends Expression.IfClause> conditionClauses) intervalCompound(boolean nullable, int years, int months, int days, int seconds, long subseconds, int precision) intervalDay(boolean nullable, int days, int seconds) intervalDay(boolean nullable, int days, int seconds, long subseconds, int precision) intervalYear(boolean nullable, int years, int months) static Expression.ListLiterallist(boolean nullable, Expression.Literal... values) static Expression.ListLiterallist(boolean nullable, Iterable<? extends Expression.Literal> values) static Expression.MapLiteralmap(boolean nullable, Map<Expression.Literal, Expression.Literal> values) static Expression.NestedListnestedList(boolean nullable, List<Expression> values) Creates a nested list expression with one or more elements.static Expression.NestedStructnestedStruct(boolean nullable, Expression... fields) static Expression.NestedStructnestedStruct(boolean nullable, Iterable<Expression> fields) precisionTime(boolean nullable, long value, int precision) precisionTime(boolean nullable, LocalTime value) Creates a precision time literal from a LocalTime value.precisionTimestamp(boolean nullable, long value, int precision) precisionTimestamp(boolean nullable, LocalDateTime value) Creates a precision timestamp literal from a LocalDateTime value.precisionTimestampTZ(boolean nullable, long value, int precision) scalarFunction(SimpleExtension.ScalarFunctionVariant declaration, Type outputType, FunctionArg... arguments) scalarFunction(SimpleExtension.ScalarFunctionVariant declaration, Type outputType, Iterable<? extends FunctionArg> arguments) UseExpression.ScalarFunctionInvocation.builder()directly to specify other parameters, e.g.static Expression.StrLiteralstatic Expression.StructLiteralstruct(boolean nullable, Expression.Literal... values) static Expression.StructLiteralstruct(boolean nullable, Iterable<? extends Expression.Literal> values) static Expression.SwitchClauseswitchClause(Expression.Literal expectedValue, Expression resultExpression) static Expression.SwitchswitchStatement(Expression match, Expression defaultExpression, Expression.SwitchClause... conditionClauses) static Expression.SwitchswitchStatement(Expression match, Expression defaultExpression, Iterable<? extends Expression.SwitchClause> conditionClauses) static Expression.TimeLiteraltime(boolean nullable, long value) Deprecated.Time is deprecated in favor of PrecisionTimestatic Expression.TimestampLiteraltimestamp(boolean nullable, int year, int month, int dayOfMonth, int hour, int minute, int second, int micros) Deprecated.Timestamp is deprecated in favor of PrecisionTimestampstatic Expression.TimestampLiteraltimestamp(boolean nullable, long value) Deprecated.Timestamp is deprecated in favor of PrecisionTimestampstatic Expression.TimestampLiteraltimestamp(boolean nullable, LocalDateTime value) Deprecated.Timestamp is deprecated in favor of PrecisionTimestamptimestampTZ(boolean nullable, long value) Deprecated.TimestampTZ is deprecated in favor of PrecisionTimestampTZtimestampTZ(boolean nullable, Instant value) Deprecated.TimestampTZ is deprecated in favor of PrecisionTimestampTZstatic Expression.NullLiteraluserDefinedLiteralAny(boolean nullable, String urn, String name, List<Type.Parameter> typeParameters, com.google.protobuf.Any value) Create a UserDefinedAnyLiteral with google.protobuf.Any representation.userDefinedLiteralStruct(boolean nullable, String urn, String name, List<Type.Parameter> typeParameters, List<Expression.Literal> fields) Create a UserDefinedStructLiteral with Struct representation.static Expression.UUIDLiteraluuid(boolean nullable, com.google.protobuf.ByteString uuid) static Expression.UUIDLiteralstatic Expression.VarCharLiteralwindowFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, List<Expression> partitionBy, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, FunctionArg... arguments) windowFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, List<Expression> partitionBy, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, Iterable<? extends FunctionArg> arguments) UseExpression.WindowFunctionInvocation.builder()directly to specify other parameters, e.g.windowRelFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, Expression.AggregationInvocation invocation, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, Iterable<? extends FunctionArg> arguments) UseConsistentPartitionWindow.WindowRelFunctionInvocation.builder()directly to specify other parameters, e.g.
-
Method Details
-
typedNull
-
bool
-
i8
-
i16
-
i32
-
i64
-
fp32
-
fp64
-
string
-
binary
public static Expression.BinaryLiteral binary(boolean nullable, com.google.protobuf.ByteString value) -
binary
-
date
-
time
Deprecated.Time is deprecated in favor of PrecisionTime -
precisionTime
public static Expression.PrecisionTimeLiteral precisionTime(boolean nullable, long value, int precision) -
precisionTime
Creates a precision time literal from a LocalTime value.This method converts a Java
LocalTimeto a Substrait precision time literal with nanosecond precision (precision = 9). The time value is represented as nanoseconds since midnight (00:00:00).- Parameters:
nullable- whether the literal can be nullvalue- the LocalTime value to convert- Returns:
- a PrecisionTimeLiteral with nanosecond precision representing the given time
- See Also:
-
timestamp
Deprecated.Timestamp is deprecated in favor of PrecisionTimestamp -
timestamp
@Deprecated public static Expression.TimestampLiteral timestamp(boolean nullable, LocalDateTime value) Deprecated.Timestamp is deprecated in favor of PrecisionTimestamp -
timestamp
@Deprecated public static Expression.TimestampLiteral timestamp(boolean nullable, int year, int month, int dayOfMonth, int hour, int minute, int second, int micros) Deprecated.Timestamp is deprecated in favor of PrecisionTimestamp -
timestampTZ
Deprecated.TimestampTZ is deprecated in favor of PrecisionTimestampTZ -
timestampTZ
@Deprecated public static Expression.TimestampTZLiteral timestampTZ(boolean nullable, Instant value) Deprecated.TimestampTZ is deprecated in favor of PrecisionTimestampTZ -
precisionTimestamp
public static Expression.PrecisionTimestampLiteral precisionTimestamp(boolean nullable, long value, int precision) -
precisionTimestamp
public static Expression.PrecisionTimestampLiteral precisionTimestamp(boolean nullable, LocalDateTime value) Creates a precision timestamp literal from a LocalDateTime value.This method converts a Java
LocalDateTimeto a Substrait precision timestamp literal with nanosecond precision (precision = 9). The timestamp value is represented as nanoseconds since the Unix epoch (1970-01-01 00:00:00 UTC), assuming the LocalDateTime is in UTC timezone.- Parameters:
nullable- whether the literal can be nullvalue- the LocalDateTime value to convert (interpreted as UTC)- Returns:
- a PrecisionTimestampLiteral with nanosecond precision representing the given timestamp
- See Also:
-
precisionTimestampTZ
public static Expression.PrecisionTimestampTZLiteral precisionTimestampTZ(boolean nullable, long value, int precision) -
intervalYear
-
intervalDay
-
intervalDay
public static Expression.IntervalDayLiteral intervalDay(boolean nullable, int days, int seconds, long subseconds, int precision) -
intervalCompound
public static Expression.IntervalCompoundLiteral intervalCompound(boolean nullable, int years, int months, int days, int seconds, long subseconds, int precision) -
uuid
-
uuid
-
fixedChar
-
varChar
-
fixedBinary
public static Expression.FixedBinaryLiteral fixedBinary(boolean nullable, com.google.protobuf.ByteString bytes) -
fixedBinary
-
decimal
public static Expression.DecimalLiteral decimal(boolean nullable, com.google.protobuf.ByteString value, int precision, int scale) -
decimal
public static Expression.DecimalLiteral decimal(boolean nullable, BigDecimal value, int precision, int scale) -
map
public static Expression.MapLiteral map(boolean nullable, Map<Expression.Literal, Expression.Literal> values) -
emptyMap
-
list
-
list
public static Expression.ListLiteral list(boolean nullable, Iterable<? extends Expression.Literal> values) -
emptyList
-
struct
-
nestedList
Creates a nested list expression with one or more elements.Note: This class cannot be used to construct an empty list. To create an empty list, use
emptyList(boolean, Type)which returns anExpression.EmptyListLiteral. -
struct
public static Expression.StructLiteral struct(boolean nullable, Iterable<? extends Expression.Literal> values) -
nestedStruct
-
nestedStruct
-
userDefinedLiteralAny
public static Expression.UserDefinedAnyLiteral userDefinedLiteralAny(boolean nullable, String urn, String name, List<Type.Parameter> typeParameters, com.google.protobuf.Any value) Create a UserDefinedAnyLiteral with google.protobuf.Any representation.- Parameters:
nullable- whether the literal is nullableurn- the URN of the user-defined typename- the name of the user-defined typetypeParameters- the type parameters for the user-defined type (can be an empty list)value- the value, encoded as google.protobuf.Any
-
userDefinedLiteralStruct
public static Expression.UserDefinedStructLiteral userDefinedLiteralStruct(boolean nullable, String urn, String name, List<Type.Parameter> typeParameters, List<Expression.Literal> fields) Create a UserDefinedStructLiteral with Struct representation.- Parameters:
nullable- whether the literal is nullableurn- the URN of the user-defined typename- the name of the user-defined typetypeParameters- the type parameters for the user-defined type (can be an empty list)fields- the fields, as a list of Literal values
-
switchStatement
public static Expression.Switch switchStatement(Expression match, Expression defaultExpression, Expression.SwitchClause... conditionClauses) -
switchStatement
public static Expression.Switch switchStatement(Expression match, Expression defaultExpression, Iterable<? extends Expression.SwitchClause> conditionClauses) -
switchClause
public static Expression.SwitchClause switchClause(Expression.Literal expectedValue, Expression resultExpression) -
ifThenStatement
public static Expression.IfThen ifThenStatement(Expression elseExpression, Expression.IfClause... conditionClauses) -
ifThenStatement
public static Expression.IfThen ifThenStatement(Expression elseExpression, Iterable<? extends Expression.IfClause> conditionClauses) -
ifThenClause
public static Expression.IfClause ifThenClause(Expression conditionExpression, Expression resultExpression) -
scalarFunction
public static Expression.ScalarFunctionInvocation scalarFunction(SimpleExtension.ScalarFunctionVariant declaration, Type outputType, FunctionArg... arguments) -
scalarFunction
public static Expression.ScalarFunctionInvocation scalarFunction(SimpleExtension.ScalarFunctionVariant declaration, Type outputType, Iterable<? extends FunctionArg> arguments) UseExpression.ScalarFunctionInvocation.builder()directly to specify other parameters, e.g. options -
aggregateFunction
public static AggregateFunctionInvocation aggregateFunction(SimpleExtension.AggregateFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, Iterable<? extends FunctionArg> arguments) UseAggregateFunctionInvocation.builder()directly to specify other parameters, e.g. options -
aggregateFunction
public static AggregateFunctionInvocation aggregateFunction(SimpleExtension.AggregateFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, FunctionArg... arguments) -
windowFunction
public static Expression.WindowFunctionInvocation windowFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, List<Expression> partitionBy, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, Iterable<? extends FunctionArg> arguments) UseExpression.WindowFunctionInvocation.builder()directly to specify other parameters, e.g. options -
windowRelFunction
public static ConsistentPartitionWindow.WindowRelFunctionInvocation windowRelFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, Expression.AggregationInvocation invocation, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, Iterable<? extends FunctionArg> arguments) UseConsistentPartitionWindow.WindowRelFunctionInvocation.builder()directly to specify other parameters, e.g. options -
windowFunction
public static Expression.WindowFunctionInvocation windowFunction(SimpleExtension.WindowFunctionVariant declaration, Type outputType, Expression.AggregationPhase phase, List<Expression.SortField> sort, Expression.AggregationInvocation invocation, List<Expression> partitionBy, Expression.WindowBoundsType boundsType, WindowBound lowerBound, WindowBound upperBound, FunctionArg... arguments) -
cast
public static Expression cast(Type type, Expression expression, Expression.FailureBehavior failureBehavior)
-