Skip to content

Conversation

@pirzada-ahmadfaraz
Copy link

PR Description to use:

Summary

This PR adds documentation and examples for using calcite_connection_properties in YAML SQL transforms, addressing issue #36614.

Changes:

  • Added new example file sql/sql_calcite_connection_properties.yaml demonstrating how to configure PostgreSQL-specific SQL functions in YAML pipelines
  • Added test case in tests/sql.yaml to verify the calcite_connection_properties option works correctly with PostgreSQL functions like INITCAP

Example Usage:

pipeline:
  transforms:
    - type: Create
      name: CreateSampleData
      config:
        elements:
          - {id: 1, tags: "java python go"}
    - type: Sql
      name: TransformWithPostgresFunction
      input: CreateSampleData
      config:
        query: "SELECT id, STRING_TO_ARRAY(tags, ' ') as tag_list FROM PCOLLECTION"

options:
  calcite_connection_properties: {"fun": "postgresql"}

Fixes #36614

Test plan

- Added test case in tests/sql.yaml that uses INITCAP function with calcite_connection_properties
- Verified YAML syntax is valid for both example and test files
- CI tests will verify the functionality

**Files changed:**
- `sdks/python/apache_beam/yaml/examples/transforms/sql/sql_calcite_connection_properties.yaml` (new)
- `sdks/python/apache_beam/yaml/tests/sql.yaml` (modified - added test case)

This PR adds documentation and examples for using calcite_connection_properties
in YAML SQL transforms. This enables users to use dialect-specific SQL functions
such as PostgreSQL's INITCAP and STRING_TO_ARRAY functions.

Changes:
- Add new example file: sql/sql_calcite_connection_properties.yaml showing
  how to configure PostgreSQL functions in YAML SQL queries
- Add test case in tests/sql.yaml to verify calcite_connection_properties
  works with PostgreSQL functions

Fixes apache#36614
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pirzada-ahmadfaraz, 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 enhances Apache Beam's YAML SQL capabilities by introducing support for calcite_connection_properties. This allows users to specify a SQL dialect, such as PostgreSQL, enabling the use of its native functions directly within YAML-defined SQL transforms. The change includes both a new example demonstrating this functionality and a corresponding test case to ensure its correct operation, thereby expanding the flexibility and power of YAML-based data processing.

Highlights

  • New Example for Calcite Connection Properties: A new example file, sql/sql_calcite_connection_properties.yaml, has been added to demonstrate how to configure PostgreSQL-specific SQL functions (like STRING_TO_ARRAY) within YAML pipelines using calcite_connection_properties.
  • Test Case for PostgreSQL Functions: A new test case has been added to tests/sql.yaml to verify that the calcite_connection_properties option correctly enables PostgreSQL functions, specifically INITCAP, within SQL transforms.
  • Issue Resolution: This pull request addresses and fixes issue [Feature Request]: Add yaml sql example using calcite_connection_properties, and document this in the transform catalog #36614, which likely pertains to the need for dialect-specific SQL function support in YAML pipelines.

🧠 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.

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@derrickaw
Copy link
Collaborator

Run Python_ML PreCommit 3.12

@github-actions
Copy link
Contributor

Assigning reviewers:

R: @shunping for label python.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants