Skip to content

Commit bf43ee1

Browse files
Fix multipart resolution + test nits
1 parent 88cc8d6 commit bf43ee1

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Utils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private[sql] object DataSourceV2Utils extends Logging {
142142
DataSource.lookupDataSourceV2(nameParts.head, conf).flatMap {
143143
case sco: SupportsCatalogOptions =>
144144
val optionsWithPath = getOptionsWithPaths(
145-
CaseInsensitiveMap(Map.empty), nameParts.tail.mkString("."))
145+
CaseInsensitiveMap(Map.empty), nameParts.tail: _*)
146146
val dsOptions = buildDsOptions(sco, conf, optionsWithPath)
147147
Some(extractCatalogAndIdentifier(sco, dsOptions))
148148
case _ => None

sql/core/src/test/scala/org/apache/spark/sql/connector/PathBasedTableSuite.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class PathBasedTableSuite extends QueryTest with SharedSparkSession {
4848
}
4949

5050
override def afterEach(): Unit = {
51-
// SharedSparkSession reuses one SparkSession across tests. `reset()` drops registered
52-
// non-session catalogs (including pathformat_cat), so the next test starts with a
53-
// fresh InMemoryTableCatalog instance.
51+
// Start each test starts with a fresh InMemoryTableCatalog instance.
5452
spark.sessionState.catalogManager.reset()
5553
spark.conf.unset(s"spark.sql.catalog.${FakePathBasedSource.CATALOG_NAME}")
5654
super.afterEach()
@@ -113,7 +111,7 @@ class PathBasedTableSuite extends QueryTest with SharedSparkSession {
113111
}
114112
}
115113

116-
test("regression: v1 file format direct query still resolves") {
114+
test("v1 file format direct query still resolves") {
117115
withTempDir { dir =>
118116
val path = new java.io.File(dir, "p.parquet").getCanonicalPath
119117
Seq((1, "a"), (2, "b")).toDF("id", "data").write.parquet(path)
@@ -145,8 +143,7 @@ class PathBasedTableSuite extends QueryTest with SharedSparkSession {
145143
test("catalog precedence: same-named catalog wins over SCO data source") {
146144
// Register a catalog under the same name as the SCO data source short name. SQL
147145
// resolution should route to the catalog; the SCO resolver is consulted only when
148-
// no catalog claims the head, matching v1 file-format precedence (ResolveSQLOnFile)
149-
// and Delta's ResolveDeltaPathTable extension.
146+
// no catalog claims the head.
150147
withSQLConf("spark.sql.catalog.pathformat" -> classOf[InMemoryTableCatalog].getName) {
151148
sql(s"CREATE TABLE $tablePath (id INT, data STRING)")
152149
sql(s"INSERT INTO $tablePath VALUES (1, 'a')")

sql/core/src/test/scala/org/apache/spark/sql/connector/PathBasedTableTransactionSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class PathBasedTableTransactionSuite extends RowLevelOperationSuiteBase {
106106
assert(txn.currentState === Committed)
107107
assert(txn.isClosed)
108108
// The transaction must have gone through the SCO seam to pathformat_cat, not the
109-
// (also-transactional) session catalog. Without these checks the assertions above
110-
// would silently pass when the session catalog absorbs the write.
109+
// (also-transactional) session catalog.
111110
assert(pathformatCat.lastTransaction eq txn)
112111
assert(catalog.lastTransaction == null)
113112
checkAnswer(spark.table(tablePathWithFormat), Row(1, "a") :: Row(2, "b") :: Nil)

0 commit comments

Comments
 (0)