alamb commented on code in PR #13041:
URL: https://github.com/apache/datafusion/pull/13041#discussion_r1810953865


##########
datafusion/core/tests/fuzz_cases/aggregation_fuzzer/data_generator.rs:
##########
@@ -392,6 +392,26 @@ impl RecordBatchGenerator {
                     Float64Type
                 )
             }
+            DataType::Date32 => {

Review Comment:
   ❤️ 



##########
test-utils/src/array_gen/primitive.rs:
##########
@@ -54,7 +54,19 @@ impl PrimitiveArrayGenerator {
                 | DataType::UInt32
                 | DataType::UInt64
                 | DataType::Float32
-                | DataType::Float64 => self.rng.gen::<N>(),
+                | DataType::Float64 
+                | DataType::Date32 => self.rng.gen::<N>(),
+
+                DataType::Date64 => {
+                    // TODO: constrain this range to valid dates if necessary
+                    let date_value = self.rng.gen_range(i64::MIN..=i64::MAX); 
+                    let millis_per_day: i64 = 86_400_000;
+                    let adjusted_value = date_value - (date_value % 
millis_per_day);
+                    // SAFETY: here we can convert i64 to N safely since we 
determine that the type N is i64
+                    unsafe {
+                        std::ptr::read(&adjusted_value as *const i64 as *const 
N)
+                    }

Review Comment:
   I don't think we need to use unsafe -- perhaps adjusted_value.try_into() 
would work.... 



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to