[test](catalog) Add unit tests for SHOW TABLES name listing on external catalogs - #1
Conversation
…al catalogs Cover the SHOW TABLES fast path added in apache#66080: - plain SHOW TABLES on an external catalog lists names via getTableNamesWithLock() and never initializes table objects - LIKE pattern and SHOW privilege filters still apply on the fast path - name-listing failures (case-insensitive name conflicts) propagate instead of being swallowed into an empty result - SHOW FULL TABLES / SHOW VIEWS / internal catalog keep iterating table objects (temporary tables still hidden)
|
Note on the two red checks — both are fork-side CI infrastructure issues, unrelated to this change (which adds a single Java test file):
Neither check processes Java files, and the real CI gate runs on apache#66080 after merge. Safe to merge despite the red X's here. |
|
Thanks for the tests, @u70b3 — the failure-propagation case in particular is a good catch. One thing before we merge: I'd like to keep this aligned with the Google Java Style Guide on test-class naming:
Both this new ShowTableCommandExternalTest and the existing ShowTableCommandTest cover the same single class, ShowTableCommand — so per the guide the "external" cases should live in ShowTableCommandTest rather than in a separate class. Splitting one class's tests across ShowTableCommandTest already added fast-path coverage in cad2f74, so most of the 7 cases here overlap with what's there:
The two that add genuinely new coverage are:
Could you fold just those two cases into ShowTableCommandTest (reusing its existing ShowTableCommandMocks helper) and drop the new class? That keeps one test file per class and avoids the duplicate cases. |
…dTest Address review feedback: keep one test class per tested class (Google Java Style) and reuse the existing ShowTableCommandMocks helper instead of a separate ShowTableCommandExternalTest. The listsNamesOnly, privilege-filter, SHOW FULL TABLES, SHOW VIEWS and internal-catalog cases duplicate the call-count coverage added in cad2f74 and are dropped. Retained new coverage: - LIKE pattern filter applies on the names-only fast path and getTables() is never called - name-listing failures (case-insensitive name conflicts) raised by getTableNamesWithLock() propagate instead of being swallowed into an empty result Verified: mvn -pl fe-core -am test -Dtest=ShowTableCommandTest, 8/8 pass.
52dc351
into
Baymine:improvement/show-tables-external-perf
|
@Baymine Done — folded the LIKE-pattern and name-conflict propagation cases into |
Hi @Baymine — as mentioned in apache#66080, here are unit tests for the SHOW TABLES fast path, adapted to your implementation (
getTableNamesWithLock()and theInternalCatalogcheck).7 cases:
SHOW TABLESon an external catalog lists names only — verifiesgetTables()is never calledSHOW FULL TABLES/SHOW VIEWS/ internal catalog keep thegetTables()path (temporary tables still hidden)Verified:
mvn -pl fe-core -am test -Dtest=ShowTableCommandExternalTest→ 7/7 pass; fe-core checkstyle clean.If you merge this into your branch, the tests become part of apache#66080. Happy to adjust anything.