harsh-ande commented on code in PR #26127:
URL: https://github.com/apache/datafusion/pull/26127#discussion_r4366410207


##########
datafusion/sqllogictest/test_files/spark/datetime/next_day.slt:
##########
@@ -100,3 +100,52 @@ query I
 SELECT arrow_cast(next_day(arrow_cast(95026230, 'Date32'), 'Tue'::string), 
'Int32');
 ----
 95026237
+
+# https://github.com/apache/datafusion/issues/23889
+# Spark casts the start date to DATE, so STRING and TIMESTAMP are accepted
+query D
+SELECT next_day('2015-07-23'::string, 'Mon'::string);
+----
+2015-07-27
+
+query D
+SELECT next_day('2015-07-23 12:12:12'::string, 'Mon'::string);
+----
+2015-07-27
+
+query D
+SELECT next_day('2015-07-23 12:12:12'::timestamp, 'Mon'::string);
+----
+2015-07-27
+
+query D
+SELECT next_day(a, 'Mon'::string)
+FROM VALUES
+    ('2015-07-23'::string),
+    (NULL::string) as t(a);
+----
+2015-07-27
+NULL
+
+# Timestamp column with a day-of-week column
+query D
+SELECT next_day(a, b)
+FROM VALUES
+    ('2015-07-23 12:12:12'::timestamp, 'Mon'::string),
+    ('2015-07-23 23:59:59'::timestamp, 'Fri'::string),
+    (NULL::timestamp, 'Mon'::string) as t(a, b);
+----
+2015-07-27
+2015-07-24
+NULL
+
+# String start date and LargeUtf8 / Utf8View day-of-week
+query D
+SELECT next_day('2015-07-23', arrow_cast('Mon', 'LargeUtf8'));

Review Comment:
   Added `LargeUtf8` and `Utf8View` start-date cases; both return `2015-07-27`.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to