cloud-fan commented on code in PR #47723:
URL: https://github.com/apache/spark/pull/47723#discussion_r1717912807
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala:
##########
@@ -3627,6 +3629,54 @@ 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.
+ val table1 = FullQualifiedTableName(SESSION_CATALOG_NAME, "default", "t")
+ spark.sessionState.catalogManager.reset()
+ withSQLConf(
+ V2_SESSION_CATALOG_IMPLEMENTATION.key ->
+ classOf[V2CatalogSupportBuiltinDataSource].getName) {
+ withTempPath { path =>
+ checkParquet(table1.toString, path.getAbsolutePath)
+ }
+ }
+ val table2 = FullQualifiedTableName("testcat3", "default", "t")
+ withSQLConf(
+ "spark.sql.catalog.testcat3" ->
classOf[V2CatalogSupportBuiltinDataSource].getName) {
+ withTempPath { path =>
+ checkParquet(table2.toString, path.getAbsolutePath)
+ }
+ }
+ }
+
+ test("SPARK-49211: V2 Catalog support CTAS") {
+ val table2 = FullQualifiedTableName("testcat3", "default", "t")
+ withSQLConf(
+ "spark.sql.catalog.testcat3" ->
classOf[V2CatalogSupportBuiltinDataSource].getName) {
Review Comment:
can we also test custom `spark_catalog`?
--
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]