Skip to content

[SPARK-41271][SQL] Support parameterized SQL queries by sql() #38864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 43 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6b42040
Add UnboundParameter
MaxGekk Nov 18, 2022
fe3ca7a
Add a test
MaxGekk Nov 18, 2022
ab3c615
Merge remote-tracking branch 'origin/master' into parameterized-sql
MaxGekk Nov 18, 2022
3cfef61
Merge remote-tracking branch 'origin/master' into parameterized-sql
MaxGekk Nov 19, 2022
c264476
Refactoring + add more parsing tests
MaxGekk Nov 21, 2022
17b9ea3
Merge remote-tracking branch 'origin/master' into parameterized-sql
MaxGekk Nov 21, 2022
0f32b75
NamedParameter should be bound
MaxGekk Nov 22, 2022
2806334
Add new method bind() to Dataset
MaxGekk Nov 23, 2022
d16e85b
Return back Literal and fix for scala 2.13
MaxGekk Nov 23, 2022
e48e2e1
Add the BindParameters rule
MaxGekk Nov 24, 2022
16b9a27
Merge remote-tracking branch 'origin/master' into parameterized-sql
MaxGekk Nov 26, 2022
693cd92
Add an end-to-end test
MaxGekk Nov 28, 2022
4e55269
Add a config to control the feature
MaxGekk Nov 30, 2022
4d1198f
Merge remote-tracking branch 'origin/master' into parameterized-sql
MaxGekk Dec 1, 2022
fcdf5f2
Support parametrized SQL queries by sql()
MaxGekk Dec 1, 2022
10c7680
Just strip any marker
MaxGekk Dec 1, 2022
cddff4a
Refactoring
MaxGekk Dec 1, 2022
a0f568a
Remove the Bind node
MaxGekk Dec 1, 2022
2e93bec
Add the error class NON_FOLDABLE_SQL_ARG
MaxGekk Dec 2, 2022
cf03c3b
Improve comments
MaxGekk Dec 2, 2022
0605f22
Add unboundError()
MaxGekk Dec 2, 2022
210d23c
Remove the BIND tag
MaxGekk Dec 2, 2022
16966c9
Fix UNBOUND_PARAMETER
MaxGekk Dec 2, 2022
b8a6fd9
Add Java-specific method
MaxGekk Dec 3, 2022
89c5371
Add tests for double quotes
MaxGekk Dec 6, 2022
e883aad
Add one more test for a foldable expr - cast
MaxGekk Dec 6, 2022
d05526c
Convert the internal error to an user-facing one
MaxGekk Dec 6, 2022
ce19640
Add a test for ignored args
MaxGekk Dec 7, 2022
5a1f33d
Allow literals only.
MaxGekk Dec 7, 2022
43fd1b9
Fix the order of error classes in error-classes.json
MaxGekk Dec 7, 2022
5ad46f8
Switch the parameter marker from @ to :
MaxGekk Dec 8, 2022
637778c
Fix parsing error
MaxGekk Dec 8, 2022
d2ce096
Use COLON
MaxGekk Dec 8, 2022
d3ac69c
a literal value -> a SQL literal statement
MaxGekk Dec 8, 2022
08e6dfa
Address comments related to error classes
MaxGekk Dec 8, 2022
27927fb
Add ParametersSuite
MaxGekk Dec 9, 2022
c390260
Address Wenchen's review comments
MaxGekk Dec 9, 2022
81cb619
Use identifier() to get parameter name
MaxGekk Dec 12, 2022
4b7cb23
Extend Unevaluable
MaxGekk Dec 12, 2022
0a3e500
Throw an internal error for dataType() and nullable()
MaxGekk Dec 12, 2022
15e2b27
Remove the SQL config
MaxGekk Dec 12, 2022
165a21d
Remove a test from JavaSparkSessionSuite.java
MaxGekk Dec 12, 2022
2857350
Update sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expr…
MaxGekk Dec 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use identifier() to get parameter name
  • Loading branch information
MaxGekk committed Dec 12, 2022
commit 81cb619184cf6a2269237b09d4dc3f93594ca532
Original file line number Diff line number Diff line change
@@ -4842,8 +4842,6 @@ class AstBuilder extends SqlBaseParserBaseVisitor[AnyRef] with SQLConfHelper wit
* Create a named parameter which represents a literal with a non-bound value and unknown type.
* */
override def visitParameterLiteral(ctx: ParameterLiteralContext): Expression = withOrigin(ctx) {
val name = ctx.getText
assert(name.length > 1)
Parameter(name.substring(1))
Parameter(ctx.identifier().getText)
}
}