Search in sources :

Example 11 with LazyInteger

use of org.apache.hadoop.hive.serde2.lazy.LazyInteger in project hive by apache.

the class LazyDioInteger method init.

/* (non-Javadoc)
   * This provides a LazyInteger 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) {
    int value = 0;
    try {
        in = new ByteStream.Input(bytes.getData(), start, length);
        din = new DataInputStream(in);
        value = din.readInt();
        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
        }
    }
}
Also used : ByteStream(org.apache.hadoop.hive.serde2.ByteStream) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Aggregations

Text (org.apache.hadoop.io.Text)8 Test (org.junit.Test)8 IntWritable (org.apache.hadoop.io.IntWritable)5 Configuration (org.apache.hadoop.conf.Configuration)3 HiveAccumuloMapColumnMapping (org.apache.hadoop.hive.accumulo.columns.HiveAccumuloMapColumnMapping)3 Date (org.apache.hadoop.hive.common.type.Date)3 HiveChar (org.apache.hadoop.hive.common.type.HiveChar)3 HiveDecimal (org.apache.hadoop.hive.common.type.HiveDecimal)3 HiveVarchar (org.apache.hadoop.hive.common.type.HiveVarchar)3 Timestamp (org.apache.hadoop.hive.common.type.Timestamp)3 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 DataInputStream (java.io.DataInputStream)2 Map (java.util.Map)2 Properties (java.util.Properties)2 BatchWriter (org.apache.accumulo.core.client.BatchWriter)2 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)2 Connector (org.apache.accumulo.core.client.Connector)2 MockInstance (org.apache.accumulo.core.client.mock.MockInstance)2 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)2