Skip to content

Conversation

@murali-db
Copy link
Owner

@murali-db murali-db commented Nov 4, 2025

Summary

This PR integrates server-side scan planning into DeltaCatalog, enabling Unity Catalog tables without credentials to use server-side planning as a fallback path.

Key Changes

DeltaCatalog Integration

  • Simplified loadTable() method: Reduced from ~50 lines of server-side planning logic to just 2 lines
  • Decision logic: Calls ServerSidePlannedTable.tryCreate() which returns Option[ServerSidePlannedTable]
  • Fallback pattern: Uses .getOrElse to fall back to normal table loading if server-side planning is not needed

ServerSidePlannedTable Factory Pattern

  • Moved creation logic to tryCreate(): Encapsulates all decision logic (credentials, config, catalog name extraction)
  • Extracted testable shouldUseServerSidePlanning() method: Pure boolean logic for easier testing without reflection
  • Moved credential checking: CREDENTIAL_PROPERTY_KEYS and hasCredentials() moved from DeltaCatalog to ServerSidePlannedTable

Package Organization

  • All server-side planning code lives in serverSidePlanning package
  • Zero server-side planning logic in the catalog package
  • ServerSidePlannedTable.scala is in serverSidePlanning/ (not catalog/)

Testing

ServerSidePlannedTableSuite Changes

The test suite originally had 2 tests:

  1. Low-level partition/reader verification test
  2. Read-only capability test

Removed: Test #1 (low-level partition/reader test) - redundant with query execution tests that exercise the same code paths

Added 4 new tests:

  1. Full query execution through DeltaCatalog with server-side planning enabled
  2. Verify normal table loading path when server-side planning is disabled
  3. loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config flag
  4. shouldUseServerSidePlanning() decision logic unit test (all boolean combinations)

Total: 5 tests covering the full integration flow and decision logic

Test Improvements

  • Use DeltaSQLConf.ENABLE_SERVER_SIDE_PLANNING.key instead of hardcoded strings
  • Extend DeltaSQLCommandTest for automatic catalog configuration
  • Use afterEach hook for guaranteed cleanup

@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 60e0179 to 1444a92 Compare November 4, 2025 20:49
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from 014a370 to f573ef2 Compare November 4, 2025 20:49
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 1444a92 to 1e80c9d Compare November 10, 2025 11:40
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from f573ef2 to 6a3c237 Compare November 10, 2025 11:40
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 1e80c9d to 5df2aa8 Compare November 10, 2025 11:47
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from 6a3c237 to 0b6edee Compare November 10, 2025 11:59
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from c640a93 to f6fce90 Compare November 10, 2025 17:36
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from 6f59e26 to 4897acd Compare November 10, 2025 17:37
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 9a8b2fb to 4d65c66 Compare November 10, 2025 21:07
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from 86ac031 to cd73d53 Compare November 10, 2025 21:11
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 4d65c66 to 7194465 Compare November 10, 2025 21:20
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from cd73d53 to bafd056 Compare November 10, 2025 21:20
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 7194465 to a026e83 Compare November 10, 2025 21:30
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch 2 times, most recently from 07a6bb8 to 563cb78 Compare November 11, 2025 11:50
murali-db added a commit that referenced this pull request Nov 11, 2025
Addresses code review issues #5, #7, #9, and #18:

1. Issue #7: Expand Hadoop configuration limitation documentation
   - Clarify production impact of using sessionState.newHadoopConf()
   - Provide concrete examples of what won't work
   - Document workaround for per-query credentials
   - Link to architectural decision about DeltaLog dependency

2. Issue #18: Document DeltaLog dependency avoidance
   - Add comprehensive class-level documentation for ServerSidePlannedTable
   - Explain format independence, lightweight design, and clean architecture
   - Document trade-offs and alternative approaches

3. Issue #9: Improve catalog name extraction documentation
   - Add detailed examples for all identifier formats
   - Explain edge cases (fully qualified vs database-only vs table-only)
   - Clarify why we check namespace().length > 1

4. Issue #5: Add TODO for hasCredentials() test coverage
   - Document what test would be helpful to add
   - Suggest implementation approaches (reflection vs custom catalog)
   - Note challenge of testing without real Unity Catalog

