You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "crepererum (via GitHub)" <gi...@apache.org> on 2023/04/19 13:26:29 UTC

[GitHub] [arrow-datafusion] crepererum opened a new issue, #6057: `make_array` -> `unnest` w/ dict-encoded strings fails

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

   ### Describe the bug
   
   Piping a dictionary encoded string column through `make_array` and `unnest` fails with:
   
   `ArrowError(InvalidArgumentError("column types must match schema types, expected Dictionary(Int32, Utf8) but found Utf8 at column index 0"))`
   
   This might either be an DataFusion bug or a bug in arrow-rs.
   
   ### To Reproduce
   
   ```rust
   #[tokio::test]
   async fn test_unnest_broken() {
       let ctx = SessionContext::new();
   
       // this works:
       //    let v = lit("x");
       let v = lit(ScalarValue::Dictionary(
           Box::new(DataType::Int32),
           Box::new(ScalarValue::new_utf8("x")),
       ));
   
       let plan = LogicalPlanBuilder::values(vec![vec![v]])
       .unwrap()
       .project([Expr::ScalarFunction {
           fun: BuiltinScalarFunction::MakeArray,
           args: vec![col("column1")],
       }
       .alias("array")])
       .unwrap()
       .unnest_column("array")
       .unwrap()
       .build()
       .unwrap();
   
       let df = ctx.execute_logical_plan(plan).await.unwrap();
   
       df.collect().await.unwrap();
   }
   ```
   
   ### Expected behavior
   
   It just works like w/ "normal" strings (i.e. when not using dictionary encoding).
   
   ### Additional context
   
   Tested on 9798fbcab1e04123f05e7692475e104310e0473a .


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


Re: [I] `make_array` -> `unnest` w/ dict-encoded strings fails [datafusion]

Posted by "duongcongtoai (via GitHub)" <gi...@apache.org>.
duongcongtoai commented on issue #6057:
URL: https://github.com/apache/datafusion/issues/6057#issuecomment-2626964540

   some work has been going on with unnest, and somehow this bug can no longer be reproduced
   ```
   async fn test_unnest_used_to_be_broken() {
       let ctx = SessionContext::new();
   
       // this works:
       // let v = lit("x");
       let v = lit(ScalarValue::Dictionary(
           Box::new(DataType::Int32),
           Box::new(ScalarValue::new_utf8("x")),
       ));
   
       let make_array_udf_expr = Expr::ScalarFunction(ScalarFunction::new_udf(
           make_array_udf(),
           vec![col("column1")],
       ));
       let plan = LogicalPlanBuilder::values(vec![vec![v.clone()]])
           .unwrap()
           .project([make_array_udf_expr.alias("array")])
           .unwrap()
           .unnest_column("array")
           .unwrap()
           .build()
           .unwrap();
   
       let df = ctx.execute_logical_plan(plan).await.unwrap();
   }
   ```
   
   This works without any error


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] `make_array` -> `unnest` w/ dict-encoded strings fails [datafusion]

Posted by "duongcongtoai (via GitHub)" <gi...@apache.org>.
duongcongtoai commented on issue #6057:
URL: https://github.com/apache/datafusion/issues/6057#issuecomment-2626880570

   take


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] `make_array` -> `unnest` w/ dict-encoded strings fails [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #6057: `make_array` -> `unnest` w/ dict-encoded strings fails
URL: https://github.com/apache/datafusion/issues/6057


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] `make_array` -> `unnest` w/ dict-encoded strings fails [datafusion]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on issue #6057:
URL: https://github.com/apache/datafusion/issues/6057#issuecomment-2627012783

   Then I suggest we add a regression test and close this issue.


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org