Skip to content

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

Merged
lidavidm merged 10 commits into
apache:mainfrom
vibhatha:stringview-range-equals-visitor
May 16, 2024
Merged

lidavidm merged 10 commits into
apache:mainfrom
vibhatha:stringview-range-equals-visitor

Conversation

@vibhatha

@vibhatha vibhatha commented May 13, 2024 •

Copy link
Copy Markdown
Contributor

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
Comment thread java/vector/src/main/java/org/apache/arrow/vector/compare/RangeEqualsVisitor.java Outdated
Comment thread java/vector/src/main/java/org/apache/arrow/vector/compare/RangeEqualsVisitor.java Outdated
Comment thread java/vector/src/main/java/org/apache/arrow/vector/compare/RangeEqualsVisitor.java Outdated

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
Contributor Author

I am working on adding the null one...

return false;
}

if (!isNull) {

Copy link
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
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
@lidavidm lidavidm removed the awaiting merge Awaiting merge label May 16, 2024
@conbench-apache-arrow

Copy link
Copy Markdown

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>
pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
…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