Skip to content

Pom refactor - Add Spark 3.5 connector#152

Open
stevelordbq wants to merge 28 commits into
GoogleCloudDataproc:mainfrom
Bit-Quill:pom-refactor
Open

Pom refactor - Add Spark 3.5 connector#152
stevelordbq wants to merge 28 commits into
GoogleCloudDataproc:mainfrom
Bit-Quill:pom-refactor

Conversation

@stevelordbq

@stevelordbq stevelordbq commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Creates a separate build for each Spark version.
The approach was not chosen, however Jiang asked that we preserve this branch in case it is adopted later.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @stevelordbq, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the project's build system to improve modularity and facilitate multi-version Spark support. By introducing dedicated core and common Spark modules, it streamlines the process of adding new Spark connector versions. The primary outcome is the successful integration and support for Spark 3.5, complete with updated documentation and comprehensive test coverage.

Highlights

  • Spark 3.5 Connector Addition: Introduced a new connector specifically for Spark 3.5, expanding compatibility for the Spark Spanner connector.
  • Maven POM Refactoring: The project's Maven Project Object Model (POM) structure has been significantly refactored to support separate builds for each Spark version. This includes the introduction of a new root reactor POM.
  • Module Restructuring: Core, Spark-independent code has been moved into a new spanner-core module, and Spark-dependent but version-agnostic code has been moved into a spanner-spark-common module. This modularization simplifies maintenance and future Spark version upgrades.
  • Documentation Updates: The README.md file has been updated to reflect the new Spark 3.5 compatibility and include updated Dataproc image compatibility matrices.
  • Acceptance Test Enhancements: Acceptance tests have been updated and new test classes added across various Spark versions (3.1, 3.2, 3.3, 3.5) to align with the new module structure and ensure proper functionality for the newly added Spark 3.5 connector.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@stevelordbq stevelordbq reopened this Jan 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant refactoring of the project's build structure to support multiple Spark versions from a single codebase, including the addition of support for Spark 3.5. The changes introduce a modular approach with spanner-core, spanner-spark-common, and version-specific modules, which is a solid strategy. My review focuses on improving maintainability by reducing code duplication in both the build configuration and the source code, fixing some minor issues like wildcard imports and invalid SQL in test files, and suggesting best practices for logging and code formatting enforcement.

Comment thread spanner-spark-common/src/test/resources/db/populate_ddl.sql Outdated
Comment thread spark-3.1-spanner/pom.xml
Comment thread pom.xml
# Conflicts:
#	spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/Spark31SpannerTableProvider.java
@jiangzzhu

Copy link
Copy Markdown
Collaborator

/gcbrun

@jiangzzhu

Copy link
Copy Markdown
Collaborator

/gcbrun

@jiangzzhu jiangzzhu self-assigned this Jan 21, 2026
@jiangzzhu jiangzzhu removed their assignment Jan 21, 2026

@jiangzzhu jiangzzhu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment thread README.md
Comment thread spanner-spark-common/src/test/resources/acceptance/read_test_table.py Outdated
@jiangzzhu

Copy link
Copy Markdown
Collaborator

Could you also update https://github.com/GoogleCloudDataproc/spark-spanner-connector/blob/main/.github/workflows/dev-ci.yml to build 3.5 as well? thanks!

And also

$MVN install -DskipTests -P3.1,3.2,3.3

Comment thread README-template.md
Comment thread README-template.md
| spark-3.2-spanner | | | | &check; | &check; | &check; | &check; | | &check; | |
| spark-3.3-spanner | | | | &check; | &check; | &check; | &check; | | &check; | |
| spark-3.5-spanner | | | | | | &check; | | &check; | | &check; |
| Connector \ Dataproc Image | 1.3 | 1.4 | 1.5 | 2.0 | 2.1 | 2.2 | Serverless<br>Image 1.1 | Serverless<br>Image 1.2 | Serverless<br>Image 2.0 | Serverless<br>Image 2.1 | Serverless<br>Image 2.2 |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why does spark 3.1,3.2,3.3 not work with serverless 1.2 and 2.2?

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.

We haven't tested that those combinations work. So it may work.
https://docs.cloud.google.com/dataproc-serverless/docs/concepts/versions/spark-runtime-1.2

Did you want us to increase the cross version compatibility testing?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If adding the test is simple (by acceptance test), maybe we could add it, so we could check on those entries.
Or we could say it is supported but not tested, to avoid confusion that it is not supported. What do you think?

Comment thread README.md
@jiangzzhu

jiangzzhu commented Jan 22, 2026

Copy link
Copy Markdown
Collaborator

A few questions on the current PR.

  1. Before the PR, we can execute mvn clean install -P3.1,3.2,3.3 -DskipTests successfully. After the PR, we will encounter the following errors when executing the same cmd:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:testCompile (default-testCompile) on project spark-3.3-spanner-lib: Compilation failure
[ERROR] /usr/local/google/home/jiangzzhu/Projects/spark-spanner-connector/spark-3.3-spanner-lib/src/test/java/com/google/cloud/spark/spanner/SpannerDataWriter33IntegrationTest.java:[26,22] cannot find symbol
[ERROR] symbol: method apply(org.apache.spark.sql.types.StructType)
[ERROR] location: class org.apache.spark.sql.catalyst.encoders.RowEncoder

Could you fix this? Otherwise, the release process will fail. Thanks!

  1. When executing mvn install -P3.1,3.2,3.3,3.5,integration failsafe:integration-test, encounter the following errors:

[ERROR] WriteIntegrationTest.testEmptyDataFrameWrite:140 » SparkClassNotFound [DATA_SOURCE_NOT_FOUND] Failed to find the data source: cloud-spanner. Please find packages at [https://spark.apache.org/third-party-projects.html](https://spark.apache.org/third-party-projects.html%60).

Please also take a look at this. It also breaks the release process. Thanks!

  1. Please also verify if the following acceptance tests work or not. Thanks!
    mvn install -P3.1,3.2,3.3,3.5,acceptance failsafe:integration-test

@stevelordbq

Copy link
Copy Markdown
Contributor Author

A few questions on the current PR.

  1. Before the PR, we can execute mvn clean install -P3.1,3.2,3.3 -DskipTests successfully. After the PR, we will encounter the following errors when executing the same cmd:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:testCompile (default-testCompile) on project spark-3.3-spanner-lib: Compilation failure [ERROR] /usr/local/google/home/jiangzzhu/Projects/spark-spanner-connector/spark-3.3-spanner-lib/src/test/java/com/google/cloud/spark/spanner/SpannerDataWriter33IntegrationTest.java:[26,22] cannot find symbol [ERROR] symbol: method apply(org.apache.spark.sql.types.StructType) [ERROR] location: class org.apache.spark.sql.catalyst.encoders.RowEncoder

Could you fix this? Otherwise, the release process will fail. Thanks!

  1. When executing mvn install -P3.1,3.2,3.3,3.5,integration failsafe:integration-test, encounter the following errors:

[ERROR] WriteIntegrationTest.testEmptyDataFrameWrite:140 » SparkClassNotFound [DATA_SOURCE_NOT_FOUND] Failed to find the data source: cloud-spanner. Please find packages at [https://spark.apache.org/third-party-projects.html](https://spark.apache.org/third-party-projects.html%60).

Please also take a look at this. It also breaks the release process. Thanks!

  1. Please also verify if the following acceptance tests work or not. Thanks!
    mvn install -P3.1,3.2,3.3,3.5,acceptance failsafe:integration-test

Please note @jiangzzhu , now we have separate builds for each Spark version, it doesn't make sense to aggregate the profiles together, since that would use the Spark version set by the last profile, which would be Spark 3.3 or 3.5 in your examples above.

However, I will investigate this failure for a single Spark version.

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.

2 participants