use of org.apache.hadoop.hive.serde2.lazy.ByteArrayRef in project hive by apache.
the class LazyBinarySerDe method deserialize.
/**
* Deserialize a table record to a lazybinary struct.
*/
@Override
public Object deserialize(Writable field) throws SerDeException {
if (byteArrayRef == null) {
byteArrayRef = new ByteArrayRef();
}
BinaryComparable b = (BinaryComparable) field;
if (b.getLength() == 0) {
return null;
}
byteArrayRef.setData(b.getBytes());
cachedLazyBinaryStruct.init(byteArrayRef, 0, b.getLength());
lastOperationSerialize = false;
lastOperationDeserialize = true;
return cachedLazyBinaryStruct;
}
use of org.apache.hadoop.hive.serde2.lazy.ByteArrayRef in project hive by apache.
the class LazyDioByte method init.
@Override
public void init(ByteArrayRef bytes, int start, int length) {
byte value = 0;
try {
in = new ByteStream.Input(bytes.getData(), start, length);
din = new DataInputStream(in);
value = din.readByte();
data.set(value);
isNull = false;
} catch (Exception e) {
isNull = true;
} finally {
try {
din.close();
} catch (IOException e) {
// swallow exception
}
try {
in.close();
} catch (IOException e) {
// swallow exception
}
}
}
use of org.apache.hadoop.hive.serde2.lazy.ByteArrayRef in project hive by apache.
the class LazyDioDouble method init.
/* (non-Javadoc)
* This provides a LazyDouble like class which can be initialized from data stored in a
* binary format.
*
* @see org.apache.hadoop.hive.serde2.lazy.LazyObject#init
* (org.apache.hadoop.hive.serde2.lazy.ByteArrayRef, int, int)
*/
@Override
public void init(ByteArrayRef bytes, int start, int length) {
double value = 0.0;
try {
in = new ByteStream.Input(bytes.getData(), start, length);
din = new DataInputStream(in);
value = din.readDouble();
data.set(value);
isNull = false;
} catch (IOException e) {
isNull = true;
} finally {
try {
din.close();
} catch (IOException e) {
// swallow exception
}
try {
in.close();
} catch (IOException e) {
// swallow exception
}
}
}
use of org.apache.hadoop.hive.serde2.lazy.ByteArrayRef in project hive by apache.
the class LazyDioFloat method init.
/* (non-Javadoc)
* This provides a LazyFloat like class which can be initialized from data stored in a
* binary format.
*
* @see org.apache.hadoop.hive.serde2.lazy.LazyObject#init
* (org.apache.hadoop.hive.serde2.lazy.ByteArrayRef, int, int)
*/
@Override
public void init(ByteArrayRef bytes, int start, int length) {
float value = 0.0F;
try {
in = new ByteStream.Input(bytes.getData(), start, length);
din = new DataInputStream(in);
value = din.readFloat();
data.set(value);
isNull = false;
} catch (IOException e) {
isNull = true;
} finally {
try {
din.close();
} catch (IOException e) {
// swallow exception
}
try {
in.close();
} catch (IOException e) {
// swallow exception
}
}
}
use of org.apache.hadoop.hive.serde2.lazy.ByteArrayRef in project hive by apache.
the class LazyDioLong method init.
/* (non-Javadoc)
* This provides a LazyLong like class which can be initialized from data stored in a
* binary format.
*
* @see org.apache.hadoop.hive.serde2.lazy.LazyObject#init
* (org.apache.hadoop.hive.serde2.lazy.ByteArrayRef, int, int)
*/
@Override
public void init(ByteArrayRef bytes, int start, int length) {
long value = 0;
try {
in = new ByteStream.Input(bytes.getData(), start, length);
din = new DataInputStream(in);
value = din.readLong();
data.set(value);
isNull = false;
} catch (IOException e) {
isNull = true;
} finally {
try {
din.close();
} catch (IOException e) {
// swallow exception
}
try {
in.close();
} catch (IOException e) {
// swallow exception
}
}
}
Aggregations