Skip to content

Conversation

davemarco
Copy link
Contributor

@davemarco davemarco commented Aug 1, 2025

Description

PR takes results from presto query and puts them into mongoDB. Since presto data is sent as arrays, the rows are first converted to objects by adding the column names as keys, then they are put into mongo as objects. This should be better than just inserting the unmodified rows if we eventually need to run filters on the data using mongo.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Data appears in mongo

Summary by CodeRabbit

  • New Features
    • Improved handling of Presto search results by automatically storing query data in MongoDB for each search job.
  • Bug Fixes
    • Enhanced error handling to ensure MongoDB is available before processing search results.
  • Other
    • Logging improvements for better visibility into query progress and issues.

Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Walkthrough

A new utility module for inserting Presto query results into MongoDB has been introduced. The Presto search API route is updated to extract the MongoDB instance, ensure its availability, and insert processed Presto results into MongoDB collections named after the search job ID. Additional logging and error handling are incorporated.

Changes

Cohort / File(s) Change Summary
Presto Search API Route
components/webui/server/src/routes/api/presto-search/index.ts
Updates to extract the MongoDB instance from Fastify, enforce its presence, and insert Presto query results into MongoDB using a utility function. Enhanced logging and error handling for Presto data and MongoDB operations.
Presto-Mongo Utility Functions
components/webui/server/src/routes/api/presto-search/utils.ts
New module providing insertPrestoRowsToMongo, which maps Presto result rows to objects and inserts them into MongoDB collections by search job ID. Includes a row-to-object helper function.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant FastifyAPI
    participant Presto
    participant MongoDB

    Client->>FastifyAPI: Initiate Presto search
    FastifyAPI->>Presto: Execute Presto query
    Presto-->>FastifyAPI: Stream query results (rows, columns)
    FastifyAPI->>MongoDB: insertPrestoRowsToMongo(rows, columns, jobId)
    MongoDB-->>FastifyAPI: Insertion result
    FastifyAPI-->>Client: Respond with query/job status
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • junhaoliao
  • kirkrodrigues

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f30432 and e6d5634.

