Skip to content

feat(bigquery): add typed handling for AI scalar functions#7479

Open
RedZapdos123 wants to merge 1 commit intotobymao:mainfrom
RedZapdos123:enhancement/bigquery-ai-scalar-typed-handling
Open

feat(bigquery): add typed handling for AI scalar functions#7479
RedZapdos123 wants to merge 1 commit intotobymao:mainfrom
RedZapdos123:enhancement/bigquery-ai-scalar-typed-handling

Conversation

@RedZapdos123
Copy link
Copy Markdown
Contributor

@RedZapdos123 RedZapdos123 commented Apr 9, 2026

Description:

  • add typed expression nodes for BigQuery AI scalar calls:
    • AI.EMBED -> AIEmbed
    • AI.SIMILARITY -> AISimilarity
    • AI.GENERATE -> AIGenerate
  • keep SQL output backward compatible through explicit SQL names (EMBED, SIMILARITY, GENERATE)
  • preserve generic behavior for unqualified scalar names; typed conversion is applied to dotted AI.* calls in BigQuery parser column-op handling
  • add BigQuery dialect tests asserting both identity round-trip and typed AST nodes

Closes #7478.

Validation:

  • python -m pytest -q tests/dialects/test_bigquery.py -k ml_functions -vv
  • python -m pytest -q tests/dialects/test_bigquery.py -vv
  • python -m pytest -q

Results:

  • focused BigQuery ml_functions: passed.
  • full BigQuery dialect module: passed (58 passed).
  • full suite: passed (1076 passed).

The validation screenshots of the tests run, locally on WSL:

image image image

Additionally, verified direct parses now produce typed function nodes under AI.* dot calls while preserving round-trip SQL.

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>
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.

Enhancement: richer typed handling for BigQuery AI.* scalar functions

2 participants