mihailom-db commented on code in PR #47501: URL: https://github.com/apache/spark/pull/47501#discussion_r1703740899
########## sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala: ########## @@ -624,6 +624,67 @@ class ParametersSuite extends QueryTest with SharedSparkSession with PlanTest { comparePlans(expected, parameterizedSql) } + test("SPARK-49017: bind named parameters with IDENTIFIER clause") { + withTable("testtab") { + // Create table + spark.sql("create table testtab (id int, name string)") + + // Insert into table using single param - WORKS + spark.sql("insert into identifier(:tab) values(1, 'test1')", Map("tab" -> "testtab")) + + // Select from table using param - WORKS + checkAnswer(spark.sql("select * from identifier(:tab)", Map("tab" -> "testtab")), + Seq(Row(1, "test1"))) + + // Insert into table using multiple params - WORKS + spark.sql("insert into identifier(:tab) values(2, :name)", + Map("tab" -> "testtab", "name" -> "test2")) + + // Select from table using param - WORKS + checkAnswer(spark.sql("select * from identifier(:tab)", Map("tab" -> "testtab")), Review Comment: Yeah, it is not necessary to do parameters here. Will change it to normal select, as the aim of this query was to check contents of the table after previous addition. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org