Skip to content

Commit

Permalink
docs: migrate new struct content to md docs (DOCS-3240) (#4326)
Browse files Browse the repository at this point in the history
* docs: migrate new struct content to md docs (DOCS-3240)

* docs: remove inline struct content for .rst

* docs: restore inline struct content for .rst
  • Loading branch information
JimGalasyn authored Jan 16, 2020
1 parent 37c1eaa commit 89b7fcf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
16 changes: 13 additions & 3 deletions docs-md/developer-guide/syntax-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,19 @@ SELECT address->city, address->zip FROM orders;

For more info, see [Operators](#operators).

!!! note
You can't create new nested `STRUCT` data as the result of a query, but
you can copy existing `STRUCT` fields as-is.
You can create a `STRUCT` in a query by specifying the names of the columns
and expressions that construct the values, separated by commas. The following
example SELECT statement creates a schema that has a `STRUCT`.

```sql
SELECT STRUCT(name := col0, ageInDogYears := col1*7) AS dogs FROM animals
```

If `col0` is a string and `col1` is an integer, the resulting schema is:

```sql
col0 STRUCT<name VARCHAR, ageInDogYears INTEGER>
```

### ksqlDB Time Units

Expand Down
22 changes: 13 additions & 9 deletions docs/developer-guide/syntax-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ encapsulate a street address and a postal code:
orderId BIGINT,
address STRUCT<street VARCHAR, zip INTEGER>) WITH (...);
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 STRUCT(name := col0, ageInDogYears := col1*7) AS dogs FROM animals``
creates a schema ``col0 STRUCT<name VARCHAR, ageInDogYears INTEGER>``, assuming ``col0`` was a string and
``col1`` was an integer.

Access the fields in a ``STRUCT`` by using the dereference operator (``->``):

.. code:: sql
Expand All @@ -86,8 +79,19 @@ Access the fields in a ``STRUCT`` by using the dereference operator (``->``):
For more info, see :ref:`operators`.

.. note:: You can’t create new nested ``STRUCT`` data as the result of a query,
but you can copy existing ``STRUCT`` fields as-is.
You can create a ``STRUCT`` in a query by specifying the names of the columns
and expressions that construct the values, separated by commas. The following
example SELECT statement creates a schema that has a ``STRUCT``.

.. code:: sql
SELECT STRUCT(name := col0, ageInDogYears := col1*7) AS dogs FROM animals
If ``col0`` is a string and ``col1`` is an integer, the resulting schema is:

.. code:: sql
col0 STRUCT<name VARCHAR, ageInDogYears INTEGER>
.. _ksql-time-units:

Expand Down

0 comments on commit 89b7fcf

Please sign in to comment.