diff --git a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md index dac20fb48a8df..2d02c995a57a6 100644 --- a/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md +++ b/docs/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md @@ -15,10 +15,21 @@ Generate one JSON object containing specified Key-Value pairs. Returns an error JSON_OBJECT (, [, , , ...]) ``` +```sql +JSON_OBJECT(*) +``` + ## Parameters ### Variable parameters: - ``: String type - ``: Multiple types, Doris will automatically convert non-JSON type parameters to JSON type through the [`TO_JSON`](./to-json.md) function. +- `*`: When invoked with an asterisk (wildcard), the OBJECT value is constructed from the specified data using the attribute names as keys and the associated values as values. + + When you pass a wildcard to the function, you can qualify the wildcard with the name or alias for the table. For example, to pass in all of the columns from the table named mytable, specify the following: + + ```sql + (mytable.*) + ``` ## Notes - The number of parameters must be even, can be 0 parameters (returns an empty JSON object). diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md index 35da7e1fc78ed..121020941272f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/json-functions/json-object.md @@ -15,10 +15,20 @@ JSON_OBJECT (, [, , , ...]) ``` +```sql +JSON_OBJECT(*) +``` + ## 参数 -### 可变参数: -- String 类型 -- 多种类型,Doris 会自动将非 Json 类型的参数通过 [`TO_JSON`](./to-json.md) 函数将其转换为 Json 类型。 +- `` String 类型 +- `` 多种类型,Doris 会自动将非 Json 类型的参数通过 [`TO_JSON`](./to-json.md) 函数将其转换为 Json 类型。 +:`*` 当使用星号(通配符)调用时,会使用指定数据中的引用名成作为键(key),对应的值作为值(value),从而构造出一个 JSON 类型的值。 + + 当向该函数传入通配符时,可以用表的名称或别名对通配符进行限定。例如,若要传入名为 mytable 的表中的所有列,请按如下方式指定: + + ```sql + (mytable.*) + ``` ## 注意事项 - 参数数量必须为偶数个,可以是 0 个参数(返回一个空的 Json 对象)。