-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Substrait] Support
root
case in PlanRel
message.
This essentially consist in adding optional field names to the `PlanRelOp`. Since verifying if those field names match the yielded type of the relation consists of the same logic as the one used in the verifier of the `NamedTableOp`, this commit also factors out that verification log. While touching that code, the commit also slightly extends the error messages emitted on verification failure.
- Loading branch information
1 parent
b9f1c07
commit b8c2530
Showing
8 changed files
with
173 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// RUN: structured-opt -verify-diagnostics -split-input-file %s | ||
|
||
// Test error if providing too many names (1 name for 0 fields). | ||
substrait.plan version 0 : 42 : 1 { | ||
// expected-error@+2 {{'substrait.relation' op has mismatching 'field_names' (["x", "y"]) and result type ('tuple<si32>')}} | ||
// expected-note@+1 {{too many field names provided}} | ||
relation as ["x", "y"] { | ||
%0 = named_table @t1 as ["a"] : tuple<si32> | ||
yield %0 : tuple<si32> | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
// Test error if providing too few names (0 names for 1 field). | ||
substrait.plan version 0 : 42 : 1 { | ||
// expected-error@+2 {{'substrait.relation' op has mismatching 'field_names' (["x"]) and result type ('tuple<si32, si32>')}} | ||
// expected-error@+1 {{not enough field names provided}} | ||
relation as ["x"] { | ||
%0 = named_table @t1 as ["a", "b"] : tuple<si32, si32> | ||
yield %0 : tuple<si32, si32> | ||
} | ||
} | ||
|
||
|
||
// ----- | ||
|
||
// Test error if providing duplicate field names in the same nesting level. | ||
substrait.plan version 0 : 42 : 1 { | ||
// expected-error@+2 {{'substrait.relation' op has mismatching 'field_names' (["x", "x"]) and result type ('tuple<si32, si32>')}} | ||
// expected-error@+1 {{duplicate field name: 'x'}} | ||
relation as ["x", "x"] { | ||
%0 = named_table @t1 as ["a", "b"] : tuple<si32, si32> | ||
yield %0 : tuple<si32, si32> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters