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

Implement comparison of two geo points #1801

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/global/ValueIdComparators.h
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,23 @@
return fromBool(std::invoke(comparator, a, b));
}

auto visitor = [comparator]<typename A, typename B>(
// If both are geo points, compare the raw IDs.
if (a.getDatatype() == Datatype::GeoPoint &&
b.getDatatype() == Datatype::GeoPoint) {
return fromBool(std::invoke(comparator, a.getBits(), b.getBits()));
}

Check warning on line 512 in src/global/ValueIdComparators.h

View check run for this annotation

Codecov / codecov/patch

src/global/ValueIdComparators.h#L511-L512

Added lines #L511 - L512 were not covered by tests

auto visitor = [comparator, &a, &b]<typename A, typename B>(
const A& aValue, const B& bValue) -> ComparisonResult {
if constexpr (std::is_same_v<A, LocalVocabIndex> &&
std::is_same_v<B, LocalVocabIndex>) {
// We have handled this case outside the visitor.
AD_FAIL();
} else if constexpr (requires() {
std::invoke(comparator, aValue, bValue);
}) {
if constexpr (requires() { std::invoke(comparator, aValue, bValue); }) {
return fromBool(std::invoke(comparator, aValue, bValue));
} else {
static_assert((!std::is_same_v<A, B>) ||
ad_utility::SameAsAny<A, LocalVocabIndex, GeoPoint,
Id::UndefinedType>);
AD_LOG_ERROR << "Comparison not implemented for types "
<< toString(a.getDatatype()) << " and "
<< toString(b.getDatatype()) << std::endl;

Check warning on line 524 in src/global/ValueIdComparators.h

View check run for this annotation

Codecov / codecov/patch

src/global/ValueIdComparators.h#L519-L524

Added lines #L519 - L524 were not covered by tests
AD_FAIL();
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/index/IndexImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ IndexBuilderDataAsStxxlVector IndexImpl::passFileForVocabulary(
AD_LOG_INFO << "Number of triples created (including QLever-internal ones): "
<< (*idTriples.wlock())->size() << " [may contain duplicates]"
<< std::endl;
AD_LOG_INFO << "Number of partial vocabularies created: " << numFiles
<< std::endl;

size_t sizeInternalVocabulary = 0;
std::vector<std::string> prefixes;
Expand Down
Loading