Skip to content

Commit

Permalink
feat: add flag FailureBehavior in Cast expression (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZJie1 authored May 13, 2022
1 parent ff623df commit a3d3b2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions proto/substrait/algebra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,13 @@ message Expression {
message Cast {
Type type = 1;
Expression input = 2;
FailureBehavior failure_behavior = 3;

enum FailureBehavior {
FAILURE_BEHAVIOR_UNSPECIFIED = 0;
FAILURE_BEHAVIOR_RETURN_NULL = 1;
FAILURE_BEHAVIOR_THROW_EXCEPTION = 2;
}
}

message SwitchExpression {
Expand Down
4 changes: 1 addition & 3 deletions site/docs/expressions/specialized_record_expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ For each data type, it is possible to create a literal value for that data type.


## Cast Expression
To convert a value from one type to another, Substrait defines a cast expression. Cast expression declare an expected type and an input argument.


To convert a value from one type to another, Substrait defines a cast expression. Cast expressions declare an expected type, an input argument and an enumeration specifying failure behavior, indicating whether cast should return null on failure or throw an exception.

## If Expression
An if value expression is an expression composed of one if clause, zero or more else if clauses and an else clause. In pseudocode, they are envisioned as:
Expand Down

0 comments on commit a3d3b2f

Please sign in to comment.