diff --git a/velox/functions/sparksql/DateTimeFunctions.h b/velox/functions/sparksql/DateTimeFunctions.h index b951e40d797a..eb5c321a254f 100644 --- a/velox/functions/sparksql/DateTimeFunctions.h +++ b/velox/functions/sparksql/DateTimeFunctions.h @@ -505,7 +505,7 @@ struct WeekdayFunction { // 0 = Monday, 1 = Tuesday, ..., 6 = Sunday FOLLY_ALWAYS_INLINE int32_t getWeekday(const std::tm& time) { - return (time.tm_wday - 6) % 7; + return (time.tm_wday + 6) % 7; } FOLLY_ALWAYS_INLINE void call(int32_t& result, const arg_type& date) {