Jefffrey commented on code in PR #19378:
URL: https://github.com/apache/datafusion/pull/19378#discussion_r2648105969
##########
datafusion/expr/src/arguments.rs:
##########
@@ -120,19 +126,35 @@ fn reorder_named_arguments(
let mut result: Vec<Option<Expr>> = vec![None; expected_arg_count];
for (i, (arg, arg_name)) in args.into_iter().zip(arg_names).enumerate() {
- if let Some(name) = arg_name {
- // Named argument - O(1) lookup in HashMap
- let param_index =
- param_index_map.get(name.as_str()).copied().ok_or_else(|| {
+ if let Some(arg_name) = arg_name {
+ // Named argument - find parameter index using linear search
+ // Match based on SQL identifier rules:
+ // - Quoted identifiers: case-sensitive (exact match)
+ // - Unquoted identifiers: case-insensitive match
+ let param_index = param_names
+ .iter()
+ .position(|p| {
+ if arg_name.is_quoted {
+ // Quoted: exact case match
+ p == &arg_name.value
+ } else {
+ // Unquoted: case-insensitive match
+ p.eq_ignore_ascii_case(&arg_name.value)
+ }
Review Comment:
Thoughts on using a hashmap approach, but with two hashmaps (one with
original case, one normalized to lowercase)?
Or its not worth the tradeoff 🤔
--
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]