MaxGekk commented on code in PR #47501:
URL: https://github.com/apache/spark/pull/47501#discussion_r1721456600
##########
sql/core/src/test/scala/org/apache/spark/sql/ParametersSuite.scala:
##########
@@ -625,6 +625,63 @@ 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
Review Comment:
nit: The `WORKS` word is not informative. Please, remove it.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -453,12 +467,12 @@ class AstBuilder extends DataTypeAstBuilder
case table: InsertIntoTableContext =>
val (relationCtx, options, cols, partition, ifPartitionNotExists,
byName)
= visitInsertIntoTable(table)
- withIdentClause(relationCtx, ident => {
+ withIdentClause(relationCtx, Seq(query), (ident, otherPlans) => {
val insertIntoStatement = InsertIntoStatement(
createUnresolvedRelation(relationCtx, ident, options),
partition,
cols,
- query,
+ otherPlans.head,
Review Comment:
Are you sure that everywhere you call `.head`, it won't fail with
`NoSuchElementException`. Could you clarify your assumption, 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]