StrToBytes() public static method

public static StrToBytes ( string str ) : byte[]
str string
return byte[]
コード例 #1
0
ファイル: HClient.cs プロジェクト: ahweb/CS4Hadoop
        public static void BatAddData()
        {
            var transport = new TBufferedTransport(new TSocket("master", 9090));


            transport.Open();


            var protocol = new TBinaryProtocol(transport);

            var client = new Apache.Hadoop.Hbase.Hbase.Client(protocol);

            //client.createTable(Unitl.StrToBytes(tablename), new List<ColumnDescriptor> { new ColumnDescriptor { Name = Unitl.StrToBytes("zbw911"), InMemory = false } });

            var bytevalue = Unitl.StrToBytes(Longdata);

            for (var j = 0; j < 100000; j++)
            {
                //var j = 0;
                for (var i = 0; i < 1000; i++)
                {
                    client.mutateRow(Unitl.StrToBytes("1"), Unitl.StrToBytes("" + i + "___" + j), new List <Mutation> {
                        new Mutation {
                            Column = Unitl.StrToBytes("zbw911"), Value = bytevalue
                        }
                    });
                }

                Console.WriteLine(j + "批=" + 1000 * j);
            }


            transport.Close();
        }
コード例 #2
0
ファイル: HClient.cs プロジェクト: ahweb/CS4Hadoop
        public static void AddColumn()
        {
            var transport = new TBufferedTransport(new TSocket("master", 9090));


            transport.Open();


            var protocol = new TBinaryProtocol(transport);

            var client = new Apache.Hadoop.Hbase.Hbase.Client(protocol);


            //client.createTable(Unitl.StrToBytes("t"), new List<ColumnDescriptor> { new ColumnDescriptor { Name = Unitl.StrToBytes("default"), InMemory = false } });
            //client.createTable(Unitl.StrToBytes("thetable"), new List<ColumnDescriptor> { new ColumnDescriptor { Name = Unitl.StrToBytes("default"), InMemory = false } });

            for (var i = 0; i < 10; i++)
            {
                client.mutateRow(Unitl.StrToBytes("t"),

                                 Unitl.StrToBytes("key"),
                                 new List <Mutation> {
                    new Mutation {
                        Column = Unitl.StrToBytes("default:" + i), Value = Unitl.StrToBytes(System.DateTime.Now.ToString())
                    }
                });
            }
            transport.Close();
        }
コード例 #3
0
ファイル: HClient.cs プロジェクト: ahweb/CS4Hadoop
        public static void Scan()
        {
            var transport = new TBufferedTransport(new TSocket("master", 9090));


            transport.Open();


            var protocol = new TBinaryProtocol(transport);

            var client = new Apache.Hadoop.Hbase.Hbase.Client(protocol);

            var scanid = client.scannerOpenWithStop(Unitl.StrToBytes("t1"), Unitl.StrToBytes("rowno"), Unitl.StrToBytes("rowno"),
                                                    new List <byte[]> {
                Unitl.StrToBytes("f1:99913")
            });

            var result = client.scannerGet(scanid);

            var colum = client.getColumnDescriptors("t1".ToBytes());

            var rows = client.getRowsWithColumns("t1".ToBytes()
                                                 , new List <byte[]> {
                "rowno".ToBytes()
            }
                                                 , new List <byte[]> {
                "f1:9".ToBytes(), "f1:9999".ToBytes()
            });


            //scanid = client.scannerOpenWithPrefix("".ToBytes(), "".ToBytes(), new List<byte[]> { });

            var v = client.getVer("table".ToBytes(), "row".ToBytes(), "col".ToBytes(), 1000);

            foreach (var xx in v)
            {
            }



            foreach (var r in result)
            {
                Console.WriteLine(r.Columns[Unitl.StrToBytes("f1:99913")].Value);
            }

            client.scannerClose(scanid);

            transport.Close();
        }
コード例 #4
0
ファイル: HClient.cs プロジェクト: ahweb/CS4Hadoop
        public static void GetData()
        {
            var transport = new TBufferedTransport(new TSocket("master", 9090));


            transport.Open();


            var protocol = new TBinaryProtocol(transport);

            var client = new Apache.Hadoop.Hbase.Hbase.Client(protocol);

            var rows = client.getRow(Unitl.StrToBytes("1"), Unitl.StrToBytes("row9916"));

            foreach (var row in rows)
            {
                Console.WriteLine(row.Columns.ToString());
            }

            transport.Close();
        }
コード例 #5
0
ファイル: HClient.cs プロジェクト: ahweb/CS4Hadoop
        public static void AddData(string row)
        {
            var transport = new TBufferedTransport(new TSocket("master", 9090));


            transport.Open();


            var protocol = new TBinaryProtocol(transport);

            var client = new Apache.Hadoop.Hbase.Hbase.Client(protocol);


            //client.createTable(Unitl.StrToBytes(tablename), new List<ColumnDescriptor> { new ColumnDescriptor { Name = Unitl.StrToBytes("zbw911"), InMemory = false } });

            client.mutateRow(Unitl.StrToBytes("1"), Unitl.StrToBytes(row), new List <Mutation> {
                new Mutation {
                    Column = Unitl.StrToBytes("zbw911"), Value = Unitl.StrToBytes("zbw911")
                }
            });

            transport.Close();
        }