Exemple #1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TRowSet struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(START_ROW_OFFSET_FIELD_DESC);
      oprot.writeI64(struct.startRowOffset);
      oprot.writeFieldEnd();
      if (struct.rows != null) {
        oprot.writeFieldBegin(ROWS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.rows.size()));
          for (TRow _iter124 : struct.rows) {
            _iter124.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.columns != null) {
        if (struct.isSetColumns()) {
          oprot.writeFieldBegin(COLUMNS_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.STRUCT, struct.columns.size()));
            for (TColumn _iter125 : struct.columns) {
              _iter125.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.binaryColumns != null) {
        if (struct.isSetBinaryColumns()) {
          oprot.writeFieldBegin(BINARY_COLUMNS_FIELD_DESC);
          oprot.writeBinary(struct.binaryColumns);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetColumnCount()) {
        oprot.writeFieldBegin(COLUMN_COUNT_FIELD_DESC);
        oprot.writeI32(struct.columnCount);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Exemple #2
0
 public void read(org.apache.thrift.protocol.TProtocol iprot, TRowSet struct)
     throws org.apache.thrift.TException {
   org.apache.thrift.protocol.TField schemeField;
   iprot.readStructBegin();
   while (true) {
     schemeField = iprot.readFieldBegin();
     if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
       break;
     }
     switch (schemeField.id) {
       case 1: // START_ROW_OFFSET
         if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
           struct.startRowOffset = iprot.readI64();
           struct.setStartRowOffsetIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 2: // ROWS
         if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
           {
             org.apache.thrift.protocol.TList _list118 = iprot.readListBegin();
             struct.rows = new ArrayList<TRow>(_list118.size);
             TRow _elem119;
             for (int _i120 = 0; _i120 < _list118.size; ++_i120) {
               _elem119 = new TRow();
               _elem119.read(iprot);
               struct.rows.add(_elem119);
             }
             iprot.readListEnd();
           }
           struct.setRowsIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 3: // COLUMNS
         if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
           {
             org.apache.thrift.protocol.TList _list121 = iprot.readListBegin();
             struct.columns = new ArrayList<TColumn>(_list121.size);
             TColumn _elem122;
             for (int _i123 = 0; _i123 < _list121.size; ++_i123) {
               _elem122 = new TColumn();
               _elem122.read(iprot);
               struct.columns.add(_elem122);
             }
             iprot.readListEnd();
           }
           struct.setColumnsIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 4: // BINARY_COLUMNS
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.binaryColumns = iprot.readBinary();
           struct.setBinaryColumnsIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 5: // COLUMN_COUNT
         if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
           struct.columnCount = iprot.readI32();
           struct.setColumnCountIsSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       default:
         org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
     }
     iprot.readFieldEnd();
   }
   iprot.readStructEnd();
   struct.validate();
 }