Skip to content
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

Support range query for rest api like P.gt(18)/P.lt(3.14) #782

Merged
merged 3 commits into from
Apr 6, 2020

Conversation

javeme
Copy link
Contributor

@javeme javeme commented Dec 4, 2019

implement: #781
Change-Id: I4a4b8a78708dff1a27d0168b27b77958ee9fcfde

@codecov
Copy link

codecov bot commented Dec 4, 2019

Codecov Report

Merging #782 into master will increase coverage by 0.03%.
The diff coverage is 72.83%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #782      +/-   ##
============================================
+ Coverage     71.89%   71.92%   +0.03%     
- Complexity     4596     4619      +23     
============================================
  Files           295      295              
  Lines         21943    22014      +71     
  Branches       3097     3117      +20     
============================================
+ Hits          15775    15833      +58     
- Misses         4619     4629      +10     
- Partials       1549     1552       +3     
Impacted Files Coverage Δ Complexity Δ
...in/java/com/baidu/hugegraph/api/graph/EdgeAPI.java 55.61% <0.00%> (-2.17%) 0.00 <0.00> (ø)
...c/main/java/com/baidu/hugegraph/util/DateUtil.java 80.76% <ø> (+23.07%) 8.00 <0.00> (+1.00)
...c/main/java/com/baidu/hugegraph/util/LockUtil.java 83.82% <0.00%> (ø) 15.00 <0.00> (ø)
.../java/com/baidu/hugegraph/api/graph/VertexAPI.java 36.47% <37.50%> (+0.29%) 0.00 <0.00> (ø)
...du/hugegraph/traversal/optimize/TraversalUtil.java 65.02% <86.88%> (+3.98%) 107.00 <22.00> (+23.00)
...com/baidu/hugegraph/serializer/JsonSerializer.java 49.36% <100.00%> (-0.64%) 0.00 <0.00> (ø)
...n/java/com/baidu/hugegraph/version/ApiVersion.java 75.00% <100.00%> (ø) 0.00 <0.00> (ø)
...n/java/com/baidu/hugegraph/task/TaskScheduler.java 83.14% <0.00%> (-0.38%) 62.00% <0.00%> (ø%)
...du/hugegraph/backend/tx/GraphIndexTransaction.java 79.58% <0.00%> (ø) 186.00% <0.00%> (-1.00%)
...a/com/baidu/hugegraph/backend/query/Condition.java 79.25% <0.00%> (+0.41%) 31.00% <0.00%> (ø%)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04607d0...ed7631f. Read the comment docs.

// Convert relational operator like P.gt()/P.lt()
for (Map.Entry<String, Object> prop : props.entrySet()) {
Object value = prop.getValue();
if (value instanceof String && ((String) value).startsWith("P.")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

add a arg 'literal' to determine whether match literally, default is false

@@ -624,4 +645,76 @@ public static QueryHolder firstPageStep(GraphTraversal<?, ?> traversal) {
}
return null;
}

public static P<?> parsePredicate(String predicate) {
// extract P from json string like {"properties": {"age": "P.gt(18)"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Extract

e.getMessage());
});

Assert.assertThrows(HugeException.class, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

add more tests like "P.inside(5)" for "Invalid numbers size...."

Linary
Linary previously approved these changes Mar 4, 2020
zhoney
zhoney previously approved these changes Apr 3, 2020
@javeme javeme dismissed stale reviews from zhoney and Linary via c87dd31 April 3, 2020 14:00
zhoney
zhoney previously approved these changes Apr 4, 2020
implement: #781
Change-Id: I4a4b8a78708dff1a27d0168b27b77958ee9fcfde
Change-Id: I98ba02e0e6d551cd937c59b4d05495f8ed99198b
Change-Id: Iafbd2c6c78464dca699910faf4f2424f15300a3e
@Linary Linary merged commit a24f7ec into master Apr 6, 2020
@Linary Linary deleted the api-support-gt-lt branch April 6, 2020 11:49
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.

None yet

3 participants