question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sqlglot fails to parse bigquery partition expression with function call

See original GitHub issue

example query:

with table as (
  select 1.1 as x
  union all
  select 1.2
  union all
  select 2.3
)
select x, row_number() over (partition by bqutil.fn.int(x))
from table
image

sqlglot error: error formatting query: ParseError('Expecting ). Line 8, Col: 48.\n \n union all\n select 1.2\n union all\n select 2.3\n)\nselect x, row_number() over (partition by f.int\x1b[4m(\x1b[0mx))\nfrom table\n\n\n\nInvalid expression / Unexpected token. Line 8, Col: 51.\n union all\n select 1.2\n union all\n select 2.3\n)\nselect x, row_number() over (partition by f.int(x)\x1b[4m)\x1b[0m\nfrom table\n\n')

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tobymaocommented, Sep 30, 2022

just pushed it out

1reaction
tobymaocommented, Sep 30, 2022

3e93a22 isn’t deployed yet

Read more comments on GitHub >

github_iconTop Results From Across the Web

sqlglot/parser.py at main - GitHub
from sqlglot.errors import ErrorLevel, ParseError, concat_messages, ... Array(expressions=values), ... bigquery allows function calls like x.y.count(...).
Read more >
Query partitioned tables | BigQuery - Google Cloud
Isolate the partition column when expressing a filter. Filters that require data from multiple fields to compute will not prune partitions.
Read more >
Partitioning by expressions of type FLOAT64 is not allowed at ...
Usually this is a mistake, and partitioning only by CMS_ID should be fine. CAST(REVENUE as STRING). Share. Share a link to this answer....
Read more >
Release Notes - Ibis Project
api: bring back null datatype parsing (fc131a1); api: compute the type from both ... duckdb: remove timezone function invocation (33d38fc) ...
Read more >
How to Use Partitions and Clusters in BigQuery Using SQL
Essentially, we will not need to read through each record in a table but read ... When you partition a table and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found