diff --git a/src/probabilistic/Topk.cc b/src/probabilistic/Topk.cc index f870619e87..0de42bef47 100644 --- a/src/probabilistic/Topk.cc +++ b/src/probabilistic/Topk.cc @@ -191,9 +191,7 @@ IntrusivePtr TopkVal::GetTopK(int k) const // returns vector return nullptr; } - auto vector_index = make_intrusive(type); - vector_index->Append(type); - auto v = make_intrusive(std::move(vector_index)); + auto v = make_intrusive(type); auto t = make_intrusive(std::move(v)); // this does no estimation if the results is correct! diff --git a/testing/btest/Baseline/bifs.topk/out b/testing/btest/Baseline/bifs.topk/out index 48d7e23f96..52fb41c56d 100644 --- a/testing/btest/Baseline/bifs.topk/out +++ b/testing/btest/Baseline/bifs.topk/out @@ -1,4 +1,4 @@ -[b, c] +[b, c], vector of string 4 0 0 @@ -6,7 +6,7 @@ 0 2 1 -[d, c] +[d, c], vector of string 5 0 0 @@ -14,25 +14,25 @@ 1 3 2 -[d, e] +[d, e], vector of string 6 3 2 3 2 -[f, e] +[f, e], vector of string 7 4 3 3 2 -[f, e] +[f, e], vector of string 8 4 3 4 2 -[g, e] +[g, e], vector of string 9 0 0 @@ -40,7 +40,7 @@ 2 5 4 -[c, e, d] +[c, e, d], vector of string 19 6 0 @@ -48,14 +48,14 @@ 0 4 0 -[c, e] +[c, e], vector of string 6 0 5 0 0 0 -[c, e] +[c, e], vector of string 22 12 0 @@ -63,7 +63,7 @@ 0 0 0 -[c, e] +[c, e], vector of string 19 6 0 @@ -71,7 +71,7 @@ 0 4 0 -[c, e, d] +[c, e, d], vector of string 38 12 0 diff --git a/testing/btest/bifs/topk.zeek b/testing/btest/bifs/topk.zeek index 667107cbc0..9646eaab27 100644 --- a/testing/btest/bifs/topk.zeek +++ b/testing/btest/bifs/topk.zeek @@ -13,7 +13,7 @@ event zeek_init() topk_add(k1, "c"); local s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "a"); print topk_epsilon(k1, "a"); @@ -24,7 +24,7 @@ event zeek_init() topk_add(k1, "d"); s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "b"); print topk_epsilon(k1, "b"); @@ -35,7 +35,7 @@ event zeek_init() topk_add(k1, "e"); s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "d"); print topk_epsilon(k1, "d"); @@ -44,7 +44,7 @@ event zeek_init() topk_add(k1, "f"); s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "f"); print topk_epsilon(k1, "f"); @@ -53,7 +53,7 @@ event zeek_init() topk_add(k1, "e"); s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "f"); print topk_epsilon(k1, "f"); @@ -62,7 +62,7 @@ event zeek_init() topk_add(k1, "g"); s = topk_get_top(k1, 5); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "f"); print topk_epsilon(k1, "f"); @@ -92,7 +92,7 @@ event zeek_init() topk_add(k1, "e"); topk_add(k1, "f"); s = topk_get_top(k1, 3); - print s; + print s, type_name(s); print topk_sum(k1); print topk_count(k1, "c"); print topk_epsilon(k1, "c"); @@ -105,7 +105,7 @@ event zeek_init() topk_merge_prune(k3, k1); s = topk_get_top(k3, 3); - print s; + print s, type_name(s); print topk_count(k3, "c"); print topk_epsilon(k3, "c"); print topk_count(k3, "e"); @@ -116,7 +116,7 @@ event zeek_init() topk_merge_prune(k3, k1); s = topk_get_top(k3, 3); - print s; + print s, type_name(s); print topk_sum(k3); # this gives a warning and a wrong result. print topk_count(k3, "c"); print topk_epsilon(k3, "c"); @@ -127,7 +127,7 @@ event zeek_init() k3 = topk_init(2); topk_merge(k3, k1); - print s; + print s, type_name(s); print topk_sum(k3); print topk_count(k3, "c"); print topk_epsilon(k3, "c"); @@ -139,7 +139,7 @@ event zeek_init() topk_merge(k3, k1); s = topk_get_top(k3, 3); - print s; + print s, type_name(s); print topk_sum(k3); print topk_count(k3, "c"); print topk_epsilon(k3, "c");