Skip to content

Conversation

@yuanoOo
Copy link
Collaborator

@yuanoOo yuanoOo commented Dec 22, 2025

Summary

Spark SQL cache relies on stable table identity. When OceanBaseCatalog.loadTable() creates new OceanBaseConfig instances each time, Spark's cache manager incorrectly invalidates cached query results if the config uses default reference equality.

Changes:

  • Add equals() and hashCode() to OceanBaseConfig comparing stable identity fields (URL, username, schema, table) while avoiding sensitive fields like password
  • Add regression test testCacheTableDoesNotChangeAfterExternalInsert to verify cached table results remain stable after external data changes

This fixes the issue where "CACHE TABLE xxx AS SELECT ..." would be unexpectedly refreshed when the underlying OceanBase table data changes externally.

Resolves customer requirement for stable cache behavior in Spark 3.4.

Solution Description

…nvalidation

Spark SQL cache relies on stable table identity. When OceanBaseCatalog.loadTable()
creates new OceanBaseConfig instances each time, Spark's cache manager incorrectly
invalidates cached query results if the config uses default reference equality.

Changes:
- Add equals() and hashCode() to OceanBaseConfig comparing stable identity fields
  (URL, username, schema, table) while avoiding sensitive fields like password
- Add regression test testCacheTableDoesNotChangeAfterExternalInsert to verify
  cached table results remain stable after external data changes

This fixes the issue where "CACHE TABLE xxx AS SELECT ..." would be unexpectedly
refreshed when the underlying OceanBase table data changes externally.

Resolves customer requirement for stable cache behavior in Spark 3.4.
Changes:
- Added entries for Scala/Metals related files and directories
- Included LocalTest.scala and set-test-env.sh to ignore list

This improves the development environment by preventing unnecessary files from being tracked.
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.

1 participant