public void setSeparator(int index, byte separator) throws SerDeException { if (index < 0 || index >= separators.length) { throw new SerDeException("Invalid separator array index value: " + index); } separators[index] = separator; }
@Override public ObjectInspector getObjectInspector() throws SerDeException { if (inspector == null) { throw new SerDeException("null inspector ??"); } return inspector; }
@Override public void initialize(Configuration job, Properties tbl) throws SerDeException { throw new SerDeException( "ThriftByteStreamTypedSerDe is still semi-abstract"); }
/** * Not implemented. */ @Override public Object doDeserialize(Writable field) throws SerDeException { LOG.error("DelimitedJSONSerDe cannot deserialize."); throw new SerDeException("DelimitedJSONSerDe cannot deserialize."); }
public TypedSerDe(Type objectType) throws SerDeException { this.objectType = objectType; if (objectType instanceof Class) { objectClass = (Class<?>) objectType; } else if (objectType instanceof ParameterizedType) { objectClass = (Class<?>) (((ParameterizedType) objectType).getRawType()); } else { throw new SerDeException("Cannot create TypedSerDe with type " + objectType); } }
private int getCharByteNum(String charset) throws SerDeException { if (!CHARSET_TO_BYTE_NUM.containsKey(charCharset)) { throw new SerDeException( format("%s isn't supported in Teradata Char Charset %s", charCharset, CHARSET_TO_BYTE_NUM.keySet())); } else { return CHARSET_TO_BYTE_NUM.get(charset); } }
@Override public Writable serialize(Object obj, ObjectInspector objInspector) throws SerDeException { try { return serializer.serialize(obj, objInspector); } catch (SerDeException e) { throw e; } catch (Exception e) { throw new SerDeException(e); } }
@Override public Object deserialize(Writable blob) throws SerDeException { if (!(blob instanceof BytesRefArrayWritable)) { throw new SerDeException(getClass().toString() + ": expects BytesRefArrayWritable!"); } BytesRefArrayWritable cols = (BytesRefArrayWritable) blob; cachedLazyStruct.init(cols); lastOperationSerialize = false; lastOperationDeserialize = true; return cachedLazyStruct; }
@Override public T createKey(ObjectInspector inspector) throws SerDeException { try { return (T) constructor.newInstance(inspector, properties, hbaseParams.getBaseConfiguration()); } catch (Exception e) { throw new SerDeException(e); } } }
public ThriftByteStreamTypedSerDe(Type objectType, TProtocolFactory inFactory, TProtocolFactory outFactory) throws SerDeException { super(objectType); try { init(inFactory, outFactory); } catch (Exception e) { throw new SerDeException(e); } }
public LazyHCatRecord(Object wrappedObject, ObjectInspector oi) throws Exception { if (oi.getCategory() != Category.STRUCT) { throw new SerDeException(getClass().toString() + " can only make a lazy hcat record from " + "objects of struct types, but we got: " + oi.getTypeName()); } this.soi = (StructObjectInspector)oi; this.wrappedObject = wrappedObject; }
private HBaseKeyFactory initKeyFactory(Configuration conf, Properties tbl) throws SerDeException { try { HBaseKeyFactory keyFactory = createKeyFactory(conf, tbl); if (keyFactory != null) { keyFactory.init(this, tbl); } return keyFactory; } catch (Exception e) { throw new SerDeException(e); } }
@Override public void writeValue(RandomAccessOutput dest) throws SerDeException { if (!(value instanceof BinaryComparable)) { throw new SerDeException("Unexpected type " + value.getClass().getCanonicalName()); } BinaryComparable b = (BinaryComparable)value; dest.write(b.getBytes(), 0, b.getLength()); }
@Override public Object deserialize(Writable field) throws SerDeException { Object obj = super.deserialize(field); try { ((TBase) obj).read(inProtocol); } catch (Exception e) { throw new SerDeException(e); } return obj; }
@Override public LazyObjectBase createValueObject(ObjectInspector inspector) throws SerDeException { try { return (T) constructor.newInstance(inspector, properties, hbaseParams.getBaseConfiguration(), hbaseParams.getColumnMappings().getColumnsMapping()[fieldID]); } catch (Exception e) { throw new SerDeException(e); } } }
public static int getStructSize(ObjectInspector oi) throws SerDeException { if (oi.getCategory() != Category.STRUCT) { throw new SerDeException("Unexpected category " + oi.getCategory()); } return ((StructObjectInspector)oi).getAllStructFieldRefs().size(); }
@Override public int getHashFromKey() throws SerDeException { if (!(key instanceof BinaryComparable)) { throw new SerDeException("Unexpected type " + key.getClass().getCanonicalName()); } sanityCheckKeyForTag(); BinaryComparable b = (BinaryComparable)key; return HashCodeUtil.murmurHash(b.getBytes(), 0, b.getLength() - (hasTag ? 1 : 0)); }
@Override public Writable serialize(final Object obj, final ObjectInspector objInspector) throws SerDeException { if (!objInspector.getCategory().equals(Category.STRUCT)) { throw new SerDeException("Cannot serialize " + objInspector.getCategory() + ". Can only serialize a struct"); } serializedSize = ((StructObjectInspector)objInspector).getAllStructFieldRefs().size(); status = LAST_OPERATION.SERIALIZE; parquetRow.value = obj; parquetRow.inspector= (StructObjectInspector)objInspector; return parquetRow; }
private Object parseInternal(JsonParser parser) throws SerDeException { try { parser.nextToken(); Object res = parseDispatcher(parser, oi); return res; } catch (Exception e) { String locationStr = parser.getCurrentLocation().getLineNr() + "," + parser.getCurrentLocation().getColumnNr(); throw new SerDeException("at[" + locationStr + "]: " + e.getMessage(), e); } }
protected void serializeField(ByteStream.Output out, Object obj, ObjectInspector objInspector, LazySerDeParameters serdeParams) throws SerDeException { try { serialize(out, obj, objInspector, serdeParams.getSeparators(), 1, serdeParams.getNullSequence(), serdeParams.isEscaped(), serdeParams.getEscapeChar(), serdeParams.getNeedsEscape()); } catch (IOException e) { throw new SerDeException(e); } }