maomaodev commented on PR #7718:
URL: https://github.com/apache/kyuubi/pull/7718#issuecomment-7036372149

   Thanks for another round of careful review — both regression catches were 
spot on. All items are addressed; point-by-point:
   
   **1. [Major, regression] Case-sensitive pattern matching with a custom 
session catalog**
   
   Done. For `spark_catalog`, schema and table patterns now compile with 
`Pattern.CASE_INSENSITIVE` (`compilePattern` in SparkCatalogUtils), so within 
one request the custom session catalog's filters agree with the v1 view probe. 
The non-session branch keeps case-sensitive matching, unchanged, consistent 
with DSv2 catalogs' case-sensitive identifiers. Covered by a unit test 
(`getSchemas matches session catalog patterns case-insensitively` in 
SparkCatalogUtilsSuite) and an e2e assertion in IcebergMetadataTests querying 
with an uppercase schema pattern (`getTables(cg, "DB_TYPE", "TABLE%", null)`), 
which runs against the HMS-backed session catalog in both the server and engine 
topologies.
   
   **2. [Major, regression] Per-table loadTable just for REMARKS**
   
   Done as prescribed. With ignoreTableProperties=false (default), 
`getCustomSessionCatalogTablesOrViews` now, per namespace: partitions 
identifiers so only single-level namespaces can be v1-backed; makes one batched 
`sessionCatalog.getTablesByName` call that returns both the VIEW type and the 
comment; the `databaseExists + listViews` probe is `lazy` and only evaluated on 
the fallback path; per-table loads remain only for DSv2-only identifiers and 
for namespaces where the batch throws (the #7673 case). The join is 
case-insensitive on both sides to survive identifier case drift between the 
catalog and the metastore. I verified the failure sub-path empirically: with a 
DSv2-only test table the batched call throws `NoSuchDatabaseException` from 
`requireDbExists` (confirmed with a temporary log probe), and the table is 
still returned via the per-table fallback. Unit coverage: "getTables falls back 
to per-table loading when the batched v1 lookup fails" in 
SummariesCatalogUtilsSuite; real-c
 atalog coverage via IcebergMetadataTests under HMS, including the comment 
passthrough — a table created with `COMMENT` comes back with REMARKS set under 
ignoreTableProperties=false.
   
   **3. [Major, perf] Use listTableSummaries for ignoreTableProperties=true — 
deviation on the detection check**
   
   Done for both TableCatalog branches, with one deviation I'd like your input 
on. If you see anything improper with the current approach, I'm happy to switch 
back.
   
   **Why not the Java declaring-class check** — it has two false negatives:
   
   - `JDBCTableCatalog` directly implements `TableCatalog` with a real 
implementation yet gets classified as "not implemented";
   - subclasses inheriting a real implementation (e.g. a catalog extending 
`JDBCTableCatalog` to add auth or config) are misclassified the same way.
   
   **The Scala-reflection probe** — scalac emits forwarders to interface 
defaults only as bytecode, never in the Scala symbol table, so `Type#member` 
resolves to the `TableCatalog` symbol exactly when the default is relied upon: 
`member.owner != the TableCatalog symbol` ⇔ the catalog has its own 
implementation. Verified across Scala/Java catalogs × {default, forwarder, 
direct, indirect, inherited real, inherited forwarder}: 12/12 correct, vs 10/12 
for the Java check. `scala-reflect` is already a provided dependency of this 
module, and the comment on `implementsListTableSummaries` documents the 
mechanism.
   
   A practical side benefit: because the probe correctly detects 
`JDBCTableCatalog`, Spark's native catalog can serve as the test vehicle. A 
custom test catalog overriding `listTableSummaries` would otherwise need 
separate sources per Spark generation: on 3.5 and 4.0 the `TableSummary` type 
does not exist, and the `override` modifier required on 4.1+ is a compile error 
on lower versions.
   
   **The rest is as prescribed:**
   
   - VIEW and METRIC_VIEW map to VIEW, anything else (e.g. FOREIGN) to TABLE; 
JDBCTableCatalog reports FOREIGN for every table, so the TABLE rows in the 
tests exercise the FOREIGN mapping.
   - Summaries are filtered by tableTypes with empty REMARKS, falling back to 
per-namespace `listTables` on failure.
   - The TODO about view types is kept: the summaries path now reports real 
types when ignoreTableProperties is set, but the full-properties path still 
requires per-table loads, where `Table` does not expose view identity until 
ViewCatalog matures.
   - Coverage: this repo pins Iceberg 1.11.0, whose SparkCatalog does not 
implement listTableSummaries (1.12.0 does, as the review notes), so the fast 
path is tested with `JDBCTableCatalog` backed by an embedded Derby that arrives 
transitively via the spark-hive test dependency; tests pass on Spark 3.5 (Scala 
2.12) and 4.0/4.1/4.2 (Scala 2.13).
   
   **4. [Minor] LinkageError from Try**
   
   Done. The `attempt` helper catches `LinkageError` in addition to `NonFatal` 
and wraps both the batched lookup and every per-table `loadComment`, so a 
missing SerDe/handler dependency degrades REMARKS instead of failing the whole 
GetTables.
   
   **5. [Minor] getTempViews labels temp views with the wrong catalog**
   
   Done. Temp view rows are now labeled `SESSION_CATALOG` regardless of the 
requested or current catalog, matching getColumns, with a comment explaining 
that this keeps the rows resolvable. Covered by a regression test in 
IcebergMetadataTests that lists global temp views with 
`spark.sql.defaultCatalog=hadoop_prod` and asserts `TABLE_CAT=spark_catalog`.
   
   **6. [Test] Duplicated extraConfigs / undeclared HMS dependency**
   
   Done. The HMS overrides moved into `HMSIcebergSuiteMixin`, built on 
`super.extraConfigs`, requiring `WithSimpleHMSContainer` via a self-type; 
`IcebergMetadataTests` now declares `self: HMSIcebergSuiteMixin =>`, so the HMS 
requirement is compile-checked. Both operation suites are thin shells mixing 
the mixin with their harness.
   
   **7. [Minor] STARTUP_TIMEOUT equals the testcontainers default**
   
   Done — bumped to 3 minutes in WithSimpleHMSContainer.
   
   **8. [Nit] Cosmetic banner/scaladoc changes**
   
   Banners are now consistent across all four sections, and the two scaladoc 
rewordings are reverted to master's wording.
   


-- 
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]

Reply via email to