davisp commented on issue #8819:
URL: https://github.com/apache/datafusion/issues/8819#issuecomment-2515545725
@alamb @simonvandel Just an FYI, optimizing LogicalPlans works just fine as
long as the plan has types for all placeholders. It doesn't actually need the
values. For instance, the example at the bottom of this comment runs just fine.
However, depending on the particular query, you may still get the
"Placeholder type could not be resolved" error during planning. I've just
submitted #13632 to address that issue.
```rust
use datafusion::arrow::datatypes::DataType;
use datafusion::error::Result;
use datafusion::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let ctx = SessionContext::new();
let df = ctx
.read_empty()
.unwrap()
.with_column("a", lit(1))
.unwrap()
.filter(col("a").eq(cast(placeholder("$1"), DataType::Int32)))
.unwrap();
let plan = df.into_optimized_plan()?;
println!("Plan: {:#?}", plan);
Ok(())
}
```
--
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]