field = new TField(mt.name, mt.getType(), (short) mt.fieldid); oprot.writeFieldBegin(field);
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }
field = new TField(mt.name, mt.getType(), (short) mt.fieldid); oprot.writeFieldBegin(field);
field = new TField(mt.name, mt.getType(), (short) mt.fieldid); oprot.writeFieldBegin(field);
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { 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 // get too crazy oprot.writeSetEnd(); } }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { DynamicSerDeTypeBase keyType = getKeyType(); DynamicSerDeTypeBase valueType = getValueType(); WriteNullsProtocol nullProtocol = (oprot instanceof WriteNullsProtocol) ? (WriteNullsProtocol) oprot : null; assert (oi.getCategory() == ObjectInspector.Category.MAP); MapObjectInspector moi = (MapObjectInspector) oi; ObjectInspector koi = moi.getMapKeyObjectInspector(); ObjectInspector voi = moi.getMapValueObjectInspector(); Map<?, ?> map = moi.getMap(o); serializeMap = new TMap(keyType.getType(), valueType.getType(), map.size()); oprot.writeMapBegin(serializeMap); for (Object element : map.entrySet()) { Map.Entry it = (Map.Entry) element; Object key = it.getKey(); Object value = it.getValue(); keyType.serialize(key, koi, oprot); if (value == null) { assert (nullProtocol != null); nullProtocol.writeNull(); } else { valueType.serialize(value, voi, oprot); } } // in theory, the below call isn't needed in non thrift_mode, but let's not // get too crazy oprot.writeMapEnd(); }