当前位置: 首页>>代码示例>>C#>>正文


C# HBaseClient.CreateScannerAsync方法代码示例

本文整理汇总了C#中HBaseClient.CreateScannerAsync方法的典型用法代码示例。如果您正苦于以下问题:C# HBaseClient.CreateScannerAsync方法的具体用法?C# HBaseClient.CreateScannerAsync怎么用?C# HBaseClient.CreateScannerAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HBaseClient的用法示例。


在下文中一共展示了HBaseClient.CreateScannerAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: When_I_Scan_all_I_get_the_expected_results

 public void When_I_Scan_all_I_get_the_expected_results()
 {
     var client = new HBaseClient(_credentials);
     var scan = new Scanner();
     RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
     scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
     ScannerInformation scanInfo = null;
     try
     {
         scanInfo = client.CreateScannerAsync(_tableName, scan, scanOptions).Result;
         List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();
         actualRecords.ShouldContainOnly(_allExpectedRecords);
     }
     finally
     {
         if (scanInfo != null)
         {
             client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
         }
     }
 }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:21,代码来源:FilterTests.cs

示例2: When_I_Scan_with_a_RandomRowFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_RandomRowFilter_I_get_the_expected_results()
        {
            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();

            // set this large enough so that we get all records back
            var filter = new RandomRowFilter(2000.0F);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(_allExpectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:26,代码来源:FilterTests.cs

示例3: When_I_Scan_with_a_PrefixFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_PrefixFilter_I_get_the_expected_results()
        {
            FilterTestRecord example = _allExpectedRecords.First();
            byte[] rawRowkey = Encoding.UTF8.GetBytes(example.RowKey);

            const int prefixLength = 4;
            var prefix = new byte[prefixLength];
            Array.Copy(rawRowkey, prefix, prefixLength);

            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords
                let rawKey = Encoding.UTF8.GetBytes(r.RowKey)
                where rawKey[0] == prefix[0] && rawKey[1] == prefix[1] && rawKey[2] == prefix[2] && rawKey[3] == prefix[3]
                select r).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new PrefixFilter(prefix);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:36,代码来源:FilterTests.cs

示例4: When_I_Scan_with_a_MultipleColumnPrefixFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_MultipleColumnPrefixFilter_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords select r.WithLineNumberValue(0)).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();

            // set this large enough so that we get all records back
            var prefixes = new List<byte[]> { Encoding.UTF8.GetBytes(ColumnNameA), Encoding.UTF8.GetBytes(ColumnNameB) };
            var filter = new MultipleColumnPrefixFilter(prefixes);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:29,代码来源:FilterTests.cs

示例5: When_I_Scan_with_a_PageFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_PageFilter_I_get_the_expected_results()
        {
            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new PageFilter(2);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.Count.ShouldBeGreaterThanOrEqualTo(2);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:24,代码来源:FilterTests.cs

示例6: When_I_Scan_with_a_ColumnCountGetFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_ColumnCountGetFilter_I_get_the_expected_results()
        {
            // B column should not be returned, so set the value to null.
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords select r.WithBValue(null)).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new ColumnCountGetFilter(2);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:27,代码来源:FilterTests.cs

示例7: StartListening

        public bool StartListening()
        {
            Background = Task.Run(async () =>
            {
                while (true)
                {
     
                    var clusterURL = ConfigurationManager.AppSettings["ClusterUrl"];
                    var hadoopUsername = ConfigurationManager.AppSettings["Username"];
                    var hadoopUserPassword = ConfigurationManager.AppSettings["Password"];

                    var hbaseTableName =ConfigurationManager.AppSettings["TableName"];

                    // Create a new instance of an HBase client.
                    var creds = new ClusterCredentials(new Uri(clusterURL), hadoopUsername, hadoopUserPassword);
                    var hbaseClient = new HBaseClient(creds);

                    //Scan over rows in a table. Assume the table has integer keys and you want data between keys 25 and 35. 
                    var scanSettings = new Scanner()
                    {
                        batch = 10
                    };

                    var scannerInfo = await hbaseClient.CreateScannerAsync(hbaseTableName, scanSettings);
                    CellSet next = null;

                    var res = new List<HBaseEntry>();
                    var rowNum = 0;
                    while ((next = hbaseClient.ScannerGetNext(scannerInfo)) != null)
                    {
                        res.AddRange(from row in next.rows
                            let key = Encoding.UTF8.GetString(row.key)
                            let value = Encoding.UTF8.GetString(row.values[0].data)
                            let parts = key.Split(',')
                            where parts.Length == 3
                            select new HBaseEntry()
                            {
                                Type = parts[0], Date = parts[1].Replace("0000000", "000"), RoomNumber = parts[2], Reading = value
                            });

                    }

                    var dateRangedList =
                        res.Where(a => DateTime.Parse(a.Date) >= DateTime.UtcNow.AddDays(-5)).Select(a => a).ToList();

                    var map = new Dictionary<String, Dictionary<String, Dictionary<String, String>>> ();
                    var tempList = dateRangedList.Where(a => a.Type == "Temperature").ToList();
                    var engyList = dateRangedList.Where(a => a.Type == "Energy").ToList();
                    var humList = dateRangedList.Where(a => a.Type == "Humidity").ToList();
                    var lghtList = dateRangedList.Where(a => a.Type == "Light").ToList();

                    map.Add("Temperature", GetDataAsMap(tempList));
                    map.Add("Energy", GetDataAsMap(engyList));
                    map.Add("Humidity", GetDataAsMap(humList));
                    map.Add("Light", GetDataAsMap(lghtList));

                    //get data
                    var ctx = GlobalHost.ConnectionManager.GetHubContext<DashHub>();

                    ctx.Clients.All.acceptData(JsonConvert.SerializeObject(map));
                    Thread.Sleep(15000);
                }
            });
            Background.Wait();

            return true;
        }
开发者ID:Rodrigossz,项目名称:CloudDataCamp,代码行数:67,代码来源:DashHub.cs

示例8: HBaseClient

        public void When_I_Scan_with_a_DependentColumnFilter_and_a_BinaryComparator_with_the_operator_equal_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.LineNumber == 1 select r).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new DependentColumnFilter(
                Encoding.UTF8.GetBytes(ColumnFamilyName1),
                Encoding.UTF8.GetBytes(LineNumberColumnName),
                false,
                CompareFilter.CompareOp.Equal,
                new BinaryComparator(BitConverter.GetBytes(1)));
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:31,代码来源:FilterTests.cs

示例9: When_I_Scan_with_a_FilterList_with_OR_logic_I_get_the_expected_results

        public void When_I_Scan_with_a_FilterList_with_OR_logic_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.LineNumber <= 2 select r).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();

            Filter f0 = new SingleColumnValueFilter(
                Encoding.UTF8.GetBytes(ColumnFamilyName1),
                Encoding.UTF8.GetBytes(LineNumberColumnName),
                CompareFilter.CompareOp.Equal,
                BitConverter.GetBytes(1));

            Filter f1 = new SingleColumnValueFilter(
                Encoding.UTF8.GetBytes(ColumnFamilyName1),
                Encoding.UTF8.GetBytes(LineNumberColumnName),
                CompareFilter.CompareOp.LessThanOrEqualTo,
                BitConverter.GetBytes(2));

            var filter = new FilterList(FilterList.Operator.MustPassOne, f0, f1);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:39,代码来源:FilterTests.cs

