amaliujia commented on code in PR #47723:
URL: https://github.com/apache/spark/pull/47723#discussion_r1717673341
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala:
##########
@@ -3627,6 +3629,39 @@ class DataSourceV2SQLSuiteV1Filter
}
}
+ def checkParquet(tableName: String, path: String): Unit = {
+ withTable(tableName) {
+ sql("CREATE TABLE " + tableName +
+ " (name STRING) USING PARQUET LOCATION '" + path + "'")
+ sql("INSERT INTO " + tableName + " VALUES('Bob')")
+ val df = sql("SELECT * FROM " + tableName)
+ assert(df.queryExecution.analyzed.exists {
+ case LogicalRelation(_: HadoopFsRelation, _, _, _) => true
+ case _ => false
+ })
+ checkAnswer(df, Row("Bob"))
+ }
+ }
+
+ test("SPARK-49211: V2 Catalog can support built-in data sources") {
+ // Reset CatalogManager to clear the materialized `spark_catalog`
instance, so that we can
+ // configure a new implementation.
+ spark.sessionState.catalogManager.reset()
+ withSQLConf(
+ V2_SESSION_CATALOG_IMPLEMENTATION.key ->
classOf[V2CatalogSupportBuiltinDataSource].getName) {
+ withTempPath { path =>
+ checkParquet("spark_catalog.default.t", path.getAbsolutePath)
+ }
+ }
+
spark.sessionState.catalogManager.v1SessionCatalog.invalidateAllCachedTables()
Review Comment:
oops. Forget to remove.
##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala:
##########
@@ -199,8 +201,12 @@ private[hive] class HiveMetastoreCatalog(sparkSession:
SparkSession) extends Log
fileType: String,
isWrite: Boolean): LogicalRelation = {
val metastoreSchema = relation.tableMeta.schema
- val tableIdentifier =
- QualifiedTableName(relation.tableMeta.database,
relation.tableMeta.identifier.table)
+ // scalastyle:off caselocale
+ val catalog = relation.tableMeta.identifier.catalog.getOrElse(
+ CatalogManager.SESSION_CATALOG_NAME).toLowerCase
Review Comment:
ack
--
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]