imback82 commented on a change in pull request #34861:
URL: https://github.com/apache/spark/pull/34861#discussion_r766361842
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTableCatalog.scala
##########
@@ -209,8 +209,7 @@ class InMemoryTableCatalog extends
BasicInMemoryTableCatalog with SupportsNamesp
override def alterNamespace(
namespace: Array[String],
changes: NamespaceChange*): Unit = {
- val metadata = loadNamespaceMetadata(namespace).asScala.toMap
- namespaces.put(namespace.toList,
CatalogV2Util.applyNamespaceChanges(metadata, changes))
+ namespaces.put(namespace.toList,
CatalogV2Util.applyNamespaceChanges(changes))
Review comment:
@cloud-fan, Spark comes with two other v2 catalog implementations:
`JDBCTableCatalog` and `V2SessionCatalog` (I am ignoring
`DelegatingCatalogExtension`).
- For `JDBCTableCatalog`, `loadNamespaceMetadata` always returns empty map,
so this is not a concern.
- `V2SessionCatalog`'s `alterNamespace` is adding the existing properties:
https://github.com/apache/spark/blob/b7796e61ea98e1527f193751e3b4c2e9f201d313/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala#L276-L278
In theory, I could remove `val metadata =
catalog.getDatabaseMetadata(db).toMetadata` above, but this requires some
changes in `V2SessionCatalogSuite` since we need to pass existing properties to
`alterNamespace`. For example:
https://github.com/apache/spark/blob/b7796e61ea98e1527f193751e3b4c2e9f201d313/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalogSuite.scala#L1003
Leaving the implementation as it is doesn't hurt, but I wanted to get your
opinion on changing the catalog implementation itself as well.
--
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]