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

feat: add support for inline struct creation #4120

Merged
merged 6 commits into from
Dec 19, 2019
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
Prev Previous commit
Next Next commit
docs: add docs for inline structs
  • Loading branch information
agavra committed Dec 19, 2019
commit bf800a592e312a9e119b03834658ddf60c8cdc55
6 changes: 6 additions & 0 deletions docs-md/developer-guide/syntax-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ statement by using the syntax `STRUCT<FieldName FieldType, ...>`. For
example, `STRUCT<ID BIGINT, NAME STRING, AGE INT>` defines a struct with
three fields, with the supplied name and type.

You can create a struct in a query by specifying the names of the columns
and expressions that construct the values, separated by `,` and wrapped with
curly braces. For example: `SELECT {name col0, ageInDogYears col1*7} AS dogs FROM animals`
would create a schema `col0 STRUCT<VARCHAR, INTEGER>` (assuming `col0` was a string and
agavra marked this conversation as resolved.
Show resolved Hide resolved
`col1` was an integer).
agavra marked this conversation as resolved.
Show resolved Hide resolved

Access the fields of a struct by using the `->` operator. For example,
`SOME_STRUCT->ID` retrieves the value of the struct's `ID` field. For
more information, see [Operators](#operators).
Expand Down