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

Optimize the implementation of IntervalSet intersection #2300

Merged
merged 4 commits into from
May 11, 2024

Conversation

13015517713
Copy link
Contributor

  • Optimize the implementation of IntervalSet intersection
  • add some unittest for IntervalSet &(op)

@13015517713
Copy link
Contributor Author

related issue: #2295

@13015517713 13015517713 closed this May 7, 2024
@13015517713 13015517713 reopened this May 7, 2024
@torwig
Copy link
Contributor

torwig commented May 7, 2024

./x.py format should fix linter issues.

@13015517713
Copy link
Contributor Author

./x.py format should fix linter issues.

done

@mapleFU
Copy link
Member

mapleFU commented May 7, 2024

Format problems occurs frequently, let me create an extra issue for that: #2301

@13015517713
Copy link
Contributor Author

Use rand() function in unit testing. That check could be ignored, I guees.

auto it_r = r.intervals.begin();

while (it_l != l.intervals.end() && it_r != r.intervals.end()) {
// Find overlap between current intervals
Copy link
Member

Choose a reason for hiding this comment

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

@PragmaTwice quick question, does our interval prevent from generating qNaN?

Copy link
Member

Choose a reason for hiding this comment

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

We assume that there's no NaN in the input.

.gitignore Outdated
@@ -46,3 +46,4 @@ testdb

build
cmake-build-*
unittest
Copy link
Member

Choose a reason for hiding this comment

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

Hmm seems not necessary to be added into gitignore?

double end = std::min(it_l->second, it_r->second);

if (start <= end) {
result.intervals.push_back(std::make_pair(start, end));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
result.intervals.push_back(std::make_pair(start, end));
result.intervals.emplace_back(start, end);

2.Change rand() to std::rand() and remove the header stdlib.h
Copy link

sonarcloud bot commented May 11, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarCloud

@mapleFU mapleFU merged commit 1e23484 into apache:unstable May 11, 2024
30 of 31 checks passed
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