albertlockett commented on PR #22647: URL: https://github.com/apache/datafusion/pull/22647#issuecomment-4608211434
> I don't understand what this PR is fixing in that case, considering you've linked to some existing SLTs which call these functions with dictionary arrays? @Jefffrey I linked the SLT's because you asked about adding them in this comment https://github.com/apache/datafusion/pull/22647#pullrequestreview-4399742071 ... What this issue is fixing is: if these Scalar UDFs are invoked directly using an expression, they will return an error if the argument is a dictionary ```rust let schema = Arc::new(Schema::new(vec![ Field::new("a", DataType::Utf8, false), Field::new( "b", DataType::Dictionary(Box::new(DataType::UInt8), Box::new(DataType::Utf8)), false, ), ])); let rb = RecordBatch::try_new( schema.clone(), vec![ Arc::new(StringArray::from_iter_values(["a", "aa", "b"])), Arc::new(DictionaryArray::new( UInt8Array::from_iter_values([0, 1, 0]), Arc::new(StringArray::from_iter_values(["a", "B"])), )), ], ) .unwrap(); let physical_expr = create_physical_expr( &lower(col("b")), &DFSchema::try_from(schema).unwrap(), &ctx.state().execution_props(), ) .unwrap(); let expr_result = physical_expr.evaluate(&rb).unwrap(); // does not succeed println!("{:?}", expr_result); ``` (see full example [here](https://github.com/apache/datafusion/pull/22647#issuecomment-4606772028)) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
