MaxGekk commented on code in PR #41568:
URL: https://github.com/apache/spark/pull/41568#discussion_r1231227948
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalysisSuite.scala:
##########
@@ -1360,22 +1360,40 @@ class AnalysisSuite extends AnalysisTest with Matchers {
test("SPARK-41271: bind named parameters to literals") {
CTERelationDef.curId.set(0)
- val actual1 = ParameterizedQuery(
+ val actual1 = NameParameterizedQuery(
child = parsePlan("WITH a AS (SELECT 1 c) SELECT * FROM a LIMIT
:limitA"),
args = Map("limitA" -> Literal(10))).analyze
CTERelationDef.curId.set(0)
val expected1 = parsePlan("WITH a AS (SELECT 1 c) SELECT * FROM a LIMIT
10").analyze
comparePlans(actual1, expected1)
// Ignore unused arguments
CTERelationDef.curId.set(0)
- val actual2 = ParameterizedQuery(
+ val actual2 = NameParameterizedQuery(
child = parsePlan("WITH a AS (SELECT 1 c) SELECT c FROM a WHERE c <
:param2"),
args = Map("param1" -> Literal(10), "param2" -> Literal(20))).analyze
CTERelationDef.curId.set(0)
val expected2 = parsePlan("WITH a AS (SELECT 1 c) SELECT c FROM a WHERE c
< 20").analyze
comparePlans(actual2, expected2)
}
+ test("SPARK-44066: bind positional parameters to literals") {
+ CTERelationDef.curId.set(0)
+ val actual1 = PosParameterizedQuery(
+ child = parsePlan("WITH a AS (SELECT 1 c) SELECT * FROM a LIMIT ?"),
+ args = Seq(Literal(10))).analyze
+ CTERelationDef.curId.set(0)
+ val expected1 = parsePlan("WITH a AS (SELECT 1 c) SELECT * FROM a LIMIT
10").analyze
+ comparePlans(actual1, expected1)
+ // Ignore unused arguments
Review Comment:
> Error out when there are less number of arguments than positional
placeholders (?)
@entong Such test has been added already, see `test("non-substituted
positional parameters")` in `ParametersSuite`, please.
--
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]