morrySnow commented on code in PR #1845: URL: https://github.com/apache/doris-website/pull/1845#discussion_r1919827415
########## docs/sql-manual/sql-functions/scalar-functions/struct-functions/named-struct.md: ########## @@ -22,48 +22,39 @@ specific language governing permissions and limitations under the License. --> -## named_struct +## description -named_struct +Construct and return a struct based on the given strings and values. Notes: -### description +- The number of parameters must be a non-zero even number.The odd-indexed elements are the names of the fields, which must be constant strings.The even-indexed elements are the values of the fields, which can be either multiple columns or constants. -#### Syntax +## Syntax -`STRUCT<T1, T2, T3, ...> named_struct({VARCHAR, T1}, {VARCHAR, T2}, ...)` +```sql +NAMED_STRUCT( <field_name> , <filed_value> [ , <field_name> , <filed_value> ... ] ) +``` -Construct a struct with the given field names and values. +## Parameters -The number of parameters must be non zero and even. With odd digits being the name of the field and could be string literal, with even digits being the value of the field and could be column or literal. +| Parameter | Description | +| -- | -- | +| `<field_name>` | The odd-indexed elements in constructing the struct are the field names, which must be constant strings | +| `<filed_value>` | The even-indexed elements in constructing the struct represent the field values, which can be either multiple columns or constants | -### example +## Return Value -``` -mysql> select named_struct('f1', 1, 'f2', 'a', 'f3', "abc"); -+-----------------------------------------------+ -| named_struct('f1', 1, 'f2', 'a', 'f3', 'abc') | -+-----------------------------------------------+ -| {1, 'a', 'abc'} | -+-----------------------------------------------+ -1 row in set (0.01 sec) +Construct and return a struct based on the given strings and values. -mysql> select named_struct('a', null, 'b', "v"); -+-----------------------------------+ -| named_struct('a', NULL, 'b', 'v') | -+-----------------------------------+ -| {NULL, 'v'} | -+-----------------------------------+ -1 row in set (0.01 sec) +## example Review Comment: ```suggestion ## Example ``` ########## docs/sql-manual/sql-functions/scalar-functions/struct-functions/named-struct.md: ########## @@ -22,48 +22,39 @@ specific language governing permissions and limitations under the License. --> -## named_struct +## description Review Comment: ```suggestion ## Description ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org