Asura7969 opened a new pull request, #8384:
URL: https://github.com/apache/arrow-datafusion/pull/8384
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #8245.
## Rationale for this change
it might be clearer to use named parameters
## What changes are included in this PR?
* change the `with_param_values` API
* add `ParamValues` struct
* add test case
## Are these changes tested?
`test_named_query_parameters`
## Are there any user-facing changes?
Add named query,like:
```rust
let dataframe = ctx
.sql("SELECT c1, c2 FROM test WHERE c1 > $coo AND c1 < $foo")
.await?;
// to logical plan without parameters
let param_values = vec![
("foo".to_string(), ScalarValue::UInt32(Some(3))),
("coo".to_string(), ScalarValue::UInt32(Some(0))),
];
let param_values: HashMap<_, _> = param_values.into_iter().collect();
let dataframe = dataframe.with_param_values(param_values.into())?;
let results = dataframe.collect().await?;
```
--
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]