-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor + test: query response serialization #1165
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update the query handler and response generation logic. In the query module, a new error variant for Arrow errors is added, and error handling is expanded to cover both JSON and Arrow errors, with improved logging via a renamed timing variable. In the response module, the method for producing client responses has shifted from HTTP to direct JSON conversion using an Arrow Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant QH as HTTP Query Handler
participant QE as QueryError Handler
participant LOG as Logger
participant HTTP as HTTP Response
C->>QH: Send query request
QH->>QH: Process query
QH->>QE: Encounter error (JSON/Arrow error)
QE-->>QH: Return error with appropriate status code
QH->>LOG: Log debug info (using 'start' time)
QH->>HTTP: Respond with error status and message
sequenceDiagram
participant C as Client
participant QR as QueryResponse
participant AW as ArrayWriter
participant JSON as JSON Converter
C->>QR: Request query result conversion
QR->>AW: Write record batch data
AW->>JSON: Convert written data buffer to JSON
JSON-->>QR: Return JSON data
QR->>C: Send JSON response
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (10)
🔇 Additional comments (8)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/response.rs (2)
31-59
: Potential performance improvements
Writing entireRecordBatch
data into a single in-memory buffer witharrow_json::ArrayWriter
may become memory-intensive for large result sets. Consider a streaming or chunk-based approach if you anticipate very large batches. Also note that settingfill_null
totrue
will require iterating over all objects to find missing fields, which can increase overhead.
62-219
: Great test coverage
These tests thoroughly cover multiple scenarios, including handling of null values, empty batches, and field inclusion. However, there is repeated code for creating record batches. Consider refactoring common setup steps into a helper function to reduce duplication.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/handlers/http/query.rs
(6 hunks)src/response.rs
(2 hunks)src/utils/arrow/mod.rs
(0 hunks)
💤 Files with no reviewable changes (1)
- src/utils/arrow/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms (10)
- GitHub Check: Build Default x86_64-pc-windows-msvc
- GitHub Check: Build Default aarch64-apple-darwin
- GitHub Check: Build Default x86_64-apple-darwin
- GitHub Check: Build Default aarch64-unknown-linux-gnu
- GitHub Check: Build Kafka aarch64-apple-darwin
- GitHub Check: Build Default x86_64-unknown-linux-gnu
- GitHub Check: Quest Smoke and Load Tests for Distributed deployments
- GitHub Check: Build Kafka x86_64-unknown-linux-gnu
- GitHub Check: Quest Smoke and Load Tests for Standalone deployments
- GitHub Check: coverage
🔇 Additional comments (8)
src/response.rs (2)
19-19
: No issues
The newly added import forQueryError
looks correct.
21-21
: Imports for JSON are appropriate
No concerns with the addedserde_json
imports.src/handlers/http/query.rs (6)
22-22
: Explicit import
IntroducingArrowError
is consistent with the newArrow
error variant.
35-35
: New debug logging
No concerns with addingerror
anddebug
fromtracing
.
105-105
: Accurate timing logs for quick count queries
Recording and logging elapsed time here is beneficial for performance monitoring.Also applies to: 126-132
143-143
: End-to-end timing for standard queries
Consistent usage of timing metrics here as well ensures comprehensive performance tracking.Also applies to: 145-145, 150-152
318-321
: Enhanced error handling
AddingArrow
andJson
variants toQueryError
clearly distinguishes error origins and improves debuggability.
327-329
: Status code alignment
TreatingQueryError::Json
andQueryError::Arrow
as internal server errors follows the existing pattern forExecute
errors and keeps error handling consistent.
Fixes #XXXX.
Description
Improves the testability of
QueryResponse
This PR has:
Summary by CodeRabbit