maropu commented on a change in pull request #30421:
URL: https://github.com/apache/spark/pull/30421#discussion_r531283037
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -41,7 +41,7 @@ INSERT INTO [ TABLE ] table_identifier [ partition_spec ]
* **partition_spec**
An optional parameter that specifies a comma separated list of key and
value pairs
- for partitions.
+ for partitions. Note that one can use a typed value (e.g.,
date'2019-01-02') for a partition column value.
Review comment:
nit: `a typed value` -> `a typed literal`?
##########
File path: docs/sql-migration-guide.md
##########
@@ -52,6 +52,8 @@ license: |
- In Spark 3.1, refreshing a table will trigger an uncache operation for all
other caches that reference the table, even if the table itself is not cached.
In Spark 3.0 the operation will only be triggered if the table itself is cached.
+ - In Spark 3.1, we support typed literal as partition column value, such as
`PARTITION (dt = date '2020-01-01')`, it will be treated as partition column
value `2020-01-01`. In Spark 3.0 the partition value will be treated as `date
'2020-01-01'`.
Review comment:
> we support typed literal as partition column value
Do you mean `we support a typed literal for binary, date, timestamp, and
interval in the INSERT INTO statement`?
> it will be treated as partition column value `2020-01-01`. In Spark 3.0
the partition value will be treated as `date '2020-01-01'`.
What does the statement above mean? For instance, the partition value of the
example query you added in the doc page is null;
```
scala> sql("""CREATE TABLE students (name STRING, address STRING)
PARTITIONED BY (birthday DATE);""")
scala> sql("""INSERT INTO students PARTITION (birthday = date'2019-01-02')
VALUES ('Amy Smith', '123 Park Ave, San Jose');""")
scala> sql("""SELECT * FROM students;""").show()
+---------+--------------------+--------+
| name| address|birthday|
+---------+--------------------+--------+
|Amy Smith|123 Park Ave, San...| null|
+---------+--------------------+--------+
```
Could you make it clearer so that users can understand smoothly?
##########
File path: docs/sql-ref-syntax-dml-insert-into.md
##########
@@ -198,6 +198,21 @@ SELECT * FROM students;
+-------------+-------------------------+----------+
```
+#### Insert Using a Type Constructed Partition Column Value
Review comment:
`Insert Using a Typed Date Literal for a Partition Column Value`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]