[DRAFT] [SPARK-53573][SQL] IDENTIFIER everywhere #52765
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
We propose expanding the IDENTIFIER() clause which turns a string into a qualified identifier to all places identifeers can appear. The current clause is severely limited in where it can go because it accepts constant expressions, including session variables.
Due to that the existing clause reuqires tricky code to incrementally analyze its argumnets and then execute sectiosn of parser code at a later point.
By contrast the generalized IDENTIFIER clause only allows string literals which van be processed in the visitor methods.
Due to teh reowrk of paramermarkers and string coalescing thsi allows for constructs such as:
it even allows:
This is really all identifier() needs. We may be able to deprecate and de-support the existing too complex identifier() implementation.
Why are the changes needed?
IDENTIFIER() is a popular feature, but it can only be used in very specific, hard to reason about places.
The new implementation preserved 99% of teh fucntion while expanding its use to everywhere.
Does this PR introduce any user-facing change?
Yes, it's a new feature
How was this patch tested?
expanded Parameters and idnetifier-clause testsuites.
Was this patch authored or co-authored using generative AI tooling?
Yes, Clause Sonnet 4.5