520lailai opened a new issue, #356:
URL: https://github.com/apache/datasketches-cpp/issues/356
I compared the datasketches-java and datasketches-cpp, found that the
different behavior of JAVA and C++.
refer to the code below:
datasketches::update_theta_sketch update_sketch1 =
datasketches::update_theta_sketch::builder().set_lg_k(14).build();
for(int i = 0; i < 16384; i++) update_sketch1.update(i);
datasketches::update_theta_sketch update_sketch2 =
datasketches::update_theta_sketch::builder().set_lg_k(14).build();
for(int i = 0; i < 26384; i++) update_sketch2.update(i);
datasketches::update_theta_sketch update_sketch3 =
datasketches::update_theta_sketch::builder().set_lg_k(14).build();
for(int i = 0; i < 86384; i++) update_sketch3.update(i);
datasketches::theta_union sk_union1 =
datasketches::theta_union::builder().set_lg_k(16).build();
sk_union1.update(update_sketch1);
sk_union1.update(update_sketch2);
sk_union1.update(update_sketch3);
std::cout <<"test2: result1: " << sk_union1.get_result().get_estimate()
<< std::endl;
datasketches::theta_union sk_union2 =
datasketches::theta_union::builder().set_lg_k(16).build();
sk_union2.update(update_sketch1);
sk_union2.update(update_sketch3);
sk_union2.update(update_sketch2);
std::cout <<"test2: result2: " << sk_union2.get_result().get_estimate()
<< std::endl;
the result is :
test2: result1: 151281
test2: result2: 126358
There is a big gap between 151281 and 126358, because of different merge
order:
[update_sketch1 -> update_sketch2 -> update_sketch3]
[update_sketch1 -> update_sketch3 -> update_sketch2]
but I using datasketches-java do the same things, I didn't find any problems.
because I set update_sketch's lg_k = 14 and theta_union‘s lg_k = 16, If
the theta_union‘s lg_k > update_sketch's lg_k there will be a problem, but if
theta_union‘s lg_k <= update_sketch's lg_k there will be no problem.
can we fix this problem?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]