示例10: When_I_Scan_with_a_WhileMatchFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_WhileMatchFilter_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.LineNumber == 0 select r.WithBValue(null)).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new WhileMatchFilter(new ValueFilter(CompareFilter.CompareOp.NotEqual, new BinaryComparator(BitConverter.GetBytes(0))));
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:26,代码来源:FilterTests.cs

示例11: When_I_Scan_with_a_ColumnRangeFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_ColumnRangeFilter_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords select r.WithLineNumberValue(0).WithBValue(null)).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new ColumnRangeFilter(Encoding.UTF8.GetBytes(ColumnNameA), true, Encoding.UTF8.GetBytes(ColumnNameB), false);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:26,代码来源:FilterTests.cs

示例12: When_I_Scan_with_a_ValueFilter_and_a_RegexStringComparator_I_get_the_expected_results

        public void When_I_Scan_with_a_ValueFilter_and_a_RegexStringComparator_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = _allExpectedRecords;
            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new ValueFilter(CompareFilter.CompareOp.Equal, new RegexStringComparator(".*"));
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:25,代码来源:FilterTests.cs

示例13: When_I_Scan_with_a_TimestampsFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_TimestampsFilter_I_get_the_expected_results()
        {
            List<FilterTestRecord> expectedRecords = _allExpectedRecords;

            // scan all and retrieve timestamps
            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanAll = null;
            List<long> timestamps = null;
            try
            {
                scanAll = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                timestamps = RetrieveTimestamps(scanAll, scanOptions).ToList();
            }
            finally
            {
                if (scanAll != null)
                {
                    client.DeleteScannerAsync(_tableName, scanAll, scanOptions).Wait();
                }
            }

            Assert.IsNotNull(timestamps);

            // timestamps scan
            scanner = new Scanner();
            var filter = new TimestampsFilter(timestamps);
            scanner.filter = filter.ToEncodedString();
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:46,代码来源:FilterTests.cs

示例14: When_I_Scan_with_a_RowFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_RowFilter_I_get_the_expected_results()
        {
            FilterTestRecord example = _allExpectedRecords.First();

            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.RowKey == example.RowKey select r).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new RowFilter(CompareFilter.CompareOp.Equal, new BinaryComparator(Encoding.UTF8.GetBytes(example.RowKey)));
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:28,代码来源:FilterTests.cs

示例15: When_I_Scan_with_a_InclusiveStopFilter_I_get_the_expected_results

        public void When_I_Scan_with_a_InclusiveStopFilter_I_get_the_expected_results()
        {
            FilterTestRecord example = (from r in _allExpectedRecords where r.LineNumber == 2 select r).Single();
            byte[] rawRowKey = Encoding.UTF8.GetBytes(example.RowKey);

            List<FilterTestRecord> expectedRecords = (from r in _allExpectedRecords where r.LineNumber <= 2 select r).ToList();

            var client = new HBaseClient(_credentials);
            var scanner = new Scanner();
            var filter = new InclusiveStopFilter(rawRowKey);
            scanner.filter = filter.ToEncodedString();
            RequestOptions scanOptions = RequestOptions.GetDefaultOptions();
            scanOptions.AlternativeEndpoint = Constants.RestEndpointBaseZero;
            ScannerInformation scanInfo = null;
            try
            {
                scanInfo = client.CreateScannerAsync(_tableName, scanner, scanOptions).Result;
                List<FilterTestRecord> actualRecords = RetrieveResults(scanInfo, scanOptions).ToList();

                actualRecords.ShouldContainOnly(expectedRecords);
            }
            finally
            {
                if (scanInfo != null)
                {
                    client.DeleteScannerAsync(_tableName, scanInfo, scanOptions).Wait();
                }
            }
        }
开发者ID:hdinsight,项目名称:hbase-sdk-for-net,代码行数:29,代码来源:FilterTests.cs


注:本文中的HBaseClient.CreateScannerAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。