MaxGekk commented on a change in pull request #30919:
URL: https://github.com/apache/spark/pull/30919#discussion_r549976769
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
##########
@@ -140,19 +140,22 @@ private[sql] trait LookupCatalog extends Logging {
* For legacy support only. Please use [[CatalogAndIdentifier]] instead on
DSv2 code paths.
*/
object AsTableIdentifier {
- def unapply(parts: Seq[String]): Option[TableIdentifier] = parts match {
- case CatalogAndMultipartIdentifier(None, names)
+ def unapply(parts: Seq[String]): Option[TableIdentifier] = {
+ def namesToTableIdentifier(names: Seq[String]): Option[TableIdentifier]
= names match {
+ case Seq(name) => Some(TableIdentifier(name))
+ case Seq(database, name) => Some(TableIdentifier(name, Some(database)))
+ case _ => None
+ }
+ parts match {
+ case CatalogAndMultipartIdentifier(None, names)
if CatalogV2Util.isSessionCatalog(currentCatalog) =>
- names match {
- case Seq(name) =>
- Some(TableIdentifier(name))
- case Seq(database, name) =>
- Some(TableIdentifier(name, Some(database)))
- case _ =>
- None
- }
- case _ =>
- None
+ namesToTableIdentifier(names)
+ case CatalogAndMultipartIdentifier(Some(catalog), names)
+ if CatalogV2Util.isSessionCatalog(catalog) &&
+ CatalogV2Util.isSessionCatalog(currentCatalog) =>
Review comment:
`AsTableIdentifier` is used directly in public API methods:
-
https://github.com/apache/spark/blob/2da72593c1cf63fc6f815416b8d553f0a53f3e65/sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala#L495
-
https://github.com/apache/spark/blob/2da72593c1cf63fc6f815416b8d553f0a53f3e65/sql/core/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala#L625
If I remove the check, this could impact on their behavior.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]