kumarUjjawal commented on code in PR #24565:
URL: https://github.com/apache/datafusion/pull/24565#discussion_r3873874217


##########
datafusion/sqllogictest/test_files/run_end_encoded.slt:
##########
@@ -85,3 +85,63 @@ false false
 true true
 true true
 true true
+
+# date_bin's signature is a plain Timestamp, not RunEndEncoded, so this only
+# plans if coerced_from() unwraps the REE value type the same way it does for
+# Dictionary (see test_coerced_from_run_end_encoded)
+statement ok
+CREATE TABLE ree_timestamps AS
+SELECT
+    arrow_cast(
+        arrow_cast(ts, 'Timestamp(Nanosecond, None)'),
+        'RunEndEncoded("run_ends": non-null Int32, "values": 
Timestamp(Nanosecond, None))'
+    ) AS ts
+FROM (VALUES
+    ('2023-12-04T00:00:00'),
+    ('2023-12-04T00:05:00'),
+    ('2023-12-04T00:35:00')
+) AS t(ts);
+
+query P rowsort
+SELECT date_bin('30 minutes', ts) FROM ree_timestamps;
+----
+2023-12-04T00:00:00
+2023-12-04T00:00:00
+2023-12-04T00:30:00
+
+# RANGE window frames are intentionally NOT supported over an REE-encoded
+# ORDER BY column and must fail at planning time, unlike Dictionary (which
+# extract_window_frame_target_type() in
+# datafusion/optimizer/src/analyzer/type_coercion.rs does unwrap). An offset
+# RANGE bound (`k PRECEDING`/`k FOLLOWING`) is computed by adding/subtracting
+# the offset from the current row's value, and a value pulled from a
+# still-REE-wrapped column isn't something arrow's arithmetic kernels handle
+# -- so rather than let that reach execution (silently or otherwise), REE is
+# rejected up front for RANGE frames of any bound kind. Tracked upstream at
+# https://github.com/apache/arrow-rs/issues/10891 (arithmetic kernel support
+# for RunEndEncoded); once that lands, this can go back to a real query.

Review Comment:
   nit: could you trim this a little bit



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