Skip to content

Refactor(spark-3.5): Make OpenHouse SQL extensions standalone - #660

Draft
mkuchenbecker wants to merge 2 commits into
mainfrom
mkuchenb/spark35-sql-standalone
Draft

Refactor(spark-3.5): Make OpenHouse SQL extensions standalone #660
mkuchenbecker wants to merge 2 commits into
mainfrom
mkuchenb/spark35-sql-standalone

Conversation

@mkuchenbecker

@mkuchenbecker mkuchenbecker commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Gives the spark-3.5 module its own copy of the OpenHouse SQL-extension machinery so the grammar can evolve for spark-3.5.

Previously spark-3.5 took a dependency on the 3.1 code to avoid duplication. That coupling meant the SQL grammar could not change for spark-3.5 without also changing spark-3.1.

This change will mean that we will explicitly release grammer on each version.

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  1. Copy the grammar + 7 borrowed classes into spark-3.5.
  2. Add the ANTLR generation task (antlr4 4.7.1, matching spark-3.1) and point srcDirs
    at the module's own generated dir.
  3. Drop the spark-3.1 module dependency.

Testing Done

  • No behavior change — existing spark-3.5 statement tests pass unmodified against
    the standalone module.
./gradlew :integrations:spark:spark-3.5:openhouse-spark-3.5-itest:statementTest
# BUILD SUCCESSFUL — all pre-existing statement tests pass

Additional Information

No breaking changes; no client-facing changes.

…park-3.1)

spark-3.5 previously borrowed the ANTLR grammar (via spark-3.1's generated-src
srcDir) and several classes (OpenHouseCatalog, IcebergCatalogMapper,
OpenhouseSparkSessionExtensions, OpenhouseSqlExtensionsAstBuilder,
OpenhouseDataSourceV2Strategy, GrantableResourceTypes, Principal) from the
spark-3.1 shadow jar. This coupling meant the SQL grammar could not evolve for
spark-3.5 without also changing spark-3.1.

Give spark-3.5 its own copy of the grammar and these classes, add the ANTLR
generation task (antlr4 4.7.1, matching spark-3.1), and drop the spark-3.1
module dependency. No behavior change; runtime + itest compile against the
standalone module.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mkuchenbecker mkuchenbecker changed the title refactor(spark-3.5): Make OpenHouse SQL extensions standalone (decouple from spark-3.1) Refactor(spark-3.5): Make OpenHouse SQL extensions standalone Jul 24, 2026
Comment on lines -25 to +32
srcDirs += "${project(':integrations:spark:spark-3.1:openhouse-spark-runtime_2.12').buildDir}/generated-src/antlr/main"
srcDirs antlrMainGeneratedSrcDir

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is directly compiling rather than using the 3.1 generation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — that's intentional. The Spark 3.5 module now owns and runs ANTLR over its own src/main/antlr/.../OpenhouseSqlExtensions.g4, with sourceSets.main.java.srcDirs pointing at its own build/generated-src/antlr/main and compileJava.dependsOn runAntlr. Reusing the Spark 3.1 generated sources would keep Spark 3.5 coupled to the 3.1 module's build output/task ordering and would prevent the 3.5 grammar from diverging for 3.5-specific SQL extensions. This keeps the runtime self-contained while preserving the same generated parser package/shape.

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