Inheritance: TBase
Exemplo n.º 1
0
        public void HBaseRowDataConvertsFromListOfTRowResult()
        {
            byte[] column = Encoding.UTF8.GetBytes("c");
            byte[] row = Encoding.UTF8.GetBytes("r");

            TCell cell1 = new TCell();
            cell1.Timestamp = 123;
            cell1.Value = Encoding.UTF8.GetBytes("cell1");

            TCell cell2 = new TCell();
            cell2.Timestamp = 1234;
            cell2.Value = Encoding.UTF8.GetBytes("cell2");

            TRowResult rowResult1 = new TRowResult();
            rowResult1.Row = row;
            rowResult1.Columns = new Dictionary<byte[], TCell>();
            rowResult1.Columns.Add(column, cell1);

            TRowResult rowResult2 = new TRowResult();
            rowResult2.Row = row;
            rowResult2.Columns = new Dictionary<byte[], TCell>();
            rowResult2.Columns.Add(column, cell2);

            HBaseRowData rowData = new HBaseRowData(new List<TRowResult>() { rowResult1, rowResult2 });
            Assert.Equal(rowResult1.Row, rowData.Key);
            Assert.Equal(1, rowData.Columns.Count);
            Assert.Equal(2, rowData.Columns[column].Count);
        }
Exemplo n.º 2
0
        public void HBaseCellDataConvertsFromTCell()
        {
            TCell thriftCell = new TCell();
            thriftCell.Timestamp = 123;
            thriftCell.Value = Encoding.UTF8.GetBytes("cell");

            HBaseCellData cellData = new HBaseCellData(thriftCell);

            Assert.Equal(thriftCell.Timestamp, cellData.Timestamp);
            Assert.Equal(thriftCell.Value, cellData.Value);
        }
Exemplo n.º 3
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 0:
                 if (field.Type == TType.List)
                 {
                     {
                         this.Success = new List<TCell>();
                         TList _list30 = iprot.ReadListBegin();
                         for (int _i31 = 0; _i31 < _list30.Count; ++_i31)
                         {
                             var _elem32 = new TCell();
                             _elem32 = new TCell();
                             _elem32.Read(iprot);
                             this.Success.Add(_elem32);
                         }
                         iprot.ReadListEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 1:
                 if (field.Type == TType.Struct)
                 {
                     this.Io = new IOError();
                     this.Io.Read(iprot);
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 4
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
         field = iprot.ReadFieldBegin();
         if (field.Type == TType.Stop)
         {
             break;
         }
         switch (field.ID)
         {
             case 1:
                 if (field.Type == TType.String)
                 {
                     this.Row = iprot.ReadBinary();
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             case 2:
                 if (field.Type == TType.Map)
                 {
                     {
                         this.Columns = new Dictionary<byte[], TCell>();
                         TMap _map4 = iprot.ReadMapBegin();
                         for (int _i5 = 0; _i5 < _map4.Count; ++_i5)
                         {
                             byte[] _key6;
                             TCell _val7;
                             _key6 = iprot.ReadBinary();
                             _val7 = new TCell();
                             _val7.Read(iprot);
                             this.Columns[_key6] = _val7;
                         }
                         iprot.ReadMapEnd();
                     }
                 }
                 else
                 {
                     TProtocolUtil.Skip(iprot, field.Type);
                 }
                 break;
             default:
                 TProtocolUtil.Skip(iprot, field.Type);
                 break;
         }
         iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 5
0
        public void HBaseRowDataConvertsFromTRowResult()
        {
            TCell cell = new TCell();
            cell.Timestamp = 123;
            cell.Value = Encoding.UTF8.GetBytes("cell");

            TRowResult rowResult = new TRowResult();
            rowResult.Row = Encoding.UTF8.GetBytes("r");
            rowResult.Columns = new Dictionary<byte[], TCell>();
            rowResult.Columns.Add(Encoding.UTF8.GetBytes("c"), cell);

            HBaseRowData rowData = new HBaseRowData(rowResult);
            Assert.Equal(rowResult.Row, rowData.Key);
            Assert.Equal(rowResult.Columns.Count, rowData.Columns.Count);
        }
Exemplo n.º 6
0
 public HBaseCellData(TCell cell)
 {
     Timestamp = cell.Timestamp;
     Value = cell.Value;
 }