cloud-fan 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_r410007594
 
 

 ##########
 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:
   It's very confusing that `DOW` returns different results from `DAYOFWEEK`. 
`DOW` should just be an abbreviation of `DAYOFWEEK`. See also 
https://docs.snowflake.com/en/sql-reference/functions-date-time.html#label-supported-date-time-parts
   
   Do we have a clear document about what these names mean? cc @HyukjinKwon 
@maropu @wangyum 

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