Skip to content

Commit

Permalink
docs: add example for field_references
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseGuillaume committed Jul 13, 2023
1 parent e486775 commit 62406b2
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions site/docs/expressions/field_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,59 @@ In Substrait, all fields are dealt with on a positional basis. Field names are o
| Map KeyExpression | A wildcard string that is matched against a simplified form of regular expressions. Requires the key type of the map to be a character type. [Format detail needed, intention to include basic regex concepts such as greedy/non-greedy.] | map | List of map value type |
| Masked Complex Expression | An expression that provides a mask over a schema declaring which portions of the schema should be presented. This allows a user to select a portion of a complex object but mask certain subsections of that same object. | any | any |


```
Schema:
a: struct
b: list
c: map string
x: i32
SQL expression:
a.b[2].c['my_map_key'].x
```

```
Example Protobuf Text:
selection {
direct_reference {
struct_field {
field: 0 # .x
child {
map_key {
map_key {
string: "my_map_key" # ['my_map_key']
}
child {
struct_field {
field: 0 # .c
child {
list_element {
offset: 2 # [2]
child {
struct_field {
field: 0 # .b
child {
struct_field {
field: 0 # .a
}
}
}
}
}
}
}
}
}
}
}
}
root_reference {
}
}
```

#### Compound References

References are typically constructed as a sequence. For example: [struct position 0, struct position 1, array offset 2, array slice 1..3].
Expand Down

0 comments on commit 62406b2

Please sign in to comment.