Skip to content

Commit

Permalink
feat: improving docs (substrait-io#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
curino committed Aug 9, 2022
1 parent e041822 commit 056073d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions site/docs/relations/logical_relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ If at least one grouping expression is present, the aggregation is allowed to no

## Reference Operator

The reference operator is used to construct DAGs of operations. In a Plan we can have multiple Rel representing various
computations with potentially multiple outputs. The ReferenceRel is used to express the fact that multiple Rel might be
The reference operator is used to construct DAGs of operations. In a `Plan` we can have multiple Rel representing various
computations with potentially multiple outputs. The `ReferenceRel` is used to express the fact that multiple `Rel` might be
sharing subtrees of computation. This can be used to express arbitrary DAGs as well as represent multi-query optimizations.

As a concrete example think about two queries SELECT * FROM A JOIN B JOIN C and SELECT * FROM A JOIN B JOIN D,
We could use the ReferenceRel to highlight the shared A JOIN B between the two queries, by creating a plan with 3 Rel.
One expressing <A JOIN B> (in position 0 in the plan), one using reference as follows: <ReferenceRel(0) JOIN C> and a third one
doing <ReferenceRel(0) JOIN D>. This allows to avoid the redundancy of A JOIN B.
As a concrete example think about two queries `SELECT * FROM A JOIN B JOIN C` and `SELECT * FROM A JOIN B JOIN D`,
We could use the `ReferenceRel` to highlight the shared `A JOIN B` between the two queries, by creating a plan with 3 `Rel`.
One expressing `A JOIN B` (in position 0 in the plan), one using reference as follows: `ReferenceRel(0) JOIN C` and a third one
doing `ReferenceRel(0) JOIN D`. This allows to avoid the redundancy of `A JOIN B`.

| Signature | Value |
| -------------------- | --------------- |
Expand All @@ -331,9 +331,9 @@ doing <ReferenceRel(0) JOIN D>. This allows to avoid the redundancy of A JOIN B.

### Reference Properties

| Property | Description | Required |
|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------------- |
| Referred Rel | A positional reference to a Rel defined within the same Plan. | Required |
| Property | Description | Required |
|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| --------------------------- |
| Referred Rel | A positional reference to a `Rel` defined within the same `Plan`. | Required |

=== "ReferenceRel Message"

Expand Down

0 comments on commit 056073d

Please sign in to comment.