You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/04/17 06:56:31 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #25367: [SPARK-28623][SQL] Support `dow`, `isodow` and `doy` by `extract()`

MaxGekk commented on a change in pull request #25367: [SPARK-28623][SQL] Support `dow`, `isodow` and `doy` by `extract()`
URL: https://github.com/apache/spark/pull/25367#discussion_r410027029
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -1408,6 +1408,12 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
         DayOfMonth(expression(ctx.source))
       case "DAYOFWEEK" =>
         DayOfWeek(expression(ctx.source))
+      case "DOW" =>
+        Subtract(DayOfWeek(expression(ctx.source)), Literal(1))
 
 Review comment:
   Here we just follow PostgreSQL definition of `DOW`, see:
   ```
   dow
   The day of the week as Sunday (0) to Saturday (6)
   
   SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');
   Result: 5
   ```
   Do you propose to break compatibility with PostgreSQL?

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


With regards,
Apache Git Services

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