[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-06-01 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r643046775



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow`, and `now` are supported in typed literals only, for 
instance, `select timestamp'now'`. In Spark 3.1 and 3.0, such special values 
are supported in any casts of strings to dates/timestamps. To keep these 
special values as dates/timestamps in Spark 3.1 and 3.0, you should replace 
them manually, e.g. `if (c in ('now', 'today'), current_date(), cast(c as 
date))`.

Review comment:
   @cloud-fan See the example:
   ```scala
   scala> val df = Seq("now", "2021-01-19", "today").toDF("c")
   df: org.apache.spark.sql.DataFrame = [c: string]
   
   scala> df.selectExpr("if (c in ('now', 'today'), current_date(), cast(c as 
date))").show(false)
   +--+
   |(IF((c IN (now, today)), current_date(), CAST(c AS DATE)))|
   +--+
   |2021-06-01|
   |2021-01-19|
   |2021-06-01|
   +--+
   ```




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-06-01 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r642934371



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, the special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow` and `now` are supported in typed literals only, for 
instance `select timestamp'now'`. In Spark 3.1 and earlier, such special values 
are supported in any casts of strings to dates/timestamps. To restore the 
behavior before Spark 3.2, you should preprocess string columns and convert the 
strings to desired timestamps explicitly using UDF for instance.

Review comment:
   I agree that builtin functions is better suggestion. Let me update this.




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-06-01 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r642934371



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, the special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow` and `now` are supported in typed literals only, for 
instance `select timestamp'now'`. In Spark 3.1 and earlier, such special values 
are supported in any casts of strings to dates/timestamps. To restore the 
behavior before Spark 3.2, you should preprocess string columns and convert the 
strings to desired timestamps explicitly using UDF for instance.

Review comment:
   I agree that builtin functions is better suggestion. Let's me update 
this.




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-06-01 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r642880745



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow` and `now` are supported in typed literals only, for 
instance `select timestamp'now'`. In Spark 3.1 and 3.0, such special values are 
supported in any casts of strings to dates/timestamps. To restore the behavior 
before Spark 3.2, you should preprocess string columns and convert the strings 
to desired dates/timestamps explicitly using UDF for instance.

Review comment:
   hmm, I am not sure all those commas are mandatory, especially before 
`and`.




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-06-01 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r642879319



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, the special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow` and `now` are supported in typed literals only, for 
instance `select timestamp'now'`. In Spark 3.1 and earlier, such special values 
are supported in any casts of strings to dates/timestamps. To restore the 
behavior before Spark 3.2, you should preprocess string columns and convert the 
strings to desired timestamps explicitly using UDF for instance.

Review comment:
   What do you propose? How about `To have the behavior before Spark 3.2 
...`




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] MaxGekk commented on a change in pull request #32714: [SPARK-35581][SQL] Support special datetime values in typed literals only

2021-05-31 Thread GitBox


MaxGekk commented on a change in pull request #32714:
URL: https://github.com/apache/spark/pull/32714#discussion_r642795083



##
File path: docs/sql-migration-guide.md
##
@@ -91,6 +91,8 @@ license: |
 
   - In Spark 3.2, `CREATE TABLE AS SELECT` with non-empty `LOCATION` will 
throw `AnalysisException`. To restore the behavior before Spark 3.2, you can 
set `spark.sql.legacy.allowNonEmptyLocationInCTAS` to `true`.
 
+  - In Spark 3.2, the special datetime values such as `epoch`, `today`, 
`yesterday`, `tomorrow` and `now` are supported in typed literals only, for 
instance `select timestamp'now'`. In Spark 3.1 and earlier, such special values 
are supported in any casts of strings to dates/timestamps. To restore the 
behavior before Spark 3.2, you should preprocess string columns and convert the 
strings to desired timestamps explicitly using UDF for instance.

Review comment:
   @yaooqinn What do you mean by: for instance **(add',')** `select 
timestamp'now'`. I didn't get the problem. BTW, you could use the suggestion 
feature, so, I would just commit your suggestions.




-- 
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:
us...@infra.apache.org



-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org