Package org.apache.thrift.protocol

Examples of org.apache.thrift.protocol.TSet


                    }
                    break;
                case 4: // STR_SET
                    if(field.type == TType.SET) {
                        {
                            TSet _set11 = iprot.readSetBegin();
                            this.strSet = new HashSet<String>(2 * _set11.size);
                            for(int _i12 = 0; _i12 < _set11.size; ++_i12) {
                                String _elem13;
                                _elem13 = iprot.readString();
                                this.strSet.add(_elem13);
View Full Code Here


            oprot.writeFieldEnd();
        }
        if(this.strSet != null) {
            oprot.writeFieldBegin(STR_SET_FIELD_DESC);
            {
                oprot.writeSetBegin(new TSet(TType.STRING, this.strSet.size()));
                for(String _iter17: this.strSet) {
                    oprot.writeString(_iter17);
                }
                oprot.writeSetEnd();
            }
View Full Code Here

   * calling this method again.
   */
  @Override
  public TSet readSetBegin() throws TException {
    stackLevel++;
    set = new TSet(ORDERED_TYPE, readI32());
    if (set.size == 0 && lastPrimitiveWasNull()) {
      return null;
    }
    return set;
  }
View Full Code Here

  }

  @Override
  public TSet readSetBegin() throws TException {
    assert (!inner);
    TSet set = new TSet();
    if (columns[index] == null || columns[index].equals(nullString)) {
      index++;
      if (returnNulls) {
        return null;
      }
    } else if (columns[index].isEmpty()) {
      index++;
    } else {
      fields = secondaryPattern.split(columns[index++]);
      set = new TSet(ORDERED_TYPE, fields.length);
    }
    inner = true;
    innerIndex = 0;
    return set;
  }
View Full Code Here

    }

    public <E> Set<E> readSet(ThriftCodec<E> elementCodec)
            throws Exception
    {
        TSet tSet = protocol.readSetBegin();
        Set<E> set = new HashSet<>();
        for (int i = 0; i < tSet.size; i++) {
            try {
                E element = elementCodec.read(protocol);
                set.add(element);
View Full Code Here

    {
        if (set == null) {
            return;
        }

        protocol.writeSetBegin(new TSet(elementCodec.getType().getProtocolType().getType(), set.size()));

        for (T element : set) {
            elementCodec.write(element, protocol);
        }
View Full Code Here

  }

  @Override
  public TSet readSetBegin() throws TException {
    assert (!inner);
    TSet set = new TSet();
    if (columns[index] == null || columns[index].equals(nullString)) {
      index++;
      if (returnNulls) {
        return null;
      }
    } else if (columns[index].isEmpty()) {
      index++;
    } else {
      fields = secondaryPattern.split(columns[index++]);
      set = new TSet(ORDERED_TYPE, fields.length);
    }
    inner = true;
    innerIndex = 0;
    return set;
  }
View Full Code Here

   * NOTE: Set is not supported by Hive yet.
   */
  @Override
  public Object deserialize(Object reuse, TProtocol iprot)
      throws SerDeException, TException, IllegalAccessException {
    TSet theset = iprot.readSetBegin();
    if (theset == null) {
      return null;
    }
    Set<Object> result;
    if (reuse != null) {
View Full Code Here

    ListObjectInspector loi = (ListObjectInspector) oi;

    Set<Object> set = (Set<Object>) o;
    DynamicSerDeTypeBase mt = getElementType();
    tset = new TSet(mt.getType(), set.size());
    oprot.writeSetBegin(tset);
    for (Object element : set) {
      mt.serialize(element, loi.getListElementObjectInspector(), oprot);
    }
    // in theory, the below call isn't needed in non thrift_mode, but let's not
View Full Code Here

   * calling this method again.
   */
  @Override
  public TSet readSetBegin() throws TException {
    stackLevel++;
    set = new TSet(ORDERED_TYPE, readI32());
    if (set.size == 0 && lastPrimitiveWasNull()) {
      return null;
    }
    return set;
  }
View Full Code Here

TOP

Related Classes of org.apache.thrift.protocol.TSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.