Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,9 @@ class Analyzer(override val catalogManager: CatalogManager)
// ResolveOutputRelation runs, using the query's column names that will match the
// table names at that point. because resolution happens after a future rule, create
// an UnresolvedAttribute.
EqualNullSafe(UnresolvedAttribute(attr.name), Cast(Literal(value), attr.dataType))
EqualNullSafe(
UnresolvedAttribute.quoted(attr.name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Cast(Literal(value), attr.dataType))
case None =>
throw QueryCompilationErrors.unknownStaticPartitionColError(name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,15 @@ trait InsertIntoSQLOnlyTests
verifyTable(t1, spark.table(view))
}
}

test("SPARK-34599: InsertInto: overwrite - dot in the partition column name - static mode") {
import testImplicits._
val t1 = "tbl"
withTable(t1) {
sql(s"CREATE TABLE $t1 (`a.b` string, `c.d` string) USING $v2Format PARTITIONED BY (`a.b`)")
sql(s"INSERT OVERWRITE $t1 PARTITION (`a.b` = 'a') (`c.d`) VALUES('b')")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this bug only exist when the INSERT have a column list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this bug only exist when the INSERT have a column list?

No. It exists in queries without the column list as well. I made this test using the column list to ensure we don't have the similar issue there.

verifyTable(t1, Seq("a" -> "b").toDF("id", "data"))
}
}
}
}