Пример #1
0
        public async Task ExecScan()
        {
            var sc = new ScanCall(Program.Table, "", "g")
            {
                // Families = Program.Family,
                // TimeRange = new TimeRange
                // {
                //     From = new DateTime(2018, 1, 1).ToUnixU13(),
                //     To = new DateTime(2019, 1, 2).ToUnixU13()
                // },
                NumberOfRows = 100000,
            };

            using var scanner = _client.Scan(sc);
            var scanResults = new List <Result>();

            while (scanner.CanContinueNext)
            {
                var per = await scanner.Next();

                if (true != per?.Any())
                {
                    continue;
                }
                scanResults.AddRange(per);
            }
            Log.Information($"scan result count:{scanResults.Count}");
        }
Пример #2
0
        public async Task ExecScan()
        {
            var sc = new ScanCall(Program.Table, "", "g")
            {
                // Families = Program.Family,
                // TimeRange = new TimeRange
                // {
                //     From = new DateTime(2018, 1, 1).ToUnixU13(),
                //     To = new DateTime(2019, 1, 2).ToUnixU13()
                // },
                NumberOfRows = 100000,
            };

            using var scanner = _client.Scan(sc);
            var scanResults  = new List <Student>();
            var sth          = Stopwatch.StartNew();
            var convertCache = new ConvertCache().BuildCache <Student>(EndianBitConverter.BigEndian);

            while (scanner.CanContinueNext)
            {
                sth.Restart();
                var per = await scanner.Next();

                var reqSpan = sth.Elapsed;
                if (true != per?.Any())
                {
                    continue;
                }
                sth.Restart();
                var stus = HBaseConvert.Instance.ConvertToCustom <Student>(per, convertCache);
                Debug.WriteLine($"scanner count:{per.Count}, elapesd: {reqSpan}, convert elapesad: {sth.Elapsed}.");
                scanResults.AddRange(stus);
            }

            Log.Information($"scan 'student' count:{scanResults.Count}");
        }