Fixed Stats method for Not iterator.
Added unit tests for Not iterator.
This commit is contained in:
parent
a5fd1905d0
commit
305815e663
2 changed files with 49 additions and 8 deletions
|
|
@ -154,15 +154,12 @@ func (it *Not) Optimize() (graph.Iterator, bool) {
|
|||
}
|
||||
|
||||
func (it *Not) Stats() graph.IteratorStats {
|
||||
subitStats := it.primaryIt.Stats()
|
||||
// TODO(barakmich): These should really come from the triplestore itself
|
||||
fanoutFactor := int64(20)
|
||||
checkConstant := int64(1)
|
||||
nextConstant := int64(2)
|
||||
primaryStats := it.primaryIt.Stats()
|
||||
allStats := it.allIt.Stats()
|
||||
return graph.IteratorStats{
|
||||
NextCost: nextConstant + subitStats.NextCost,
|
||||
ContainsCost: checkConstant + subitStats.ContainsCost,
|
||||
Size: fanoutFactor * subitStats.Size,
|
||||
NextCost: allStats.NextCost + primaryStats.ContainsCost,
|
||||
ContainsCost: primaryStats.ContainsCost,
|
||||
Size: allStats.Size - primaryStats.Size,
|
||||
Next: it.runstats.Next,
|
||||
Contains: it.runstats.Contains,
|
||||
ContainsNext: it.runstats.ContainsNext,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue