milenkovicm opened a new issue, #15718:
URL: https://github.com/apache/datafusion/issues/15718

   ### Describe the bug
   
   Partitioned `ListingTable` logical plan round trip fails to produce valid 
schema after deserialisation 
   
   ### To Reproduce
   
   ```rust
           let session_state = ctx.state();
           let data = format!("{test_data}/hive_style/");
           let listing_table_url = ListingTableUrl::parse(data)?;
   
           let table_partition_cols = vec![
               ("year".to_owned(), DataType::Int64),
               ("month".to_owned(), DataType::Int64),
           ];
   
           let file_format = ParquetFormat::new()
               .with_enable_pruning(true)
               .with_skip_metadata(true);
   
           let listing_options = ListingOptions::new(Arc::new(file_format))
               .with_table_partition_cols(table_partition_cols);
   
           let config = ListingTableConfig::new(listing_table_url)
               .with_listing_options(listing_options)
               .infer_schema(&session_state)
               .await?;
   
           ctx.register_table("hive_style", 
Arc::new(ListingTable::try_new(config)?))?;
           //
           // Limit: skip=0, fetch=1
           //  Projection: hive_style.year, hive_style.month
           //   TableScan: hive_style
           //
           let plan = ctx
               .sql("SELECT year, month FROM hive_style LIMIT 1")
               .await?
               .logical_plan()
               .clone();
   
           let expected = [
               "+------+-------+",
               "| year | month |",
               "+------+-------+",
               "| 2024 | 1     |",
               "+------+-------+",
           ];
   
           // works as expected
           let result = ctx
               .execute_logical_plan(plan.clone())
               .await?
               .collect()
               .await?;
           assert_batches_eq!(expected, &result);
   
           let bytes = logical_plan_to_bytes(&plan)?;
   
           // logical plan from bytes fails
           //
           // Error: SchemaError(DuplicateQualifiedField { qualifier: Bare { 
table: "hive_style" }, name: "year" }, Some(""))
           let plan = logical_plan_from_bytes(&bytes, &ctx)?;
   
           let result = ctx.execute_logical_plan(plan).await?.collect().await?;
           assert_batches_eq!(expected, &result);
   ```
   
   ### Expected behavior
   
   Expected correct deserialisation 
   
   ### Additional context
   
   I believe schema used at 
https://github.com/apache/datafusion/blob/7ff6c7e68540c69b399a171654d00577e6f886bf/datafusion/proto/src/logical_plan/mod.rs#L1127
 should not contain partitioned columns. 
   
   Also, more details can be found in 
https://github.com/apache/datafusion-ballista/issues/1239


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