Repository navigation
fix(wren): bigquery and duckdb LIMIT wrap breaks on SQL ending in a trailing comment - #2734
Conversation
…railing comment Canner#2728 fixed this for postgres. bigquery.py's _apply_limit and duckdb.py's query()/dry_run() wrap the caller's SQL the same way, on one line, so a trailing SQL line comment eats the closing paren, alias and LIMIT clause. Put the wrap on its own line, same technique as postgres.py/athena.py. Regression test per connector with a trailing-comment SQL string, fails on the unmodified wrap and passes with it multiline.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughBigQuery and DuckDB now use multiline SQL wrappers for limited queries and dry runs. Tests cover trailing line comments, semicolons, literals, and nested limits. ChangesSQL limit wrappers
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to BigQuery and DuckDB limited-query wrappers now safely preserve trailing SQL line comments while retaining existing semicolon and limit behavior. The affected paths have focused regression coverage, with no remaining merge-readiness risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the change, affected connectors, tests, and reported results. However, it does not provide the required reproduction with the actual error output, and it does not explicitly identify which open PRs were checked for duplicates.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit wraps each query line Comment |
… in a trailing comment Canner#2733 is the fast-follow to Canner#2728 (postgres) and Canner#2734 (bigquery/duckdb): oracle.py's query()/dry_run(), redshift.py's query()/dry_run() and trino.py's query()/dry_run() all wrap the caller's SQL on one line, so a trailing SQL line comment eats the closing paren, alias/ROWNUM clause and LIMIT clause. Put the wrap on its own line, same technique as postgres.py. Regression test per connector with a trailing-comment SQL string, fails on the unmodified wrap and passes with it multiline. Scope limited to these three connectors; canner.py/clickhouse.py/databricks.py/datafusion.py are left for a separate PR since open drafts Canner#2551/Canner#2552 already touch those wrap lines for an unrelated parameter-binding change. Signed-off-by: Amir Fathi <[email protected]>
|
Glad it landed. The trailing-comment case was the kind of thing that only shows up once someone's SQL happens to end that way. |
Refs #2733. Only bigquery.py and duckdb.py here, so this doesn't close it: see the scope note below.
bigquery.py's
_apply_limitand duckdb.py'squery()/dry_run()wrap on one line too, so a trailing SQL line comment eats the closing paren, alias and LIMIT clause the same way postgres.py did before #2728. Wrapped both onto their own line, matching the postgres.py/athena.py shape.bigquery.py's
dry_run()never wraps (no LIMIT there), so it needed no change.Scoped to these two connectors: they cover both cases you verified live in the issue (DuckDB and BigQuery). canner.py, clickhouse.py, databricks.py, oracle.py, redshift.py and trino.py have the same shape and are a natural fast-follow, left out here to keep the diff small.
Added a regression test per call site with a trailing-comment SQL string; each fails on the unmodified wrap and passes with it multiline. Ran
tests/unit/(1450 passed, 2 skipped) andruff format/ruff checkonsrc/, all clean.Summary by CodeRabbit
Bug Fixes
LIMITclauses are processed correctly.Tests