#3315 fix: resolve argument expressions correctly in CREATE EDGE stat…#3323
#3315 fix: resolve argument expressions correctly in CREATE EDGE stat…#3323
Conversation
…ements Fixed property extraction from Result collections in SuffixIdentifier to return unwrapped values instead of Result wrappers. Enhanced CreateEdgesStep to handle projection Results by extracting @Rid property when vertex element is unavailable. This allows CREATE EDGE to properly resolve expressions like: - LET $x = SELECT @Rid FROM V; CREATE EDGE E FROM $x.@Rid TO $x.@Rid - CREATE EDGE E FROM (SELECT @Rid FROM V).@Rid TO (SELECT @Rid FROM V).@Rid Co-Authored-By: Claude Opus 4.5 <[email protected]>
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 addresses a bug in ArcadeDB's SQL execution engine that prevented Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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
|
Pull Request Review - Issue #3315 FixSummaryThis PR fixes a bug where CREATE EDGE statements fail to resolve argument expressions when using query result sets. The fix properly unwraps Result objects when extracting properties from collections. ✅ Strengths
🔍 Code Quality ObservationsSuffixIdentifier.java (lines 175-220)Positive:
Concerns:
private Object unwrapResultIfNeeded(Object value) {
if (value instanceof Result r && (identifier \!= null || recordAttribute \!= null)) {
if (r.isElement()) {
return r.getElement().get();
} else if (identifier \!= null && r.hasProperty(identifier.getStringValue())) {
return r.getProperty(identifier.getStringValue());
} else if (recordAttribute \!= null) {
return recordAttribute.evaluate(r, context);
}
}
return value;
}
CreateEdgesStep.java (lines 295-312)Positive:
Concerns:
if (result.hasProperty("@rid")) {
final Object rid = result.getProperty("@rid");
if (rid \!= null) {
currentFrom = rid;
} else {
throw new CommandExecutionException("Invalid vertex for edge creation: " + result);
}
}Could become: if (result.hasProperty("@rid") && result.getProperty("@rid") \!= null) {
currentFrom = result.getProperty("@rid");
} else {
throw new CommandExecutionException("Invalid vertex for edge creation: " + result);
}
|
🧪 CI InsightsHere's what we observed from your CI run for 537476a. 🟢 All jobs passed!But CI Insights is watching 👀 |
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the issue of resolving argument expressions in CREATE EDGE statements by unwrapping Result objects. The changes in SuffixIdentifier and CreateEdgesStep are logical, and the new test cases in QueryTest provide good coverage for the fix. I have a couple of suggestions to improve code clarity and reduce duplication.
engine/src/main/java/com/arcadedb/query/sql/executor/CreateEdgesStep.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/arcadedb/query/sql/parser/SuffixIdentifier.java
Outdated
Show resolved
Hide resolved
- Extract duplicate unwrapping logic into private helper method (SuffixIdentifier) - Fix potential NPE by using orElse(null) instead of get() on Optional - Simplify CreateEdgesStep code by removing redundant hasProperty check Co-Authored-By: Claude Opus 4.5 <[email protected]>
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 preferences |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3323 +/- ##
==========================================
+ Coverage 56.68% 56.72% +0.04%
==========================================
Files 1368 1368
Lines 100618 100633 +15
Branches 20486 20492 +6
==========================================
+ Hits 57032 57082 +50
+ Misses 34458 34431 -27
+ Partials 9128 9120 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Review: Fix CREATE EDGE Expression Resolution (#3315)SummaryThis PR fixes a bug where Code Quality & Best Practices ✅Strengths:
Minor Observations:SuffixIdentifier.java (lines 206-226)
CreateEdgesStep.java (lines 295-308)
Potential Bugs or Issues
|
PR Review Comments AddressedI've pushed a new commit ( ✅ Addressed
❌ Discarded (with rationale)
All tests pass after the refactoring (verified with |
#3323) * #3315 fix: resolve argument expressions correctly in CREATE EDGE statements Fixed property extraction from Result collections in SuffixIdentifier to return unwrapped values instead of Result wrappers. Enhanced CreateEdgesStep to handle projection Results by extracting @Rid property when vertex element is unavailable. This allows CREATE EDGE to properly resolve expressions like: - LET $x = SELECT @Rid FROM V; CREATE EDGE E FROM $x.@Rid TO $x.@Rid - CREATE EDGE E FROM (SELECT @Rid FROM V).@Rid TO (SELECT @Rid FROM V).@Rid - Extract duplicate unwrapping logic into private helper method (SuffixIdentifier) - Fix potential NPE by using orElse(null) instead of get() on Optional - Simplify CreateEdgesStep code by removing redundant hasProperty check (cherry picked from commit 01b09bd)
…ements
Fixed property extraction from Result collections in SuffixIdentifier to return unwrapped values instead of Result wrappers. Enhanced CreateEdgesStep to handle projection Results by extracting @Rid property when vertex element is unavailable.
This allows CREATE EDGE to properly resolve expressions like: