Skip to content

Conversation

@yalimu-g
Copy link
Contributor

@yalimu-g yalimu-g commented Dec 1, 2025

Add test window function to ReadByFormatIntegrationTestBase

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yalimu-g, 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 introduces a new integration test to the BigQuery Spark connector's test suite. The primary goal is to confirm that Spark SQL's window functions, particularly those involving partitionBy, work correctly when processing data sourced from BigQuery. This enhancement helps ensure the robustness and reliability of data transformations performed using the connector.

Highlights

  • New Integration Test: An integration test testWindowFunctionPartitionBy has been added to ReadByFormatIntegrationTestBase to validate the correct behavior of Spark SQL window functions when reading data via the BigQuery connector.
  • Window Function Validation: The new test specifically verifies the partitionBy clause of a window function, ensuring that row_number() operates as expected across partitioned data.
  • Public Dataset Usage: The test utilizes a public BigQuery dataset (bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_20210131) to provide a realistic testing environment for the window function.
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.

Copy link
Contributor

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

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 adds an integration test for using a window function on a DataFrame read from BigQuery. The implementation is mostly correct, but the window specification can be improved for readability and to ensure the test is deterministic. I've suggested using column names directly in partitionBy and ordering by a specific column instead of a literal to make the test more robust.

@yalimu-g
Copy link
Contributor Author

yalimu-g commented Dec 1, 2025

/gcbrun

@yalimu-g
Copy link
Contributor Author

/gcbrun

@yalimu-g
Copy link
Contributor Author

/gcbrun

}

@Test
public void testWindowFunctionPartitionBy_withAVRO() {
Copy link
Member

Choose a reason for hiding this comment

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

The readDataFormat is controlled by the dataFormat variable, this method is redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, all the tests called this provided with "ARROW" format. This function is to answer the Issue 's question and prove that the "AVRO" format works with overriding the dataFormat in this case. Please let me know if you think we should remove or refactor.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this should be controlled by Parameterized tests (https://github.com/junit-team/junit4/wiki/parameterized-tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the parameterized tests in Spark35ReadByFormatIntegrationTest.

@yalimu-g
Copy link
Contributor Author

/gcbrun

@yalimu-g
Copy link
Contributor Author

yalimu-g commented Jan 5, 2026

/gcbrun

@yalimu-g yalimu-g merged commit 6bd76a5 into GoogleCloudDataproc:master Jan 6, 2026
6 checks passed
@yalimu-g yalimu-g deleted the integration-test branch January 6, 2026 17:51
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