Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe Snowflake connector now cleans SQL, pushes query limits into execution, lazily imports the driver, and conditionally wraps Snowflake programming errors. Focused unit tests cover query, dry-run, and helper behavior. ChangesSnowflake SQL execution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant QueryCaller
participant SnowflakeConnector
participant SnowflakeCursor
QueryCaller->>SnowflakeConnector: query SQL with optional limit
SnowflakeConnector->>SnowflakeCursor: execute cleaned SQL with LIMIT
SnowflakeCursor-->>SnowflakeConnector: fetch Arrow result
SnowflakeConnector-->>QueryCaller: return Arrow table
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/wren/src/wren/connector/snowflake.py`:
- Around line 25-32: Update _apply_limit to avoid generating duplicate top-level
row limits: detect an existing top-level LIMIT or FETCH clause before appending,
and preserve the original SQL when one is present; otherwise append the
requested LIMIT after stripping the trailing semicolon. Handle nested subqueries
safely so only the outer query’s limit is considered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f3c1507b-4feb-4551-a3cc-1cdab0d1a586
📒 Files selected for processing (2)
core/wren/src/wren/connector/snowflake.pycore/wren/tests/unit/test_snowflake_limit.py
Avoid generating `... LIMIT 10\nLIMIT 5` when SQL already ends with LIMIT/FETCH (CodeRabbit review on Canner#2466).
|
Addressed CodeRabbit: |
Avoid generating `... LIMIT 10\nLIMIT 5` when SQL already ends with LIMIT/FETCH (CodeRabbit review on Canner#2466).
28fd360 to
42fb2a8
Compare
|
The shared CI failure here ( |
Avoid client-only Arrow slicing for previews; append LIMIT after cleaning a terminal semicolon and strip for describe() dry-run.
Avoid generating `... LIMIT 10\nLIMIT 5` when SQL already ends with LIMIT/FETCH (CodeRabbit review on Canner#2466).
42fb2a8 to
a94b240
Compare
|
Done — rebased onto latest |
|
Superseded by merged #2456 (multiline subquery wrap + trailing-semicolon strip already on main). This branch no longer rebases cleanly and the append-LIMIT approach conflicts with what landed. Closing as superseded. |
Summary
query(..., limit=N)now appendsLIMIT Nafter stripping a trailing semicolon instead of only slicing the Arrow table client-side.dry_run/describealso strip trailing;.Motivation
Client-side
arrow_table.slice(0, limit)still schedules and materializes a full warehouse result stage for previews. Arrangements already used for Athena/MySQL (append LIMIT) and postgres-family subquery wraps keep the work for previews on the engine. Same helper strips a pure terminal semicolon so describe/execute do not trip multi-statement quirks.Verification
core/wren/.venv/bin/python -m pytest tests/unit/test_snowflake_limit.py -q— 4 passedquery("SELECT 1;", limit=2)executesSELECT 1\nLIMIT 2; dry_run describesSELECT 1License
core/wren/**only (Apache-2.0).Summary by CodeRabbit
Bug Fixes
Tests