Skip to content

Commit

Permalink
feat: support nullable and non-default variation user-defined types (#…
Browse files Browse the repository at this point in the history
…217)

* feat: support nullable and non-default variation user-defined type expressions
  • Loading branch information
jvanstraten authored Jun 9, 2022
1 parent 48b6b12 commit 5851b02
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
13 changes: 12 additions & 1 deletion proto/substrait/parameterized_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ message ParameterizedType {
ParameterizedList list = 27;
ParameterizedMap map = 28;

uint32 user_defined_pointer = 31;
ParameterizedUserDefined user_defined = 30;

// Deprecated in favor of user_defined, which allows nullability and
// variations to be specified. If user_defined_pointer is encountered,
// treat it as being non-nullable and having the default variation.
uint32 user_defined_pointer = 31 [deprecated = true];

TypeParameter type_parameter = 33;
}
Expand Down Expand Up @@ -108,6 +113,12 @@ message ParameterizedType {
Type.Nullability nullability = 4;
}

message ParameterizedUserDefined {
uint32 type_pointer = 1;
uint32 variation_pointer = 2;
Type.Nullability nullability = 3;
}

message IntegerOption {
oneof integer_type {
int32 literal = 1;
Expand Down
15 changes: 14 additions & 1 deletion proto/substrait/type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ message Type {
List list = 27;
Map map = 28;

uint32 user_defined_type_reference = 31;
UserDefined user_defined = 30;

// Deprecated in favor of user_defined, which allows nullability and
// variations to be specified. If user_defined_type_reference is
// encountered, treat it as being non-nullable and having the default
// variation.
uint32 user_defined_type_reference = 31 [deprecated = true];
}

enum Nullability {
Expand All @@ -49,6 +55,7 @@ message Type {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
}

message I8 {
uint32 type_variation_reference = 1;
Nullability nullability = 2;
Expand Down Expand Up @@ -168,6 +175,12 @@ message Type {
uint32 type_variation_reference = 3;
Nullability nullability = 4;
}

message UserDefined {
uint32 type_reference = 1;
uint32 type_variation_reference = 2;
Nullability nullability = 3;
}
}

// A message for modeling name/type pairs.
Expand Down
13 changes: 12 additions & 1 deletion proto/substrait/type_expressions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ message DerivationExpression {
ExpressionList list = 27;
ExpressionMap map = 28;

uint32 user_defined_pointer = 31;
ExpressionUserDefined user_defined = 30;

// Deprecated in favor of user_defined, which allows nullability and
// variations to be specified. If user_defined_pointer is encountered,
// treat it as being non-nullable and having the default variation.
uint32 user_defined_pointer = 31 [deprecated = true];

string type_parameter_name = 33;
string integer_parameter_name = 34;
Expand Down Expand Up @@ -99,6 +104,12 @@ message DerivationExpression {
Type.Nullability nullability = 4;
}

message ExpressionUserDefined {
uint32 type_pointer = 1;
uint32 variation_pointer = 2;
Type.Nullability nullability = 3;
}

message IfElse {
DerivationExpression if_condition = 1;
DerivationExpression if_return = 2;
Expand Down

0 comments on commit 5851b02

Please sign in to comment.