Commit a95c7fc
authored
feat: fix matching for named parameters with non-lowercase signatures (#19378)
# Relates to:
#17379
## Rationale for this change
Named parameter matching failed when function signatures used
non-lowercase parameter names (e.g., `startTime`, `SYMBOL`). The SQL
parser normalizes unquoted argument names to lowercase, but signature
parameter names were not normalized during lookup, causing mismatches.
Example that failed before this fix:
```sql
-- Function signature: ["startTime", "endTime"]
SELECT func(starttime => 0); -- ERROR: Unknown parameter 'starttime'
```
## What changes are included in this PR?
**Commit 1: Support case-insensitive named parameters**
- Modified `resolve_function_arguments` to normalize signature parameter
names during lookup
- Fixes matching for signatures with camelCase or uppercase parameter
names
- Added unit test `test_case_insensitive_parameter_matching`
**Commit 2: Require case-sensitive matching for quoted identifiers**
- Added `ArgumentName` struct to preserve quote information from SQL
parser
- Implements SQL standard: quoted identifiers require exact case match
- Unquoted identifiers remain case-insensitive
- Added unit test `test_quoted_parameter_case_sensitive`
## Are these changes tested?
Yes:
- Unit tests verify case-insensitive matching for unquoted identifiers
- Unit tests verify case-sensitive matching for quoted identifiers
- Tests include mixed-case signature parameters (`["prefix", "startPos",
"LENGTH"]`)
- Existing sqllogictests validate end-to-end behavior
## Are there any user-facing changes?
Yes - this is a bug fix and enhancement:
- **Bug fix:** Functions with non-lowercase parameter names now work
correctly with any-case unquoted arguments
- **Enhancement:** Quoted identifiers now follow SQL standards
(case-sensitive matching)
- No breaking changes for existing queries1 parent 10db6b3 commit a95c7fc
File tree
3 files changed
+435
-38
lines changed- datafusion
- expr/src
- sqllogictest/test_files
- sql/src/expr
3 files changed
+435
-38
lines changed
0 commit comments