From 89b7fcf0107de55b65d23333a94c21feb6d056b2 Mon Sep 17 00:00:00 2001 From: Jim Galasyn Date: Thu, 16 Jan 2020 13:00:22 -0800 Subject: [PATCH] docs: migrate new struct content to md docs (DOCS-3240) (#4326) * docs: migrate new struct content to md docs (DOCS-3240) * docs: remove inline struct content for .rst * docs: restore inline struct content for .rst --- docs-md/developer-guide/syntax-reference.md | 16 ++++++++++++--- docs/developer-guide/syntax-reference.rst | 22 ++++++++++++--------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/docs-md/developer-guide/syntax-reference.md b/docs-md/developer-guide/syntax-reference.md index ed547592b054..76863b834b1a 100644 --- a/docs-md/developer-guide/syntax-reference.md +++ b/docs-md/developer-guide/syntax-reference.md @@ -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 +``` ### ksqlDB Time Units diff --git a/docs/developer-guide/syntax-reference.rst b/docs/developer-guide/syntax-reference.rst index 90a7e6ba9155..0c71bfa50528 100644 --- a/docs/developer-guide/syntax-reference.rst +++ b/docs/developer-guide/syntax-reference.rst @@ -71,13 +71,6 @@ encapsulate a street address and a postal code: orderId BIGINT, address STRUCT) 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``, assuming ``col0`` was a string and -``col1`` was an integer. - Access the fields in a ``STRUCT`` by using the dereference operator (``->``): .. code:: sql @@ -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 .. _ksql-time-units: