You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "yihua (via GitHub)" <gi...@apache.org> on 2026/10/09 06:29:07 UTC
[PR] test(spark): run Spark SQL tests on a catalog that rejects the default database [hudi]
yihua opened a new pull request, #20248:
URL: https://github.com/apache/hudi/pull/20248
### Describe the issue this Pull Request addresses
issue: #20235, follow-up to #20240
#20240 fixed a qualified read failing on a session catalog that rejects the `default` database, a case no Spark SQL test could catch because the test session runs on an in-memory catalog where `default` always works. Any new code path that probes `default` would ship unnoticed again.
### Summary and Changelog
Every Spark SQL suite extending `HoodieSparkSqlTestBase` now runs on a test external catalog, `StrictDefaultDatabaseCatalog`, that throws `StrictDefaultDatabaseException` for any table, partition or function operation on `default` while database-level calls still work so the session can start. `StrictCatalogSharedState` installs it by overriding `SharedState.externalCatalog`; the test session is built reflectively because the `SparkSession` constructor that takes a `SharedState` is class-private (on Spark 4 it lives on `org.apache.spark.sql.classic.SparkSession` with a different arity, and both paths are exercised). The base creates a fixed non-default test database at the warehouse root and switches to it, so unqualified names and managed-table paths behave as before. Suites that hard-coded `default` in expected identifiers, SHOW output, `hoodie.database.name` dumps or new sessions now use the test database.
`TestStrictCatalogRead` writes a table through the datasource with no recorded database name, registers it under the test database, and reads it with a qualified SELECT from a session whose current database is `default`, for a plain table and a bucket-indexed one. With the pre-#20240 `HoodieFileIndex` the plain read fails with the strict exception from `HoodieFileIndex.getConfigProperties`; with it, all cases pass.
Verified locally: 20 suites on Spark 3.5 and the other 95 suites extending the base (621 cases), `TestStrictCatalogRead` and `TestCreateTable` on Spark 4.0, and `TestStrictCatalogRead` on Spark 4.1 and 4.2; all Spark 4 modules compile.
### Impact
Test infrastructure only. No production code changes.
### Risk Level
low. A suite that still assumes `default` fails loudly in CI with the strict exception rather than passing silently.
### Documentation Update
none
### Contributor's checklist
- [x] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Enough context is provided in the sections above
- [x] Adequate tests were added if applicable
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(spark): run Spark SQL tests on a catalog that rejects the default database [hudi]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20248:
URL: https://github.com/apache/hudi/pull/20248#issuecomment-6075871994
## [Codecov](https://app.codecov.io/gh/apache/hudi/pull/20248?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 72.88%. Comparing base ([`308f78e`](https://app.codecov.io/gh/apache/hudi/commit/308f78e71deabf7a9eec4b0a2ea26b1360658030?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`31e7bb5`](https://app.codecov.io/gh/apache/hudi/commit/31e7bb5059a0111112e66456fe26e6da656157a5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #20248 +/- ##
============================================
- Coverage 72.88% 72.88% -0.01%
+ Complexity 31792 31791 -1
============================================
Files 2552 2552
Lines 143400 143400
Branches 17454 17454
============================================
- Hits 104518 104516 -2
- Misses 31402 31403 +1
- Partials 7480 7481 +1
```
| [Components](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hudi-common](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.73% <ø> (ø)` | |
| [hudi-client](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.18% <ø> (-0.01%)` | :arrow_down: |
| [hudi-flink](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.96% <ø> (ø)` | |
| [hudi-spark-datasource](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `38.54% <ø> (ø)` | |
| [hudi-utilities](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.19% <ø> (ø)` | |
| [hudi-cli](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.80% <ø> (ø)` | |
| [hudi-hadoop](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.98% <ø> (ø)` | |
| [hudi-sync](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.16% <ø> (ø)` | |
| [hudi-io](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.91% <ø> (ø)` | |
| [hudi-timeline-service](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.53% <ø> (ø)` | |
| [hudi-cloud](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.00% <ø> (ø)` | |
| [hudi-kafka-connect](https://app.codecov.io/gh/apache/hudi/pull/20248/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.20% <ø> (ø)` | |
| [Flag](https://app.codecov.io/gh/apache/hudi/pull/20248/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hadoop-mr-java-client](https://app.codecov.io/gh/apache/hudi/pull/20248/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `43.95% <ø> (-0.03%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
[see 1 file with indirect coverage changes](https://app.codecov.io/gh/apache/hudi/pull/20248/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org