This is an automated email from the ASF dual-hosted git repository.
maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new c106c7760ea6 [SPARK-49017][SQL][TESTS][FOLLOW-UP] Add testing for
CreateTableAs with parameters
c106c7760ea6 is described below
commit c106c7760ea672edc62c5f497bdf975646f3efdf
Author: Mihailo Milosevic <[email protected]>
AuthorDate: Tue Aug 27 13:52:12 2024 +0200
[SPARK-49017][SQL][TESTS][FOLLOW-UP] Add testing for CreateTableAs with
parameters
### What changes were proposed in this pull request?
Addition of a test for `CreateTableAsSelect`.
### Why are the changes needed?
While looking through parameter marker support in statements it was noticed
that CacheTableAsSelect actually should not work with parameter markers, but
returns UNBOUND_SQL_PARAMETER.
(https://issues.apache.org/jira/browse/SPARK-49398 ticket which should solve
this issue). Because of this, I suggest adding additional test for
`CreateTableAsSelect` to make sure all paths work as expected.
### Does this PR introduce _any_ user-facing change?
No, only tests added.
### How was this patch tested?
N/A
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #47886 from mihailom-db/follow-up-parameters.
Authored-by: Mihailo Milosevic <[email protected]>
Signed-off-by: Max Gekk <[email protected]>
---
.../scala/org/apache/spark/sql/ParametersSuite.scala | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala
index fcab4a758044..be3669cc6202 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala
@@ -682,6 +682,22 @@ class ParametersSuite extends QueryTest with
SharedSparkSession with PlanTest {
}
}
+ test("SPARK-49017: bind named parameters with IDENTIFIER clause in create
table as") {
+ withTable("testtab", "testtab1") {
+
+ sql("create table testtab (id int, name string)")
+ sql("insert into testtab values(1, 'test1')")
+
+ // create table with parameters in query
+ spark.sql(
+ """create table identifier(:tab) as
+ | select * from testtab where identifier(:col) == 1""".stripMargin,
+ Map("tab" -> "testtab1", "col" -> "id"))
+
+ checkAnswer(sql("select * from testtab1"), Seq(Row(1, "test1")))
+ }
+ }
+
test("SPARK-46999: bind parameters for nested IDENTIFIER clause") {
val query = sql(
"""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]