Esempio n. 1
0
        public static CountMinSketchState MakeState(CountMinSketchSpec spec)
        {
            CountMinSketchStateHashes hashes = CountMinSketchStateHashes.MakeState(spec.HashesSpec);
            CountMinSketchStateTopk   topk   = null;

            if (spec.TopkSpec != null && spec.TopkSpec > 0)
            {
                topk = new CountMinSketchStateTopk(spec.TopkSpec.Value);
            }
            return(new CountMinSketchState(hashes, topk));
        }
        public void TestFlow()
        {
            // top-k for 3
            var spec  = new CountMinSketchSpec(TestCountMinSketchStateHashes.GetDefaultSpec(), 3, new CountMinSketchAgentStringUTF16());
            var state = CountMinSketchState.MakeState(spec);

            UpdateAssert(state, "a", "a=1");
            UpdateAssert(state, "b", "a=1,b=1");
            UpdateAssert(state, "a", "a=2,b=1");
            UpdateAssert(state, "c", "a=2,b=1,c=1");
            UpdateAssert(state, "d", "a=2,b=1,c=1");
            UpdateAssert(state, "c", "a=2,b=1,c=2");
            UpdateAssert(state, "a", "a=3,b=1,c=2");
            UpdateAssert(state, "d", "a=3,d=2,c=2");
            UpdateAssert(state, "e", "a=3,d=2,c=2");
            UpdateAssert(state, "e", "a=3,d=2,c=2");
            UpdateAssert(state, "e", "a=3,e=3,c=2");
            UpdateAssert(state, "d", "a=3,e=3,d=3");
            UpdateAssert(state, "c", "a=3,e=3,d=3");
            UpdateAssert(state, "c", "a=3,e=3,c=4");
        }
Esempio n. 3
0
 public CountMinSketchAggStateFactory(ExprAggCountMinSketchNode parent, CountMinSketchSpec specification)
 {
     Parent        = parent;
     Specification = specification;
 }