jorgecarleitao commented on a change in pull request #9355:
URL: https://github.com/apache/arrow/pull/9355#discussion_r566558997



##########
File path: rust/datafusion/tests/sql.rs
##########
@@ -1398,6 +1401,21 @@ fn register_aggregate_simple_csv(ctx: &mut 
ExecutionContext) -> Result<()> {
     Ok(())
 }
 
+fn register_aggregate_date_csv(ctx: &mut ExecutionContext) -> Result<()> {
+    // It's not possible to use aggregate_test_100, not enought similar values 
to test grouping on floats
+    let schema = Arc::new(Schema::new(vec![
+        Field::new("date", DataType::Date32(DateUnit::Day), false),
+        Field::new("cnt", DataType::Int32, false),
+    ]));
+
+    ctx.register_csv(
+        "dates",
+        "tests/dates.csv",
+        CsvReadOptions::new().schema(&schema),
+    )?;
+    Ok(())
+}

Review comment:
       What do you think about placing the data in `MemTable` and directly on 
the test, like this:
   
   ```
       let data = RecordBatch::try_new(
           schema.clone(),
           vec![Arc::new(StringArray::from(vec![
               Some("a"),
               Some("b"),
               Some("c"),
               None,
           ]))],
       )?;
       let table = MemTable::try_new(schema, vec![vec![data]])?;
       ctx.register_table("dates", Box::new(table));
   ```
   
   It is much easier to understand the final result, the numbers "6" and "9", 
when the data and query are next to each other.
   
   Alternatively, the test caters for an explanation of why we get 2 entries 
and why its numbers are 6 and 9.




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

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


Reply via email to