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

GH-40943: [Java] Implement RangeEqualsVisitor for StringView #41636

Merged
merged 10 commits into from
May 16, 2024

Conversation

vibhatha
Copy link
Collaborator

@vibhatha vibhatha commented May 13, 2024

Rationale for this change

Adding RangeEqualsVisitor for StringView as discussed in #40943.

What changes are included in this PR?

Including RangeEqualsVisitor visitor method and test cases to validate it.

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels May 13, 2024
@vibhatha vibhatha marked this pull request as ready for review May 13, 2024 10:22
@vibhatha vibhatha requested a review from lidavidm as a code owner May 13, 2024 10:22
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels May 13, 2024
// inclusion of long string at the start
assertTrue(visitor.rangeEquals(new Range(2, 2, 4)));
// inclusion of long string at the end
assertTrue(visitor.rangeEquals(new Range(4, 4, 4)));
Copy link
Member

Choose a reason for hiding this comment

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

we should also test nulls, and ranges that should not be equal

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added one case for that.

@vibhatha vibhatha force-pushed the stringview-range-equals-visitor branch from d8d140f to ec55b8b Compare May 14, 2024 23:57
@vibhatha vibhatha requested a review from lidavidm May 14, 2024 23:58
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 14, 2024
Comment on lines +154 to +155
// unequal range
assertTrue(visitor.rangeEquals(new Range(8, 0, 3)));
Copy link
Member

Choose a reason for hiding this comment

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

....they're still equal. Let's test ranges that are not supposed to be equal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah right! 🙂 I misunderstood.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added a few not equal cases for each category except for inclusion of long string at the end, since it is not possible to have that case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added null cases, there is a bit of code duplication in testing the ranges, I left it that way for the readability.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels May 15, 2024
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels May 15, 2024
@vibhatha
Copy link
Collaborator Author

I am working on adding the null one...

return false;
}

if (!isNull) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lidavidm there was an unnecessary looping happened. So I added this. Sorry I missed this earlier.

Copy link
Member

Choose a reason for hiding this comment

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

nit: it's clearer to do if (isNull) { continue; }

return false;
}

if (!isNull) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: it's clearer to do if (isNull) { continue; }

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels May 15, 2024
@lidavidm lidavidm merged commit 1c15c88 into apache:main May 16, 2024
14 of 15 checks passed
@lidavidm lidavidm removed the awaiting merge Awaiting merge label May 16, 2024
Copy link

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 1c15c88.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 10 possible false positives for unstable benchmarks that are known to sometimes produce them.

vibhatha added a commit to vibhatha/arrow that referenced this pull request May 25, 2024
…pache#41636)

### Rationale for this change

Adding `RangeEqualsVisitor` for StringView as discussed in apache#40943.

### What changes are included in this PR?

Including `RangeEqualsVisitor` visitor method and test cases to validate it. 

### Are these changes tested?

Yes

### Are there any user-facing changes?

No
* GitHub Issue: apache#40943

Authored-by: Vibhatha Abeykoon <vibhatha@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants