Skip to content

Commit

Permalink
test: extend Plan tests to cover RootRel and Rel cases properly
Browse files Browse the repository at this point in the history
This PR extends the import and export tests such that both paths cover
the `RootRel` and the `Rel` cases. Previously, each of them only
convered one of the two.

Signed-off-by: Ingo Müller <[email protected]>
  • Loading branch information
ingomueller-net committed Jan 13, 2025
1 parent fe77d82 commit 4add4e0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
13 changes: 13 additions & 0 deletions test/Target/SubstraitPB/Export/plan.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,26 @@ substrait.plan
// CHECK-NEXT: names: "z"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: relations {
// CHECK-NEXT: rel {
// CHECK-NEXT: read {
// CHECK: named_table {
// CHECK-NEXT: names
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: version

substrait.plan version 0 : 42 : 1 {
relation as ["x", "y", "z"] {
%0 = named_table @t as ["a", "b", "c"] : tuple<si32, tuple<si32>>
yield %0 : tuple<si32, tuple<si32>>
}
relation {
%0 = named_table @t as ["a"] : tuple<si32>
yield %0 : tuple<si32>
}
}

// -----
Expand Down
52 changes: 45 additions & 7 deletions test/Target/SubstraitPB/Import/plan.textpb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,51 @@ version {
# CHECK-NEXT: relation {
# CHECK-NEXT: %[[V0:.*]] = named_table @t1 as ["a", "b"] : tuple<si32, si32>
# CHECK-NEXT: yield %[[V0]] : tuple<si32, si32>
# CHECK-NEXT: }
# CHECK-NEXT: relation {
# CHECK-NEXT: %[[V1:.*]] = named_table @t as ["a"] : tuple<si32>
# CHECK-NEXT: yield %[[V1]] : tuple<si32>

relations {
root {
input {
read {
common {
direct {
}
}
base_schema {
names: "a"
names: "b"
names: "c"
struct {
types {
i32 {
nullability: NULLABILITY_REQUIRED
}
}
types {
struct {
types {
i32 {
nullability: NULLABILITY_REQUIRED
}
}
}
}
nullability: NULLABILITY_REQUIRED
}
}
named_table {
names: "t"
}
}
}
names: "x"
names: "y"
names: "z"
}
}
relations {
rel {
read {
Expand All @@ -37,13 +81,7 @@ relations {
}
base_schema {
names: "a"
names: "b"
struct {
types {
i32 {
nullability: NULLABILITY_REQUIRED
}
}
types {
i32 {
nullability: NULLABILITY_REQUIRED
Expand All @@ -53,7 +91,7 @@ relations {
}
}
named_table {
names: "t1"
names: "t"
}
}
}
Expand Down

0 comments on commit 4add4e0

Please sign in to comment.