sarahyurick commented on issue #3408:
URL: 
https://github.com/apache/arrow-datafusion/issues/3408#issuecomment-1286006279

   I'm not really able to reproduce the error on the DataFusion side. For 
example:
   
   ```
   use datafusion::prelude::*;
   
   #[tokio::main]
   async fn main() -> datafusion::error::Result<()> {
     let ctx = SessionContext::new();
   
     let schema = datafusion::arrow::datatypes::Schema::new(vec![
       datafusion::arrow::datatypes::Field::new("i_item_desc", 
datafusion::arrow::datatypes::DataType::Utf8, true),
       datafusion::arrow::datatypes::Field::new("d3_date", 
datafusion::arrow::datatypes::DataType::Date64, true),
       datafusion::arrow::datatypes::Field::new("d1_date", 
datafusion::arrow::datatypes::DataType::Date64, true),
     ]);
   
     ctx.register_csv(
       "test", "data.csv", CsvReadOptions::default().schema(&schema)
     ).await?;
   
     let df = ctx.sql("select i_item_desc \
           from test \
           where d3_date > d1_date + INTERVAL '5 days'").await?;
   
     df.show().await?;
     Ok(())
   }
   ```
   
   where the contents of `data.csv` are:
   
   ```
   i_item_desc,d3_date,d1_date
   a,2022-12-12T7:7:7,2022-12-12T7:7:7
   b,2022-12-12T7:7:7,2022-12-11T7:7:7
   c,2022-12-12T7:7:7,2022-12-10T7:7:7
   d,2022-12-12T7:7:7,2022-12-9T7:7:7
   e,2022-12-12T7:7:7,2022-12-8T7:7:7
   f,2022-12-12T7:7:7,2022-12-7T7:7:7
   g,2022-12-12T7:7:7,2022-12-6T7:7:7
   h,2022-12-12T7:7:7,2022-12-5T7:7:7
   ```
   
   Produces the expected output without any errors. I'm able to get the correct 
results on the Dask-SQL side, too:
   
   ```
   import pandas as pd
   from dask_sql import Context
   from datetime import datetime
   
   c = Context()
   
   test = pd.DataFrame(
       {
           "i_item_desc": ["a", "b", "c", "d", "e", "f", "g", "h"],
           "d3_date": [
               datetime(2002, 6, 5),
               datetime(2002, 6, 6),
               datetime(2002, 6, 7),
               datetime(2002, 6, 8),
               datetime(2002, 6, 9),
               datetime(2002, 6, 10),
               datetime(2002, 6, 11),
               datetime(2002, 6, 12),
           ],
           "d1_date": [
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
               datetime(2002, 6, 5),
           ],
       }
   )
   c.create_table("test", test)
   
   c.sql("select i_item_desc \
           from test \
           where d3_date > d1_date + INTERVAL '5 days'").compute()
   ```
   
   Is there maybe another example I should try?


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

Reply via email to