You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SPARK-54343][DOCS] Docs for parameter markers, identifier improvements, string coalescing
### What changes were proposed in this pull request?
* We document named an unnamed parameters and how to use them
* We document the ability to coalesce string literals though chaing
* We document the extended usage of teh IDENTIFIER clause
### Why are the changes needed?
Sync the docs with the code.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Building of the docs and reviewing the pages
### Was this patch authored or co-authored using generative AI tooling?
No
Closes#53047 from srielau/param-rework-docs.
Authored-by: Serge Rielau <serge@rielau.com>
Signed-off-by: Daniel Tenedorio <daniel.tenedorio@databricks.com>
Copy file name to clipboardExpand all lines: docs/sql-ref-identifier-clause.md
+45-20Lines changed: 45 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,26 +23,54 @@ license: |
23
23
24
24
Converts a constant `STRING` expression into a SQL object name.
25
25
The purpose of this clause is to allow for templating of identifiers in SQL statements without opening up the risk of SQL injection attacks.
26
-
Typically, this clause is used with a parameter marker or a variable as argument.
26
+
27
+
The clause comes in two forms:
28
+
29
+
- When passed a string-literal, which may include a coalesced string of literals and parameter markers, it can be used anywhere an identifier or qualified identifier can be used.
30
+
The usage of this form is encouraged.
31
+
- When passed a more complex constant string expression, which may also include variables, it can be used in limited cases to reference dynamic SQL object references such as table names, column names, and function names.
32
+
The usage of this form is discouraged unless necessary.
33
+
For example you cannot use this form to parameterize a table or column alias, or a column name in a `CREATE TABLE` statement.
27
34
28
35
### Syntax
29
36
30
37
```sql
38
+
IDENTIFIER ( strLiteral )
39
+
31
40
IDENTIFIER ( strExpr )
32
41
```
33
42
34
43
### Parameters
35
44
36
-
-**strExpr**: A constant `STRING` expression. Typically, the expression includes a parameter marker.
45
+
-**strLiteral**
37
46
38
-
### Returns
47
+
A constant `STRING` literal which may include string coalescing of strings and string parameter markers.
48
+
49
+
The string must be a valid (qualified) identifier.
0 commit comments