All tests pass. No functional changes, only documentation improvements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@murali-db murali-db force-pushed the server-side-planning-B-iceberg-impl branch from 684e30b to b6feb1a Compare November 11, 2025 18:16
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch from 5ab33c8 to 0f8d6c0 Compare November 12, 2025 03:39
@murali-db murali-db changed the title DeltaCatalog Integration + E2E Tests [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests Nov 12, 2025
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch 5 times, most recently from 4556da8 to a447b22 Compare November 12, 2025 13:11
@murali-db murali-db force-pushed the server-side-planning-C-catalog-integration branch 2 times, most recently from babf37b to aaf4021 Compare November 12, 2025 20:25
murali-db and others added 2 commits November 14, 2025 17:35
- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@murali-db murali-db requested a review from tdas November 14, 2025 17:50
@murali-db murali-db requested a review from tdas November 17, 2025 13:13
Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@murali-db murali-db requested a review from tdas November 17, 2025 22:23
@tdas
Copy link

tdas commented Nov 18, 2025

approved. merge it!

@murali-db murali-db merged commit 06ee526 into master Nov 18, 2025
40 of 42 checks passed
@murali-db
Copy link
Owner Author

40 of 42 checks passed: unrelated flaky test. Failing test is in DeltaTableBuilderSuite.scala with Spark Connect session management issue - unrelated to this PR. Confirmed that all tests relevant to PR9 are passing locally in master after merge.

murali-db added a commit that referenced this pull request Dec 3, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Dec 4, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Dec 10, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Dec 10, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Dec 10, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Dec 10, 2025
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
murali-db added a commit that referenced this pull request Jan 21, 2026
…able and add E2E tests (#9)

* [Server-Side Planning] Integrate DeltaCatalog with ServerSidePlannedTable and add E2E tests

Implements DeltaCatalog integration to use ServerSidePlannedTable when Unity Catalog
tables lack credentials, with comprehensive end-to-end testing and improvements.

Key changes:
- Add loadTable() logic in DeltaCatalog to detect UC tables without credentials
- Implement hasCredentials() to check for credential properties in table metadata
- Add ENABLE_SERVER_SIDE_PLANNING config flag for testing
- Add comprehensive integration tests with reflection-based credential testing
- Add Spark source code references for Identifier namespace structure
- Improve test suite by removing redundant aggregation test
- Revert verbose documentation comments in ServerSidePlannedTable

Test coverage:
- E2E: Full stack integration with DeltaCatalog
- E2E: Verify normal path unchanged when feature disabled
- loadTable() decision logic with ENABLE_SERVER_SIDE_PLANNING config
  (tests 3 scenarios including UC without credentials via reflection)

See Spark's LookupCatalog, CatalogAndIdentifier and ResolveSessionCatalog
for Identifier namespace structure references.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor PR9: Extract decision logic and improve test quality

Changes:
- Extracted shouldUseServerSidePlanning() method with boolean inputs
- Replaced reflection-based test with clean unit test
- Tests all input combinations without brittle reflection code
- Improved testability and maintainability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Clean up ServerSidePlannedTable: Remove unnecessary helper function

- Remove misleading "Fallback" comment that didn't apply to all cases
- Inline create() function into tryCreate() to reduce indirection
- Simplify logic: directly handle client creation in try-catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove unnecessary logging and unused imports from ServerSidePlannedTable

- Remove conditional logging that differentiated between forced and fallback paths
- Remove unused imports: MDC and DeltaLogKeys

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless AutoCloseable implementation from ServerSidePlannedTable

The close() method was never called because:
- Spark's Table interface has no lifecycle hooks
- No code explicitly called close() on ServerSidePlannedTable instances
- No try-with-resources or Using() blocks wrapped it

HTTP connection cleanup happens via connection timeouts (30s) and JVM
finalization, making AutoCloseable purely ceremonial dead code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify verbose test suite comments

Reduced 20+ line formatted comments to simple 2-line descriptions.
The bullet-pointed lists were over-documenting obvious test structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove useless forTesting() wrapper method

The forTesting() method was just a wrapper around 'new' that added no value.
Tests now directly instantiate ServerSidePlannedTable with the constructor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix brittle test assertion for table capabilities

Removed assertion that table has exactly 1 capability, which would break
if we add streaming support (MICRO_BATCH_READ, CONTINUOUS_READ) or other
non-write capabilities later.

Now tests what actually matters: supports BATCH_READ, does NOT support
BATCH_WRITE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove redundant SupportsWrite interface check in test

Testing !isInstanceOf[SupportsWrite] is redundant with checking
!capabilities.contains(BATCH_WRITE) because:
- BATCH_WRITE capability requires SupportsWrite interface
- Having SupportsWrite without BATCH_WRITE would violate Spark contract

The capability check tests the public API contract, which is sufficient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove e2e/integration terminology from ServerSidePlanningSuite

Changed:
- Test names: removed "E2E:" prefix
- Database name: integration_db → test_db
- Table name: e2e_test → planning_test

These tests use mock clients, not external systems, so e2e/integration
terminology was misleading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Merge test suites: keep existing ServerSidePlannedTableSuite, delete new ServerSidePlanningSuite

ServerSidePlanningSuite was added in this PR, while ServerSidePlannedTableSuite
existed before. Merged them by keeping the existing file and deleting the new one,
so the PR shows modification rather than deletion+addition.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Refactor tests and improve documentation

- Refactor ServerSidePlannedTableSuite: create database/table once in beforeAll()
- Use minimal early-return pattern in DeltaCatalog with oss-only markers
- Move current snapshot limitation docs to ServerSidePlanningClient interface
- Add UC credential injection link to hasCredentials() documentation
- Lowercase test names and remove redundant client verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Simplify current snapshot limitation documentation

Shorten documentation from 4 lines to 1 concise line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review feedback

Changes:
1. Remove unnecessary afterEach() cleanup - no resource leaks to prevent
2. Make test 2 explicit by setting config=false instead of relying on cleanup
3. Remove redundant test "loadTable() decision logic" - already covered by other tests
4. Add explanation for deltahadoopconfiguration scalastyle suppression

Tests: 4/4 passing, scalastyle clean

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Address PR9 review comments: improve test quality and cleanup

- Add withServerSidePlanningEnabled helper method to prevent test pollution
  - Encapsulates factory and config setup/teardown in one place
  - Guarantees cleanup in finally block
  - Prevents tests from interfering with each other

- Replace white-box capability check with black-box insert test
  - Test actual insert behavior instead of inspecting capabilities
  - Verifies inserts succeed without SSP, fail with SSP enabled
  - More realistic end-to-end test of read-only behavior

- Remove OSS-only marker comments from DeltaCatalog
  - Clean up // oss-only-start and // oss-only-end comments

- Remove unused import (DeltaCatalog)

All tests passing (4/4):
- full query through DeltaCatalog with server-side planning
- verify normal path unchanged when feature disabled
- shouldUseServerSidePlanning() decision logic
- ServerSidePlannedTable is read-only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants