xavlee commented on code in PR #24500:
URL: https://github.com/apache/datafusion/pull/24500#discussion_r3816732718


##########
datafusion/sqllogictest/src/test_context/range_partitioning.rs:
##########
@@ -292,3 +294,173 @@ fn range_batch(schema: SchemaRef, rows: &[(i32, i32, 
i32)]) -> RecordBatch {
     )
     .expect("range batch should be valid")
 }
+
+// 
==============================================================================
+// Metrics table: range-partitioned on timestamp, sorted on (key, timestamp)
+// 
==============================================================================
+
+/// Unix nanoseconds for `2024-01-01 00:00:00 UTC`.
+const METRICS_EPOCH_NS: i64 = 1_704_067_200_000_000_000;
+const NANOS_PER_SECOND: i64 = 1_000_000_000;
+const NANOS_PER_MINUTE: i64 = 60 * NANOS_PER_SECOND;
+
+/// Timestamp helper: minutes and seconds after `2024-01-01 00:00:00 UTC`.
+fn metrics_ts(minutes: i64, seconds: i64) -> i64 {
+    METRICS_EPOCH_NS + minutes * NANOS_PER_MINUTE + seconds * NANOS_PER_SECOND
+}
+
+/// Row: (key, zone, host, pod, service, timestamp_ns, value)
+type MetricsRow = (
+    &'static str,
+    &'static str,
+    &'static str,
+    &'static str,
+    &'static str,
+    i64,
+    i64,
+);
+
+/// Registers `metrics_range_sorted` for time-bin aggregation plan tests.
+///
+/// Two file groups, each covering a 60-minute timestamp range:
+/// - partition 0: `[2024-01-01 00:00, 01:00)`
+/// - partition 1: `[2024-01-01 01:00, 02:00)`
+///
+/// Files are range-partitioned on `timestamp` and sorted on `(key, 
timestamp)`.
+/// Because `date_bin(60 seconds, timestamp)` does not straddle the hour split,
+/// grouping by `(key, time_bin)` is partition-disjoint. Today's planner still
+/// inserts a hash shuffle; the test pins that plan so a follow-up can remove 
it.

Review Comment:
   This will be addressed in https://github.com/apache/datafusion/issues/24438 
👍 



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