Skip to content

Commit

Permalink
Fallback to split and swap validation when error is zero in canonical od
Browse files Browse the repository at this point in the history
  • Loading branch information
polyntsov committed Oct 1, 2024
1 parent a0e7af5 commit 3f6ec49
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/core/algorithms/od/fastod/model/canonical_od.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ CanonicalOD<Ordering>::CanonicalOD(AttributeSet const& context, model::ColumnInd
template <od::Ordering Ordering>
bool CanonicalOD<Ordering>::IsValid(DataFrame const& data, PartitionCache& cache,
config::ErrorType error) const {
od::RemovalSetAsVec removal_set = CalculateRemovalSet(data, cache);
return removal_set.size() <= error * data.GetTupleCount();
if (error == 0.0) {
return !cache.GetStrippedPartition(context_, data).Swap<Ordering>(ap_.left, ap_.right);
} else {
od::RemovalSetAsVec removal_set = CalculateRemovalSet(data, cache);
return removal_set.size() <= error * data.GetTupleCount();
}
}

template <od::Ordering Ordering>
Expand Down Expand Up @@ -41,8 +45,12 @@ SimpleCanonicalOD::SimpleCanonicalOD(AttributeSet const& context, model::ColumnI

bool SimpleCanonicalOD::IsValid(DataFrame const& data, PartitionCache& cache,
config::ErrorType error) const {
od::RemovalSetAsVec removal_set = CalculateRemovalSet(data, cache);
return removal_set.size() <= error * data.GetTupleCount();
if (error == 0.0) {
return !cache.GetStrippedPartition(context_, data).Split(right_);
} else {
od::RemovalSetAsVec removal_set = CalculateRemovalSet(data, cache);
return removal_set.size() <= error * data.GetTupleCount();
}
}

od::RemovalSetAsVec SimpleCanonicalOD::CalculateRemovalSet(DataFrame const& data,
Expand Down

0 comments on commit 3f6ec49

Please sign in to comment.