gemini-code-assist[bot] commented on PR #37611:
URL: https://github.com/apache/beam/pull/37611#issuecomment-3905175781

   ## Summary of Changes
   
   Hello @BentsiLeviav, I'm Gemini Code Assist[^1]! 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 modernizes the ClickHouseIO connector by 
upgrading its underlying driver from the legacy JDBC driver to the ClickHouse 
Java Client V2. This migration aims to improve the overall performance, 
compatibility, and maintainability of ClickHouse interactions within Apache 
Beam. The changes include a new, more explicit API for writing data and 
retrieving table schemas, while carefully preserving backward compatibility for 
existing pipelines through deprecated methods and a dedicated JDBC URL parser.
   
   ### Highlights
   
   * **Core Driver Upgrade**: Migrated ClickHouseIO from the legacy JDBC driver 
(v0.6.3) to the modern ClickHouse Java Client v2 (v0.9.6), enhancing 
performance, compatibility, and maintainability.
   * **API Modernization**: Replaced JDBC-specific components (Connection, 
Statement, ResultSet) with the new Java Client v2 APIs (Client, Records, 
GenericRecord) for all internal operations.
   * **New Write Method**: Introduced a new write(String clickHouseUrl, String 
database, String table) method for explicit connection parameters, aligning 
with the new client's approach.
   * **Backward Compatibility**: Deprecated the old write(String jdbcUrl, 
String table) method and added ClickHouseJdbcUrlParser to automatically parse 
legacy JDBC URLs, ensuring existing pipelines continue to function without 
breaking changes.
   * **Enhanced Property Handling**: Updated withProperties() to support 
intelligent merging of connection properties, allowing new properties to 
override existing ones.
   * **Updated Schema Retrieval**: The getTableSchema method was refactored to 
use the new Java Client v2, with a deprecated overload provided for backward 
compatibility with JDBC URLs.
   
   🧠 **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](https://codeassist.google/code-review/login) to enable Memory in your 
admin console.**
   
   <details>
   <summary><b>Changelog</b></summary>
   
   * **sdks/java/io/clickhouse/build.gradle**
       * Updated the ClickHouse dependency version from JDBC 0.6.4 to Java 
Client V2 0.9.6.
       * Replaced the primary implementation dependency from 'clickhouse-jdbc' 
to 'client-v2'.
       * Added 'clickhouse-jdbc' as a test-only dependency to support backward 
compatibility tests.
   * 
**sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java**
       * Replaced JDBC-related imports with ClickHouse Java Client V2 API 
imports.
       * Updated Javadoc for the write method to recommend the new signature 
and mark the old one as deprecated.
       * Updated documentation links for deduplication to point to the current 
ClickHouse website.
       * Introduced a new public static write method that accepts explicit 
ClickHouse URL, database, and table parameters.
       * Modified the deprecated write method to parse JDBC URLs using 
ClickHouseJdbcUrlParser and delegate to the new write method.
       * Updated the Write PTransform to use 'clickHouseUrl' and 'database' 
fields instead of 'jdbcUrl'.
       * Adjusted the expand method to call the new getTableSchema signature.
       * Updated the WriteFn builder to reflect the new connection parameters.
       * Added a withProperties method to the Write PTransform for merging 
connection properties.
       * Replaced the internal ClickHouseConnection field in WriteFn with the 
new Client from Java Client V2.
       * Refactored the WriteFn.setup() method to initialize the ClickHouse 
Java Client V2 with proper authentication and options.
       * Updated the WriteFn.tearDown() method to close the new ClickHouse 
Client.
       * Rewrote the WriteFn.flush() method to use the ClickHouse Java Client 
V2's insert API for writing data in RowBinary format.
       * Deprecated the old getTableSchema(String jdbcUrl, String table) method 
and implemented a new getTableSchema(String clickHouseUrl, String database, 
String table, Properties properties) using the new client API.
   * 
**sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseJdbcUrlParser.java**
       * Added a new utility class, ClickHouseJdbcUrlParser, to parse legacy 
JDBC URLs into ClickHouse URL, database, and properties.
       * Introduced an inner class, ParsedJdbcUrl, to encapsulate the parsed 
components of a JDBC URL.
       * Implemented methods to extract and normalize HTTP/HTTPS URLs, database 
names, and query parameters from various JDBC URL formats.
   * 
**sdks/java/io/clickhouse/src/test/java/org/apache/beam/sdk/io/clickhouse/AtomicInsertTest.java**
       * Updated test methods to use the new ClickHouseIO.write signature with 
explicit URL, database, and table.
       * Modified method signatures to throw generic Exception instead of 
SQLException, aligning with the new client's API.
   * 
**sdks/java/io/clickhouse/src/test/java/org/apache/beam/sdk/io/clickhouse/BaseClickHouseTest.java**
       * Added static fields for clickHouseUrl and database to be used by tests.
       * Updated the setup method to initialize clickHouseUrl and database from 
the test container.
       * Modified the setUp method to initialize the new ClickHouse Client 
instead of a JDBC Connection.
       * Updated the after method to close the new ClickHouse Client.
       * Refactored executeSql, executeQuery, and executeQueryAsLong methods to 
interact with the new ClickHouse Client API.
       * Added new helper methods executeQueryAsString and isServerAlive for 
client-based interactions.
   * 
**sdks/java/io/clickhouse/src/test/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIOJdbcBackwardCompatibilityTest.java**
       * Added a new test class to verify the backward compatibility of the 
deprecated JDBC URL-based write method.
       * Included tests for basic JDBC URL parsing, parameter extraction, 
default setting preservation, and equivalence with the new write method.
   * 
**sdks/java/io/clickhouse/src/test/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIOPropertyMergingTest.java**
       * Added a new test class to validate the property merging logic within 
the withProperties() method.
       * Tests cover property extraction from JDBC URLs, overriding existing 
properties, preserving properties, handling multiple withProperties calls, and 
precedence rules.
   * 
**sdks/java/io/clickhouse/src/test/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIOTest.java**
       * Updated various test methods (testTupleType, testComplexTupleType, 
testPrimitiveTypes, testArrayOfPrimitiveTypes) to use the new Records and 
GenericRecord API for result assertions.
       * Modified the internal write helper method to utilize the new 
ClickHouseIO.write signature with explicit properties.
   </details>
   
   <details>
   <summary><b>Activity</b></summary>
   
   * BentsiLeviav created the pull request to upgrade ClickHouseIO to use 
ClickHouse Java Client V2.
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation 
page](https://developers.google.com/gemini-code-assist/docs/review-github-code),
 here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   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.
   
   <b>Customization</b>
   
   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](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances 
where its feedback is incorrect or counter productive. You can react with 
:thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   <b>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](https://cloud.google.com/products/gemini/code-assist).</b>
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), 
[Generative AI Prohibited Use 
Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of 
Service](https://policies.google.com/terms), and learn how to configure Gemini 
Code Assist in GitHub 
[here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
 Gemini can make mistakes, so double check it and [use code with 
caution](https://support.google.com/legal/answer/13505487).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to