leaves12138 commented on code in PR #9724:
URL: https://github.com/apache/paimon/pull/9724#discussion_r3979672557


##########
docs/docs/spark/default-value.md:
##########
@@ -44,56 +50,73 @@ CREATE TABLE my_table (
 
 ## Insert Table
 
-For SQL commands that execute table writes, such as the `INSERT`, `UPDATE`, 
and `MERGE` commands, the `DEFAULT` keyword
-or `NULL` value is parsed into the default value specified for the 
corresponding column.
-
-For example:
+Omit columns from an explicit column list to use their defaults:
 
 ```sql
 INSERT INTO my_table (a) VALUES (1), (2);
 
-SELECT * FROM my_table;
--- result: [[1, my_value, 5, [tag1, tag2, tag3], {'key1' -> 'value1', 'key2' 
-> 'value2'}, {42, default_value}],
---          [2, my_value, 5, [tag1, tag2, tag3], {'key1' -> 'value1', 'key2' 
-> 'value2'}, {42, default_value}]]
+SELECT a, b, c FROM my_table ORDER BY a;
+-- 1  my_value  5
+-- 2  my_value  5
 ```
 
-## Alter Default Value
+`DEFAULT` requests the column default explicitly. A written `NULL` in the 
nullable column `c`
+is also replaced by its default:
+
+```sql
+INSERT INTO my_table (a, b, c) VALUES (3, DEFAULT, NULL);
 
-Paimon supports alter column default value.
+SELECT a, b, c FROM my_table WHERE a = 3;
+-- 3  my_value  5
+```
 
-For example:
+The complex columns receive the defaults declared above. Inspect individual 
fields instead
+of printing an entire nested row:
 
 ```sql
-CREATE TABLE T (a INT, b INT DEFAULT 2);
+SELECT tags, properties['key1'], nested.x FROM my_table WHERE a = 3;
+-- [tag1, tag2, tag3]  value1  42

Review Comment:
   [P2] Make the new complex-default lookup examples match the runtime
   
   Running the documented CREATE TABLE and INSERT statements on this head with 
Spark 3.5.8 does not produce the result shown here: `tags` contains the literal 
quote characters (`'tag1'`, etc.), and `properties['key1']` returns NULL, not 
`value1`. The current complex-default parsers preserve the single quotes inside 
ARRAY/MAP expressions, so the stored map key is literally `'key1'`, including 
the quotes. This is an existing parser limitation rather than a runtime 
regression in this PR, but these newly added field-lookup examples now 
advertise results that readers cannot reproduce; the new 
`properties['new_key']` example has the same limitation. Please use complex 
defaults that the current implementation can round-trip correctly, or document 
the limitation and adjust the examples/results. Changing the MAP literals to 
double quotes fixes the map lookup in this Spark setup, but doing that for 
ARRAY still retains quote characters in its elements.
   



-- 
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]

Reply via email to