Skip to content

test(sql-parser): pin TimescaleDB hyperfunctions parse on postgresql (#32028)#40142

Merged
rusackas merged 1 commit into
masterfrom
tdd/issue-32028-timescaledb-hyperfunctions
May 20, 2026
Merged

test(sql-parser): pin TimescaleDB hyperfunctions parse on postgresql (#32028)#40142
rusackas merged 1 commit into
masterfrom
tdd/issue-32028-timescaledb-hyperfunctions

Conversation

@rusackas
Copy link
Copy Markdown
Member

SUMMARY

This is a test-only PR opened as a TDD-style validation of issue #32028.

#32028 (filed 2025-01) reports that dashboards built on a TimescaleDB-extended Postgres database fail with `sqlglot.errors.ParseError: The number of provided arguments (2) is greater than the maximum number of supported arguments (1)` for queries using TimescaleDB hyperfunctions like `last(value, time)`, `first(value, time)`, or `time_bucket(...)`. SQL Lab works because it bypasses the parser; the dashboard path goes through `SQLScript` and trips the strict arity check.

This PR adds a parameterized regression test on `SQLScript` covering three representative TimescaleDB hyperfunctions:

  • `last(value, time_col)`
  • `first(value, time_col)`
  • `time_bucket('1 hour', time_col)`

How to interpret CI

  • CI green → the sqlglot version Superset is pinned to now tolerates these hyperfunctions; merging closes [4.1.1] Timescaledb hyperfunctions not correctly parsed #32028 and locks in the regression guard so a future sqlglot bump that re-tightens arity checks fails CI immediately.
  • CI red → bug is still live for at least one of the three signatures. Likely fix: register a Postgres-dialect overlay in `superset/sql/parse.py` that whitelists these (and similar) TimescaleDB hyperfunctions, or pin sqlglot to a version that tolerates them.

TESTING INSTRUCTIONS

```bash
pytest tests/unit_tests/sql/parse_tests.py::test_postgres_parses_timescaledb_hyperfunctions -v
```

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

Closes #32028

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 15, 2026

Code Review Agent Run #83bfbb

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 8d3c549..8d3c549
    • tests/unit_tests/sql/parse_tests.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.17%. Comparing base (2b71d96) to head (8d3c549).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #40142   +/-   ##
=======================================
  Coverage   64.17%   64.17%           
=======================================
  Files        2590     2590           
  Lines      138087   138087           
  Branches    32039    32039           
=======================================
  Hits        88615    88615           
  Misses      47947    47947           
  Partials     1525     1525           
Flag Coverage Δ
hive 39.47% <ø> (ø)
mysql 59.17% <ø> (ø)
postgres 59.25% <ø> (ø)
presto 41.16% <ø> (ø)
python 60.69% <ø> (ø)
sqlite 58.89% <ø> (ø)
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rusackas rusackas merged commit b5ad4a7 into master May 20, 2026
66 of 67 checks passed
@rusackas rusackas deleted the tdd/issue-32028-timescaledb-hyperfunctions branch May 20, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[4.1.1] Timescaledb hyperfunctions not correctly parsed

3 participants