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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to