private void Union(Key key) { List <Value.HLLValue> hlls = new List <Value.HLLValue>(); hlls.Add(hll1); hlls.Add(hll2); hlls.Add(hll3); policy.filterExp = Exp.Build( Exp.NE( HLLExp.GetCount(HLLExp.GetUnion(Exp.Val(hlls), Exp.HLLBin(bin1))), HLLExp.GetUnionCount(Exp.Val(hlls), Exp.HLLBin(bin1)))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.EQ( HLLExp.GetCount(HLLExp.GetUnion(Exp.Val(hlls), Exp.HLLBin(bin1))), HLLExp.GetUnionCount(Exp.Val(hlls), Exp.HLLBin(bin1)))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Count(Key key) { policy.filterExp = Exp.Build(Exp.EQ(HLLExp.GetCount(Exp.HLLBin(bin1)), Exp.Val(0))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build(Exp.GT(HLLExp.GetCount(Exp.HLLBin(bin1)), Exp.Val(0))); r = client.Get(policy, key); AssertRecordFound(key, r); }
private void Add(Key key) { List <Value> values = new List <Value>(); values.Add(Value.Get("new_val")); policy.filterExp = Exp.Build( Exp.EQ( HLLExp.GetCount(Exp.HLLBin(bin1)), HLLExp.GetCount(HLLExp.Add(HLLPolicy.Default, Exp.Val(values), Exp.HLLBin(bin2))))); Record r = client.Get(policy, key); Assert.AreEqual(null, r); policy.filterExp = Exp.Build( Exp.LT( HLLExp.GetCount(Exp.HLLBin(bin1)), HLLExp.GetCount(HLLExp.Add(HLLPolicy.Default, Exp.Val(values), Exp.HLLBin(bin2))))); r = client.Get(policy, key); AssertRecordFound(key, r); }