update counts api to include group by clauses#1601
update counts api to include group by clauses#1601nikhilsinhaparseable merged 2 commits intoparseablehq:mainfrom
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds dynamic GROUP BY support to count query SQL generation by deriving quoted identifiers from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/query/mod.rs (1)
696-705: Reduce SQL template duplication between conditional branches.Only the
WHEREfragment differs; duplicating fullSELECT/GROUP BY/ORDER BYstrings in both branches increases drift risk for future edits.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/query/mod.rs` around lines 696 - 705, The two branches in building `query` duplicate the full SELECT/GROUP BY/ORDER BY template; extract the common template and insert an optional WHERE fragment: call `get_filter_string(conditions)` when `count_conditions.conditions` is Some to produce `f` and set `where_clause` to `format!(" WHERE {}", f)` (or empty string when None), then build `query` once using `{date_bin}{group_clause}`, `"{table_name}"`, `{end_time_col_name}`, and `{start_time_col_name}` while interpolating `where_clause`; update uses of `count_conditions`, `get_filter_string`, `date_bin`, `group_clause`, `table_name`, `end_time_col_name`, and `start_time_col_name` accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/query/mod.rs`:
- Around line 696-705: The two branches in building `query` duplicate the full
SELECT/GROUP BY/ORDER BY template; extract the common template and insert an
optional WHERE fragment: call `get_filter_string(conditions)` when
`count_conditions.conditions` is Some to produce `f` and set `where_clause` to
`format!(" WHERE {}", f)` (or empty string when None), then build `query` once
using `{date_bin}{group_clause}`, `"{table_name}"`, `{end_time_col_name}`, and
`{start_time_col_name}` while interpolating `where_clause`; update uses of
`count_conditions`, `get_filter_string`, `date_bin`, `group_clause`,
`table_name`, `end_time_col_name`, and `start_time_col_name` accordingly.
Summary by CodeRabbit