metesynnada commented on issue #7601:
URL: 
https://github.com/apache/arrow-datafusion/issues/7601#issuecomment-1756950433

   I'm unable to reproduce the issue either. This code appears to be 
functioning as expected. Consequently, I'm closing the issue for now, as I'm 
uncertain about the nature of the problem I encountered earlier. It's possible 
that the issue was resolved by other means that I'm not aware of at this time.
   
   ```rust
   #[cfg(test)]
   mod tmp2 {
       use crate::common::Result;
       use crate::physical_plan::{collect, execute_stream, ExecutionPlan};
       use crate::prelude::SessionContext;
       use arrow::util::pretty::print_batches;
       use datafusion_execution::config::SessionConfig;
       use futures::StreamExt;
       use std::sync::Arc;
   
       fn print_plan(plan: &Arc<dyn ExecutionPlan>) -> () {
           let formatted = crate::physical_plan::displayable(plan.as_ref())
               .indent(true)
               .to_string();
           let actual: Vec<&str> = formatted.trim().lines().collect();
           println!("{:#?}", actual);
       }
       #[tokio::test(flavor = "multi_thread", worker_threads = 8)]
       async fn test_unbounded_hash_selection2() -> Result<()> {
           let config = SessionConfig::new()
               .with_target_partitions(1)
               .with_repartition_joins(false)
               .with_batch_size(10);
           let ctx = SessionContext::new_with_config(config);
           let abs = 
"/Users/metehanyildirim/Documents/Synnada/Coding/arrow-datafusion-synnada/datafusion/core/tests/tpch-csv/";
           ctx.sql(&format!(
               "CREATE EXTERNAL TABLE nation (
                       n_nationkey BIGINT,
                       n_name VARCHAR,
                       n_regionkey BIGINT,
                       n_comment VARCHAR,
               ) STORED AS CSV
               WITH HEADER ROW
               WITH ORDER (n_nationkey ASC)
               LOCATION '{abs}nation.csv';"
           ))
               .await?;
   
           let sql = "SELECT n_regionkey FROM nation WHERE n_nationkey < 3;";
   
           let msg = format!("Creating logical plan for '{sql}'");
           let dataframe = ctx.sql(sql).await.expect(&msg);
           let physical_plan = dataframe.create_physical_plan().await?;
           print_plan(&physical_plan);
           let mut stream = execute_stream(physical_plan, ctx.task_ctx())?;
           while let Some(batch) = stream.next().await {
               print_batches(&[batch?])?;
           }
           Ok(())
       }
   }
   ```
   As @alamb pointed out, the parsing error you encountered was due to a 
previous incorrect definition of the table in the code. 


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