Skip to content

Add registerSqlOperator() to BeamSqlEnv for custom SQL operators#39432

Open
damccorm wants to merge 1 commit into
masterfrom
backport-f53e1abe-register-sql-operator
Open

Add registerSqlOperator() to BeamSqlEnv for custom SQL operators#39432
damccorm wants to merge 1 commit into
masterfrom
backport-f53e1abe-register-sql-operator

Conversation

@damccorm

@damccorm damccorm commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a mutable, session-scoped ListSqlOperatorTable (extraOperatorTable) to JdbcConnection, chained at the front of the planner's operator table in CalciteQueryPlanner.defaultConfig. This allows registering custom SqlOperators (e.g. with VARIADIC operand checkers) that cannot be expressed through the schema-function auto-wrapping path (which always produces a fixed-parameter checker).

Changes

  • JdbcConnection.java: Added extraOperatorTable field (a mutable ListSqlOperatorTable) and getExtraOperatorTable() getter.
  • CalciteQueryPlanner.java: Chained connection.getExtraOperatorTable() at the front of the SqlOperatorTables.chain() call in defaultConfig().
  • BeamSqlEnv.java: Added registerSqlOperator() method that delegates to connection.getExtraOperatorTable().add().
  • BeamSqlEnvRegisterOperatorTest.java (new): Tests verifying operators are added to the table, the table starts empty, and registered operators are resolvable by name.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@damccorm
damccorm force-pushed the backport-f53e1abe-register-sql-operator branch 3 times, most recently from 6613513 to 4becd31 Compare July 22, 2026 15:16
Backports commit f53e1abe from dataflow/beam-spark.

Adds a mutable, session-scoped ListSqlOperatorTable (extraOperatorTable)
to JdbcConnection, chained at the front of the planner's operator table
in CalciteQueryPlanner.defaultConfig. This allows registering custom
SqlOperators (e.g. with VARIADIC operand checkers) that cannot be
expressed through the schema-function auto-wrapping path.

Adds BeamSqlEnvRegisterOperatorTest with tests verifying:
- Operators are added to the extra operator table
- Table starts empty on fresh env
- Registered operators are resolvable by name
@damccorm
damccorm force-pushed the backport-f53e1abe-register-sql-operator branch from 4becd31 to e5c1967 Compare July 22, 2026 16:06
@damccorm
damccorm marked this pull request as ready for review July 22, 2026 17:00
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@damccorm

Copy link
Copy Markdown
Contributor Author

R: @Abacn

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

* built are visible.
*/
private final org.apache.beam.vendor.calcite.v1_40_0.org.apache.calcite.sql.util
.ListSqlOperatorTable

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.

(formatting) import the names

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