amitvijapur opened a new pull request, #21395: URL: https://github.com/apache/datafusion/pull/21395
## Which issue does this PR close? - Closes #14436 (partial — covers duplicate CTE name diagnostic) ## Rationale for this change This PR follows the pattern established in PR #15209 to attach `Diagnostic` metadata to SQL planning errors. Specifically, it adds span-based diagnostics to the "duplicate CTE name" error so that users get precise source locations when a CTE name is reused. ## What changes are included in this PR? - Modified `datafusion/sql/src/cte.rs` to attach a `Diagnostic` with a span pointing to the duplicate CTE name when a `SchemaError::DuplicateQualifiedField` is raised. - Added a test in `datafusion/sql/tests/cases/diagnostic.rs` verifying the diagnostic is correctly attached. ## Are these changes tested? Yes — a new test case is added in `diagnostic.rs` that parses a query with a duplicate CTE name and asserts the resulting error carries the expected `Diagnostic`. ## Are there any user-facing changes? No breaking changes. Users will now see richer error diagnostics (with source spans) when they accidentally reuse a CTE name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
