fix: improve delete functionality with multiple OR conditions and enh…#2760
fix: improve delete functionality with multiple OR conditions and enh…#2760
Conversation
…ance related tests
Summary of ChangesHello @robfrank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing the SQL query planner's efficiency by refining its index selection mechanism, ensuring that the most effective indexes are utilized for query execution. Concurrently, it significantly improves the robustness and coverage of the test suite, particularly for complex delete operations involving multiple conditions and indexes, by modernizing existing assertions and adding new, targeted test cases. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🧪 CI InsightsHere's what we observed from your CI run for 3baf809. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Code Review
This pull request correctly improves the index selection logic by ensuring the query planner chooses the index covering the most fields, which should enhance query performance. The accompanying changes to the test suite, including modernizing assertions and adding a new test for complex delete scenarios, effectively validate the fix and improve the overall quality of the tests. I have a couple of minor suggestions to improve code consistency and test conciseness.
engine/src/main/java/com/arcadedb/query/sql/executor/SelectExecutionPlanner.java
Outdated
Show resolved
Hide resolved
| database.command("sqlscript", """ | ||
| CREATE EDGE duct_duct from #1:0 to #1:1 SET from_id='1', to_id='2', swap='N'; | ||
| CREATE EDGE duct_duct from #1:0 to #1:2 SET from_id='1', to_id='3', swap='N'; | ||
| """); | ||
| ResultSet inserted = database.query("sql", "select from duct_duct"); | ||
| assertThat(inserted.stream().count()).isEqualTo(2); | ||
|
|
There was a problem hiding this comment.
This test successfully verifies the DELETE operation's correctness up to line 209. The subsequent re-insertion of data and the final assertion seem redundant for the purpose of this test. A unit test should ideally focus on verifying a single piece of functionality. Consider removing these lines to make the test more concise and focused on its primary goal of validating the delete behavior.
…cutionPlanner.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
This pull request improves index selection logic in the SQL query planner and updates related tests to use more modern assertions and add new coverage for multi-index deletes. The main focus is on refining how indexes are chosen for queries, ensuring more optimal query execution, and enhancing test reliability and completeness.
Query Planner Improvements
SelectExecutionPlanner.javato return the descriptor with the most indexed fields (usinggetLast()instead ofgetFirst()), which should improve query performance when multiple indexes are available..toList()for clarity.Testing Enhancements
DeleteStatementTest.javato use direct stream counts (result.stream().count()) and modern assertion methods (isZero()) for better readability and reliability. [1] [2]testDeleteWithMultipleOrAndMultipleIndexesto verify correct deletion behavior when multiple indexes and OR conditions are involved, improving coverage of complex delete scenarios.Arraysto support new or updated test logic.