ganeshashree commented on code in PR #58034: URL: https://github.com/apache/spark/pull/58034#discussion_r4057446528
########## docs/sql-ref-syntax-qry-select-json-object.md: ########## @@ -0,0 +1,144 @@ +--- +layout: global +title: JSON_OBJECT +displayTitle: JSON_OBJECT +license: | + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--- + +### Description + +The `JSON_OBJECT` constructor function builds a JSON object from key/value pairs and returns it as +JSON text. This is the SQL-standard way (SQL:2016) to assemble a JSON object inline, with common +compatibility syntax from other systems. `JSON_OBJECT` is an expression that can appear anywhere a +value is allowed. + +Each value is serialized with the same JSON writer as the built-in `to_json` function, so numbers, +decimals, booleans, dates, timestamps, and nested structs/arrays/maps render the same way. +Null-field handling inside a struct value therefore follows +`spark.sql.jsonGenerator.ignoreNullFields`, exactly as `to_json` does; the `ON NULL` clause below +controls only the top-level object members. + +This is an initial subset of the SQL:2016 `JSON_OBJECT` constructor. It supports the key/value +members, the `{ NULL | ABSENT } ON NULL` clause, and a string-type `RETURNING`. The following +SQL/JSON clauses are not yet supported: + +* The value-level `FORMAT JSON` marker (which tags a string value as pre-formatted JSON to be + spliced in raw). A nested `JSON_OBJECT` is still spliced in as raw JSON; see the **value** Review Comment: Done. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
