Skip to content

bug(bigquery): Syntax error when applying an empty window spec #9872

Open
@chelsea-lin

Description

@chelsea-lin

What happened?

In the BigQuery backend, when an empty window spec is applied, the generated SQL contains a syntax error. This leads to query failures and prevents the expected computation.

Step to reproduce

  1. Code:
bq = ibis.bigquery.connect(project_id="bigframes-dev")
t = bq.table("ibis_gbq_testing.functional_alltypes")
ibis.to_sql(t.int_col.quantile(0.5).over(ibis.window()), dialect="bigquery")
  1. Generated SQL (with error)
SELECT
  PERCENTILE_CONT(`t0`.`int_col`, 0.5) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS `Quantile_int_col_0_5`
FROM `bigframes-dev`.`ibis_gbq_testing`.`functional_alltypes` AS `t0`
  1. Error Message:
    Window framing clause is not allowed for analytic function percentile_cont at [2:46]

Expected Behavior
The generated SQL could omit the window framing clause when an empty window spec is provided.

SELECT
  PERCENTILE_CONT(`t0`.`int_col`, 0.5) OVER () AS `Quantile_int_col_0_5`
FROM `bigframes-dev`.`ibis_gbq_testing`.`functional_alltypes` AS `t0`

What version of ibis are you using?

9.2.0

What backend(s) are you using, if any?

BigQuery

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bigqueryThe BigQuery backendbugIncorrect behavior inside of ibiswindow functionsIssues or PRs related to window functions

Type

No type

Projects

Status

backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions