Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add example for field_references #520

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
MasseGuillaume marked this conversation as resolved.
Show resolved Hide resolved

SQL expression:
a.b[2].c['my_map_key'].x
```

```
MasseGuillaume marked this conversation as resolved.
Show resolved Hide resolved
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 {
}
}
MasseGuillaume marked this conversation as resolved.
Show resolved Hide resolved
```

#### 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