示例#1
0
        private void RunQuery3(AerospikeClient client, Arguments args, string binName)
        {
            int begin = 20;
            int end   = 30;

            console.Info("Query Predicate: bin3 contains string with 'prefix' and 'suffix'");

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            QueryPolicy policy = new QueryPolicy(client.queryPolicyDefault);

            policy.filterExp = Exp.Build(
                Exp.RegexCompare("prefix.*suffix", RegexFlag.ICASE | RegexFlag.NEWLINE, Exp.StringBin("bin3")));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                while (rs.Next())
                {
                    Record record = rs.Record;
                    console.Info("Record: " + record.ToString());
                }
            }
            finally
            {
                rs.Close();
            }
        }
        private void Get(Key key)
        {
            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)),
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)),
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA)),
                    Exp.Val(new byte[] { 0x03 })));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        private void Similarity(Key key)
        {
            List <Value.HLLValue> hlls2 = new List <Value.HLLValue>();

            hlls2.Add(hll2);

            List <Value.HLLValue> hlls3 = new List <Value.HLLValue>();

            hlls3.Add(hll3);

            policy.filterExp = Exp.Build(
                Exp.GE(
                    HLLExp.GetSimilarity(Exp.Val(hlls2), Exp.HLLBin(bin1)),
                    HLLExp.GetSimilarity(Exp.Val(hlls3), Exp.HLLBin(bin1))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.LE(
                    HLLExp.GetSimilarity(Exp.Val(hlls2), Exp.HLLBin(bin1)),
                    HLLExp.GetSimilarity(Exp.Val(hlls3), Exp.HLLBin(bin1))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        public void QuerySetName()
        {
            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.EQ(Exp.SetName(), Exp.Val(set2)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    count++;
                }
                Assert.AreEqual(3, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryKeyInt()
        {
            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(set3);

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.LT(Exp.Key(Exp.Type.INT), Exp.Val(35)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //System.out.println(rs.getKey().toString() + " - " + rs.getRecord().toString());
                    count++;
                }
                Assert.AreEqual(4, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryVoidTime()
        {
            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(set1);


            DateTime now = DateTime.UtcNow;
            DateTime end = now.Add(TimeSpan.FromMinutes(2));

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(
                Exp.And(
                    Exp.GE(Exp.VoidTime(), Exp.Val(now)),
                    Exp.LT(Exp.VoidTime(), Exp.Val(end))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    count++;
                }
                Assert.AreEqual(2, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryMemorySize()
        {
            int begin = 1;
            int end   = 10;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // storage-engine could be memory for which MemorySize() returns zero.
            // This just tests that the expression was sent correctly
            // because all memory sizes are effectively allowed.
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.GE(Exp.MemorySize(), Exp.Val(0)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    count++;
                }
                Assert.AreEqual(10, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryKeyString()
        {
            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(set3);

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.RegexCompare("^key-.*-35$", 0, Exp.Key(Exp.Type.STRING)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    count++;
                }
                Assert.AreEqual(1, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryBinType()
        {
            int begin = 1;
            int end   = 10;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.EQ(Exp.BinType("listbin"), Exp.Val(ParticleType.LIST)));

            RecordSet rs = client.Query(policy, stmt);

            try {
                int count = 0;

                while (rs.Next())
                {
                    count++;
                }
                Assert.AreEqual(9, count);
            }
            finally {
                rs.Close();
            }
        }
        public void QueryDigestModulo()
        {
            int begin = 1;
            int end   = 10;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // Record key digest % 3 == 1
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.EQ(Exp.DigestModulo(3), Exp.Val(1)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.ToString());
                    count++;
                }
                Assert.AreEqual(4, count);
            }
            finally
            {
                rs.Close();
            }
        }
        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);
        }
示例#12
0
        public void QueryGeo1()
        {
            string region = "{ \"type\": \"Point\", \"coordinates\": [ -122.0986857, 37.4214209 ] }";

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setNameRegions);

            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(Exp.GeoCompare(Exp.GeoBin("loc"), Exp.Geo(region)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //System.out.println(rs.getRecord().toString());
                    count++;
                }
                Assert.AreEqual(5, count);
            }
            finally
            {
                rs.Close();
            }
        }
        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 MayContain(Key key)
        {
            List <Value> values = new List <Value>();

            values.Add(Value.Get("new_val"));

            policy.filterExp = Exp.Build(Exp.EQ(HLLExp.MayContain(Exp.Val(values), Exp.HLLBin(bin2)), Exp.Val(1)));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(Exp.NE(HLLExp.MayContain(Exp.Val(values), Exp.HLLBin(bin2)), Exp.Val(1)));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
示例#15
0
        public void Initialize()
        {
            predAEq1BPolicy = new BatchPolicy();
            predAEq1RPolicy = new Policy();
            predAEq1WPolicy = new WritePolicy();

            Expression filter = Exp.Build(Exp.EQ(Exp.IntBin(binAName), Exp.Val(1)));

            predAEq1BPolicy.filterExp = filter;
            predAEq1RPolicy.filterExp = filter;
            predAEq1WPolicy.filterExp = filter;

            client.Delete(null, keyA);
            client.Delete(null, keyB);

            client.Put(null, keyA, binA1);
            client.Put(null, keyB, binA2);
        }
        public void QueryMap6()
        {
            int begin = 1;
            int end   = 10;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // Map bin contains keys "A" and "C".
            QueryPolicy policy = new QueryPolicy();

            List <string> list = new List <string>();

            list.Add("A");
            list.Add("C");

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    ListExp.Size(                     // return type VALUE returns a list
                        MapExp.GetByKeyList(MapReturnType.VALUE, Exp.Val(list), Exp.MapBin("mapbin"))),
                    Exp.Val(2)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.ToString());
                    count++;
                }
                Assert.AreEqual(1, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryAndOr()
        {
            int begin = 10;
            int end   = 45;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // ((bin2 > 40 && bin2 < 44) || bin2 == 22 || bin2 == 9) && (binName == bin2)
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(
                Exp.And(
                    Exp.Or(
                        Exp.And(
                            Exp.GT(Exp.IntBin("bin2"), Exp.Val(40)),
                            Exp.LT(Exp.IntBin("bin2"), Exp.Val(44))),
                        Exp.EQ(Exp.IntBin("bin2"), Exp.Val(22)),
                        Exp.EQ(Exp.IntBin("bin2"), Exp.Val(9))),
                    Exp.EQ(Exp.IntBin(binName), Exp.IntBin("bin2"))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.GetValue(binName));
                    count++;
                }
                // 22, 41, 42, 43
                Assert.AreEqual(4, count);
            }
            finally
            {
                rs.Close();
            }
        }
        private void GetInt(Key key)
        {
            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.GetInt(Exp.Val(32), Exp.Val(8), true, Exp.BlobBin(binA)),
                    Exp.Val(0x05)));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.GetInt(Exp.Val(32), Exp.Val(8), true, Exp.BlobBin(binA)),
                    Exp.Val(0x05)));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
示例#19
0
        private void RunQuery1(AerospikeClient client, Arguments args, string binName)
        {
            int begin = 10;
            int end   = 40;

            console.Info("Query Predicate: (bin2 > 126 && bin2 <= 140) || (bin2 = 360)");

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);

            // Filter applied on query itself.  Filter can only reference an indexed bin.
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // Predicates are applied on query results on server side.
            // Predicates can reference any bin.
            QueryPolicy policy = new QueryPolicy(client.queryPolicyDefault);

            policy.filterExp = Exp.Build(
                Exp.Or(
                    Exp.And(
                        Exp.GT(Exp.IntBin("bin2"), Exp.Val(126)),
                        Exp.LE(Exp.IntBin("bin2"), Exp.Val(140))),
                    Exp.EQ(Exp.IntBin("bin2"), Exp.Val(360))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                while (rs.Next())
                {
                    Record record = rs.Record;
                    console.Info("Record: " + record.ToString());
                }
            }
            finally
            {
                rs.Close();
            }
        }
        private void SetInt(Key key)
        {
            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.Get(Exp.Val(24), Exp.Val(8),
                               BitExp.SetInt(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(0x42), Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(8), Exp.Val(8), Exp.BlobBin(binA))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Get(Exp.Val(24), Exp.Val(8),
                               BitExp.SetInt(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(0x42), Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(8), Exp.Val(8), Exp.BlobBin(binA))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        private void Subtract(Key key)
        {
            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.Get(Exp.Val(24), Exp.Val(8),
                               BitExp.Subtract(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(1), false, BitOverflowAction.FAIL, Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Get(Exp.Val(24), Exp.Val(8),
                               BitExp.Subtract(BitPolicy.Default, Exp.Val(24), Exp.Val(8), Exp.Val(1), false, BitOverflowAction.FAIL, Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(16), Exp.Val(8), Exp.BlobBin(binA))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        private void Resize(Key key)
        {
            Exp size = Exp.Val(6);

            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)),
                    BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA)),
                    BitExp.Resize(BitPolicy.Default, size, 0, Exp.BlobBin(binA))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        private void Describe(Key key)
        {
            Exp index = Exp.Val(0);

            policy.filterExp = Exp.Build(
                Exp.NE(
                    ListExp.GetByIndex(ListReturnType.VALUE, Exp.Type.INT, index, HLLExp.Describe(Exp.HLLBin(bin1))),
                    ListExp.GetByIndex(ListReturnType.VALUE, Exp.Type.INT, index, HLLExp.Describe(Exp.HLLBin(bin2)))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    ListExp.GetByIndex(ListReturnType.VALUE, Exp.Type.INT, index, HLLExp.Describe(Exp.HLLBin(bin1))),
                    ListExp.GetByIndex(ListReturnType.VALUE, Exp.Type.INT, index, HLLExp.Describe(Exp.HLLBin(bin2)))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        public void QueryLastUpdate()
        {
            int begin = 10;
            int end   = 45;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // record last update time > (currentTimeMillis() * 1000000L + 100)
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(
                Exp.GT(
                    Exp.LastUpdate(),
                    Exp.Val(DateTime.UtcNow.Add(TimeSpan.FromSeconds(1.0)))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                //int count = 0;

                while (rs.Next())
                {
                    //Record record = rs.Record;
                    //Console.WriteLine(record.GetValue(binName).ToString() + ' ' + record.expiration);
                    //count++;
                }
                // Do not asset count since some tests can run after this one.
                //Assert.AreEqual(0, count);
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryNot()
        {
            int begin = 10;
            int end   = 45;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // ! (bin2 >= 15 && bin2 <= 42)
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(
                Exp.Not(
                    Exp.And(
                        Exp.GE(Exp.IntBin("bin2"), Exp.Val(15)),
                        Exp.LE(Exp.IntBin("bin2"), Exp.Val(42)))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.GetValue(binName));
                    count++;
                }
                // 10, 11, 12, 13, 43, 44, 45
                Assert.AreEqual(8, count);
            }
            finally
            {
                rs.Close();
            }
        }
        private void And(Key key)
        {
            byte[] bytes = new byte[] { (byte)0x01 };

            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.Get(Exp.Val(0), Exp.Val(8),
                               BitExp.And(BitPolicy.Default, Exp.Val(16), Exp.Val(8), Exp.Val(bytes), Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(0), Exp.Val(8), Exp.BlobBin(binA))));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.Get(Exp.Val(0), Exp.Val(8),
                               BitExp.And(BitPolicy.Default, Exp.Val(16), Exp.Val(8), Exp.Val(bytes), Exp.BlobBin(binA))),
                    BitExp.Get(Exp.Val(0), Exp.Val(8), Exp.BlobBin(binA))));

            r = client.Get(policy, key);
            AssertRecordFound(key, r);
        }
        private void Remove(Key key)
        {
            int expected = 0x42;

            policy.filterExp = Exp.Build(
                Exp.NE(
                    BitExp.GetInt(Exp.Val(0), Exp.Val(8), false,
                                  BitExp.Remove(BitPolicy.Default, Exp.Val(0), Exp.Val(1), Exp.BlobBin(binA))),
                    Exp.Val(expected)));

            Record r = client.Get(policy, key);

            Assert.AreEqual(null, r);

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    BitExp.GetInt(Exp.Val(0), Exp.Val(8), false,
                                  BitExp.Remove(BitPolicy.Default, Exp.Val(0), Exp.Val(1), Exp.BlobBin(binA))),
                    Exp.Val(expected)));

            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);
        }
示例#29
0
        private void RunQuery2(AerospikeClient client, Arguments args, string binName)
        {
            int begin = 10;
            int end   = 40;

            console.Info("Query Predicate: Record updated in 2020");
            DateTime beginTime = new DateTime(2020, 1, 1);
            DateTime endTime   = new DateTime(2021, 1, 1);

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(args.set);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            QueryPolicy policy = new QueryPolicy(client.queryPolicyDefault);

            policy.filterExp = Exp.Build(
                Exp.And(
                    Exp.GE(Exp.LastUpdate(), Exp.Val(beginTime)),
                    Exp.LT(Exp.LastUpdate(), Exp.Val(endTime))));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                while (rs.Next())
                {
                    Record record = rs.Record;
                    console.Info("Record: " + record.ToString());
                }
            }
            finally
            {
                rs.Close();
            }
        }
        public void QueryMap4()
        {
            int begin = 1;
            int end   = 10;

            Statement stmt = new Statement();

            stmt.SetNamespace(args.ns);
            stmt.SetSetName(setName);
            stmt.SetFilter(Filter.Range(binName, begin, end));

            // Map bin does not contains value "AAA"
            QueryPolicy policy = new QueryPolicy();

            policy.filterExp = Exp.Build(
                Exp.EQ(
                    MapExp.GetByValue(MapReturnType.COUNT, Exp.Val("AAA"), Exp.MapBin("mapbin")),
                    Exp.Val(0)));

            RecordSet rs = client.Query(policy, stmt);

            try
            {
                int count = 0;

                while (rs.Next())
                {
                    //Console.WriteLine(rs.Record.ToString());
                    count++;
                }
                Assert.AreEqual(7, count);
            }
            finally
            {
                rs.Close();
            }
        }