📒 Files selected for processing (2)
  • components/webui/server/src/routes/api/presto-search/index.ts (3 hunks)
  • components/webui/server/src/routes/api/presto-search/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit Configuration File

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: haiqi96
PR: y-scope/clp#0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.
📚 Learning: in `components/log-viewer-webui/client/src/api/query.js`, the `extractjsonresp` type definition is a...
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: for internal apis in `components/log-viewer-webui/client/src/api/query.js`, runtime validation of pa...
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:35-41
Timestamp: 2024-11-19T19:52:43.429Z
Learning: For internal APIs in `components/log-viewer-webui/client/src/api/query.js`, runtime validation of parameters may not be necessary since the APIs are not exposed to end users, and JsDoc type annotations may be sufficient.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
📚 Learning: user junhaoliao requested creating a github issue to track server-side sql query error handling impr...
Learnt from: junhaoliao
PR: y-scope/clp#1136
File: components/webui/client/src/pages/IngestPage/Details/sql.ts:1-1
Timestamp: 2025-07-29T21:00:07.757Z
Learning: User junhaoliao requested creating a GitHub issue to track server-side SQL query error handling improvements, specifically to prevent uncaught query errors from causing 500 errors to reach the client.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: when implementing socket.io namespaces or connection pooling in a client-server architecture (like t...
Learnt from: davemarco
PR: y-scope/clp#892
File: components/log-viewer-webui/client/src/api/socket/MongoCollectionSocket.ts:32-38
Timestamp: 2025-05-09T18:05:42.814Z
Learning: When implementing Socket.IO namespaces or connection pooling in a client-server architecture (like the MongoDB collection socket system in the log-viewer-webui), coordinated changes are needed on both client and server sides, making it appropriate to track as a TODO rather than implement piecemeal.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: the current implementation assumes single-threaded execution, so race conditions in functions like `...
Learnt from: haiqi96
PR: y-scope/clp#569
File: components/job-orchestration/job_orchestration/scheduler/query/query_scheduler.py:380-392
Timestamp: 2024-11-15T20:07:22.256Z
Learning: The current implementation assumes single-threaded execution, so race conditions in functions like `is_target_extracted` in `components/job-orchestration/job_orchestration/scheduler/query/query_scheduler.py` are not currently a concern.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/index.ts
🔇 Additional comments (4)
components/webui/server/src/routes/api/presto-search/index.ts (4)

19-29: Good defensive programming for MongoDB availability.

The extraction of the MongoDB database instance and the explicit error throwing if it's undefined ensures the plugin fails fast if MongoDB is not properly configured, which is better than encountering runtime errors later.


64-71: Race condition properly addressed with defensive check.

The addition of the isResolved check prevents MongoDB insertion attempts when the searchJobId hasn't been resolved yet. This addresses the critical race condition issue identified in previous reviews where data could arrive before the search job ID was available.


73-75: Empty data check prevents unnecessary operations.

Checking for empty data arrays before attempting MongoDB insertion is a good optimization that prevents unnecessary database operations.


77-87: Proper error handling for MongoDB operations.

The MongoDB insertion is properly wrapped with error handling that logs failures without crashing the application. The .catch() approach allows the Presto query to continue processing even if MongoDB insertion fails.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco marked this pull request as ready for review August 5, 2025 14:56
@davemarco davemarco requested a review from a team as a code owner August 5, 2025 14:56
@davemarco davemarco requested a review from hoophalab August 5, 2025 14:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7931f0f and 0573aab.

📒 Files selected for processing (3)
  • components/webui/server/src/routes/api/presto-search/index.ts (2 hunks)
  • components/webui/server/src/routes/api/presto-search/typings.ts (1 hunks)
  • components/webui/server/src/routes/api/presto-search/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit Configuration File

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/server/src/routes/api/presto-search/index.ts
  • components/webui/server/src/routes/api/presto-search/typings.ts
  • components/webui/server/src/routes/api/presto-search/utils.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: haiqi96
PR: y-scope/clp#0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
📚 Learning: in `components/log-viewer-webui/client/src/api/query.js`, the `extractjsonresp` type definition is a...
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/index.ts
  • components/webui/server/src/routes/api/presto-search/typings.ts
  • components/webui/server/src/routes/api/presto-search/utils.ts
📚 Learning: the new webui architecture uses fastify with pino logging instead of the previous winston-based logg...
Learnt from: junhaoliao
PR: y-scope/clp#939
File: components/package-template/src/etc/clp-config.yml:64-64
Timestamp: 2025-06-22T04:01:43.409Z
Learning: The new webui architecture uses Fastify with Pino logging instead of the previous Winston-based logging system that was removed during the webui refactoring.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/index.ts
🔇 Additional comments (8)
components/webui/server/src/routes/api/presto-search/index.ts (2)

9-9: LGTM!

The import statement correctly brings in the utility function from the local utils module.


19-29: MongoDB availability check is well implemented.

The extraction of MongoDB instance and validation with proper error throwing ensures the plugin fails fast if MongoDB is unavailable. The error message is clear and descriptive.

components/webui/server/src/routes/api/presto-search/typings.ts (3)

1-2: LGTM!

The import statements correctly import the necessary types from their respective packages.


5-12: Interface definition is well-structured and type-safe.

The InsertPrestoRowsToMongoProps interface properly defines all required properties with appropriate types. The use of unknown[][] for data and {name: string}[] for columns accurately reflects the Presto query result structure.


14-14: LGTM!

The export statement correctly exports the interface for use in other modules.

components/webui/server/src/routes/api/presto-search/utils.ts (3)

1-1: LGTM!

The import statement correctly imports the type interface from the local typings module.


58-58: LGTM!

The export statement correctly exports the main utility function.


43-47: Boolean expression violates coding guidelines.

The condition false === isResolved should be written as !isResolved according to the coding guidelines which prefer false == <expression> rather than !<expression>. However, this specific case uses strict equality (===) instead of loose equality (==), so the guideline doesn't directly apply. Still, for consistency with the codebase style, consider using the boolean negation.

-    if (false === isResolved) {
+    if (!isResolved) {

Likely an incorrect or invalid review comment.

Copy link
Contributor

@hoophalab hoophalab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some coding style thoughts if you're open to them.

Validation:
The query results are in the database.

Comment on lines +12 to +22
const prestoRowToObject = (
row: unknown[],
columns: {name: string}[]
): Record<string, unknown> => {
const obj: Record<string, unknown> = {};
columns.forEach((col, idx) => {
obj[col.name] = row[idx];
});

return obj;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this function provides little abstraction. It's best to put the content inside

        const resultDocs = data.map((row) => prestoRowToObject(row, columns));

What's your opinion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ur right dosent provide much functionality, but i thought the code was difficult to read/understand, so i felt wrapping it in a function and adding jsdoc would make more readable

Comment on lines 35 to 56
const insertPrestoRowsToMongo = ({
columns,
data,
isResolved,
log,
mongoDb,
searchJobId,
}: InsertPrestoRowsToMongoProps): void => {
if (false === isResolved) {
log.error("Presto data received before searchJobId was resolved; skipping insert.");

return;
}

if (0 < data.length && searchJobId) {
const collection = mongoDb.collection(searchJobId);
const resultDocs = data.map((row) => prestoRowToObject(row, columns));
collection.insertMany(resultDocs).catch((err: unknown) => {
log.error(err, "Failed to insert Presto results into MongoDB");
});
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is just taking all the variables from the data callback as its parameters.

It would be much better to just inline it.

If we really want to keep it, it needs a few changes:

  1. don't pass in isResolved. That error check should happen directly inside the data callback.
  2. don't pass in log. This function can return insertMany's promise directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay i kept function but made changes. I want to keep the utility since i feel like this function will get more complicated over time, and want to keep the main route cleaner

return;
}

if (0 < data.length && searchJobId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to check searchJobId here. In the previous code, it was a Nullable type. However, since we've already established that searchJobId will always be resolved before the data arrives, checking for undefined is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay its gone, and i moved this check outside the utility

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
components/webui/server/src/routes/api/presto-search/utils.ts (1)

14-24: Consider inlining this function or adding validation.

Based on previous feedback, this function provides minimal abstraction and could be inlined directly in the insertPrestoRowsToMongo function. If kept separate, it should validate that row.length === columns.length to prevent undefined values or missed data.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0573aab and 6f30432.

📒 Files selected for processing (2)
  • components/webui/server/src/routes/api/presto-search/index.ts (3 hunks)
  • components/webui/server/src/routes/api/presto-search/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit Configuration File

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: haiqi96
PR: y-scope/clp#0
File: :0-0
Timestamp: 2025-07-29T14:04:13.769Z
Learning: User haiqi96 requested creating a GitHub issue to document a bug fix from PR #1136, which addressed MySQL compatibility issues with invalid SQL CAST operations in the WebUI component.
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.
📚 Learning: in `components/log-viewer-webui/client/src/api/query.js`, the `extractjsonresp` type definition is a...
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:16-23
Timestamp: 2024-11-21T15:51:33.203Z
Learning: In `components/log-viewer-webui/client/src/api/query.js`, the `ExtractJsonResp` type definition is accurate as-is and does not require modification. When suggesting changes to type definitions, ensure they align with the server-side definitions, referencing the source code if necessary.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: for internal apis in `components/log-viewer-webui/client/src/api/query.js`, runtime validation of pa...
Learnt from: junhaoliao
PR: y-scope/clp#596
File: components/log-viewer-webui/client/src/api/query.js:35-41
Timestamp: 2024-11-19T19:52:43.429Z
Learning: For internal APIs in `components/log-viewer-webui/client/src/api/query.js`, runtime validation of parameters may not be necessary since the APIs are not exposed to end users, and JsDoc type annotations may be sufficient.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
📚 Learning: user junhaoliao requested creating a github issue to track server-side sql query error handling impr...
Learnt from: junhaoliao
PR: y-scope/clp#1136
File: components/webui/client/src/pages/IngestPage/Details/sql.ts:1-1
Timestamp: 2025-07-29T21:00:07.757Z
Learning: User junhaoliao requested creating a GitHub issue to track server-side SQL query error handling improvements, specifically to prevent uncaught query errors from causing 500 errors to reach the client.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: when implementing socket.io namespaces or connection pooling in a client-server architecture (like t...
Learnt from: davemarco
PR: y-scope/clp#892
File: components/log-viewer-webui/client/src/api/socket/MongoCollectionSocket.ts:32-38
Timestamp: 2025-05-09T18:05:42.814Z
Learning: When implementing Socket.IO namespaces or connection pooling in a client-server architecture (like the MongoDB collection socket system in the log-viewer-webui), coordinated changes are needed on both client and server sides, making it appropriate to track as a TODO rather than implement piecemeal.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/utils.ts
  • components/webui/server/src/routes/api/presto-search/index.ts
📚 Learning: the current implementation assumes single-threaded execution, so race conditions in functions like `...
Learnt from: haiqi96
PR: y-scope/clp#569
File: components/job-orchestration/job_orchestration/scheduler/query/query_scheduler.py:380-392
Timestamp: 2024-11-15T20:07:22.256Z
Learning: The current implementation assumes single-threaded execution, so race conditions in functions like `is_target_extracted` in `components/job-orchestration/job_orchestration/scheduler/query/query_scheduler.py` are not currently a concern.

Applied to files:

  • components/webui/server/src/routes/api/presto-search/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint-check (macos-15)
🔇 Additional comments (2)
components/webui/server/src/routes/api/presto-search/index.ts (2)

19-29: LGTM! Proper MongoDB dependency validation.

The MongoDB database extraction and validation ensures the plugin only registers when MongoDB is available, preventing runtime errors during query processing.


64-71: Race condition properly addressed.

The isResolved check effectively prevents the race condition identified in previous reviews by ensuring MongoDB insertion only occurs after searchJobId is resolved.

Comment on lines 36 to 45
const insertPrestoRowsToMongo = ({
columns,
data,
mongoDb,
searchJobId,
}: InsertPrestoRowsToMongoProps): Promise<InsertManyResult<Document>> => {
const collection = mongoDb.collection(searchJobId);
const resultDocs = data.map((row) => prestoRowToObject(row, columns));
return collection.insertMany(resultDocs);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Improved implementation addresses previous concerns.

The function has been significantly improved from previous versions by:

  • Removing the isResolved parameter (now handled by caller)
  • Removing the log parameter (function returns promise directly)
  • Returning the promise instead of fire-and-forget with .catch()

However, the previous feedback about minimal abstraction still applies - this function essentially wraps a single insertMany call and could be inlined in the caller for better code clarity.

🤖 Prompt for AI Agents
In components/webui/server/src/routes/api/presto-search/utils.ts around lines 36
to 45, the insertPrestoRowsToMongo function is a minimal wrapper around a single
insertMany call and could be inlined in the caller for better clarity. Remove
this function entirely and move its logic directly into the caller where it is
used, passing the transformed data to insertMany without an extra abstraction
layer.

@davemarco davemarco requested a review from hoophalab August 5, 2025 21:23
hoophalab
hoophalab previously approved these changes Aug 5, 2025
Copy link
Contributor

@hoophalab hoophalab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks for the change

Validation:
The query results are in the database.

@davemarco
Copy link
Contributor Author

@junhaoliao can you approve this

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferring to @hoophalab ‘s review

@davemarco davemarco merged commit 06f5fe5 into y-scope:main Aug 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants