-
Notifications
You must be signed in to change notification settings - Fork 211
Implement native function of dayofweek. #2128
Description
Description
Implement Spark-compatible dayofweek() function
Auron already supports several Spark-compatible date/time extraction functions such as year(), month(), dayofmonth(), quarter(), hour(), minute(), and second().
However, Spark also provides a companion function dayofweek() that returns the day of the week using Spark’s semantics:
Sunday = 1, Monday = 2, ..., Saturday = 7
To improve compatibility with Spark SQL, we should implement dayofweek() natively with the following characteristics:
Expected behavior
Function name: dayofweek(expr)
Return type: INT
Semantics: Sunday = 1, Monday = 2, ..., Saturday = 7
Example:
dayofweek('2009-07-30') → 5
Supports: DATE, TIMESTAMP, and compatible string/date inputs consistent with existing date extraction functions
Null-safe: should return NULL if input is NULL
Array and scalar inputs: consistent with current date extraction function implementations
Motivation
Ensure feature parity with Apache Spark SQL
Improve compatibility for expressions and queries migrated from Spark
Reduce fallback occurrences to Spark expression/UDF wrapper