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

[TINKERPOP-2891] Improved handling for negative values in CountStrategy #2021

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

vkagamlyk
Copy link
Contributor

@vkagamlyk vkagamlyk commented Apr 13, 2023

Fixed optimization of count step inside CountStrategy.

queries like
g.V().where(__.in().count().is(eq(-3))) and g.V().where(__.in().count().is(eq(-2))) are now correctly optimized as g.V().where(__.in().limit(0).count().is(eq(-2)))

https://issues.apache.org/jira/browse/TINKERPOP-2891

@@ -178,7 +178,7 @@ public void apply(final Traversal.Admin<?, ?> traversal) {
}
}
} else {
TraversalHelper.insertBeforeStep(new RangeGlobalStep<>(traversal, 0L, highRange), curr, traversal);
TraversalHelper.insertBeforeStep(new RangeGlobalStep<>(traversal, 0L, highRange < 0 ? 0 : highRange), curr, traversal);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like highRange is a Long, should these comparisons be in Long too?

Suggested change
TraversalHelper.insertBeforeStep(new RangeGlobalStep<>(traversal, 0L, highRange < 0 ? 0 : highRange), curr, traversal);
TraversalHelper.insertBeforeStep(new RangeGlobalStep<>(traversal, 0L, highRange < 0L ? 0L : highRange), curr, traversal);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

widening casting should handle this

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is more of a nit style/format comment since previous comparisons are done as Long.

@kenhuuu
Copy link
Contributor

kenhuuu commented Apr 14, 2023

VOTE +1

@codecov-commenter
Copy link

Codecov Report

Merging #2021 (6f97bfe) into 3.5-dev (deba215) will decrease coverage by 5.18%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##             3.5-dev    #2021      +/-   ##
=============================================
- Coverage      69.33%   64.16%   -5.18%     
=============================================
  Files            866       25     -841     
  Lines          41219     3750   -37469     
  Branches        5432        0    -5432     
=============================================
- Hits           28581     2406   -26175     
+ Misses         10722     1166    -9556     
+ Partials        1916      178    -1738     

see 841 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@vkagamlyk
Copy link
Contributor Author

VOTE+1

@xiazcy
Copy link
Contributor

xiazcy commented Apr 14, 2023

VOTE +1

@vkagamlyk vkagamlyk merged commit 783be48 into apache:3.5-dev Apr 14, 2023
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.

4 participants