You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/05 23:32:54 UTC

[GitHub] [arrow-datafusion] jonmmease opened a new issue, #2462: Projection pushdown produces incorrect results when column names are reused

jonmmease opened a new issue, #2462:
URL: https://github.com/apache/arrow-datafusion/issues/2462

   **Describe the bug**
   In certain situations where projections are used to overwrite a column's value, the projection pushdown optimization pass causes the incorrect column value to be produced.
   
   **To Reproduce**
   Here is a failing test that will be included in the follow-on PR
   
   ```rust
   #[tokio::test]
   async fn select_with_alias_overwrite() -> Result<()> {
       let schema = Schema::new(vec![Field::new("a", DataType::Int32, false)]);
   
       let batch = RecordBatch::try_new(
           Arc::new(schema.clone()),
           vec![Arc::new(Int32Array::from_slice(&[1, 10, 10, 100]))],
       )
       .unwrap();
   
       let ctx = SessionContext::new();
       let provider = MemTable::try_new(Arc::new(schema), vec![vec![batch]]).unwrap();
       ctx.register_table("t", Arc::new(provider)).unwrap();
   
       let df = ctx
           .table("t")
           .unwrap()
           .select(vec![col("a").alias("a")])
           .unwrap()
           .select(vec![(col("a").eq(lit(10))).alias("a")])
           .unwrap()
           .select(vec![col("a")])
           .unwrap();
   
       let results = df.collect().await.unwrap();
   
       #[rustfmt::skip]
           let expected = vec![
           "+-------+",
           "| a     |",
           "+-------+",
           "| false |",
           "| true  |",
           "| true  |",
           "| false |",
           "+-------+",
       ];
       assert_batches_eq!(expected, &results);
   
       Ok(())
   }
   ```
   presently, the values produced for column `a` are the original values `[1, 10, 10, 100]` rather than the expected values `[false, true, true, false]`.
   
   PR to follow shortly
   


-- 
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-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow-datafusion] alamb closed issue #2462: Projection pushdown produces incorrect results when column names are reused

Posted by GitBox <gi...@apache.org>.
alamb closed issue #2462: Projection pushdown produces incorrect results when column names are reused
URL: https://github.com/apache/arrow-datafusion/issues/2462


-- 
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-unsubscribe@arrow.apache.org

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