Package org.apache.hadoop.hive.serde2.io

Examples of org.apache.hadoop.hive.serde2.io.ShortWritable


  }

  public OrcLazyShort(OrcLazyShort copy) {
    super(copy);
    if (copy.previous != null) {
      previous = new ShortWritable(((ShortWritable)copy.previous).get());
    }
  }
View Full Code Here


  private short latestValue() {
    return latestValue;
  }

  ShortWritable createWritable(Object previous, short v) throws IOException {
    ShortWritable result = null;
    if (previous == null) {
      result = new ShortWritable();
    } else {
      result = (ShortWritable) previous;
    }
    result.set(v);
    return result;
  }
View Full Code Here

    return readShort();
  }

  @Override
  public Object next(Object previous) throws IOException {
    ShortWritable result = null;
    if (valuePresent) {
      result = createWritable(previous, readShort());
    }
    return result;
  }
View Full Code Here

    return o == null ? null : new OrcLazyShort((OrcLazyShort) o);
  }

  @Override
  public Object getPrimitiveJavaObject(Object o) {
    ShortWritable writable = getPrimitiveWritableObject(o);
    return writable == null ? null : Short.valueOf(writable.get());
  }
View Full Code Here

      int getCalls = 0;

      @Override
      public Object get(long currentRow, Object previous) throws IOException {
        if (getCalls == 0) {
          return new ShortWritable((short) 1);
        }

        throw new IOException("get should only be called once");
      }
View Full Code Here

    } else {
      assertEquals(expected.byte1.byteValue(), byte1.get());
    }

    OrcLazyShort lazyShort1 = (OrcLazyShort) row.getFieldValue(2);
    ShortWritable short1 = (ShortWritable) lazyShort1.materialize();
    if (short1 == null) {
      assertNull(expected.short1);
    } else {
      assertEquals(expected.short1.shortValue(), short1.get());
    }

    OrcLazyInt lazyInt1 = (OrcLazyInt) row.getFieldValue(3);
    IntWritable int1 = (IntWritable) lazyInt1.materialize();
    if (int1 == null) {
      assertNull(expected.int1);
    } else {
      assertEquals(expected.int1.intValue(), int1.get());
    }

    OrcLazyLong lazyLong1 = (OrcLazyLong) row.getFieldValue(4);
    LongWritable long1 = (LongWritable) lazyLong1.materialize();
    if (long1 == null) {
      assertNull(expected.long1);
    } else {
      assertEquals(expected.long1.longValue(), long1.get());
    }

    OrcLazyShort lazyShort2 = (OrcLazyShort) row.getFieldValue(5);
    ShortWritable short2 = (ShortWritable) lazyShort2.materialize();
    if (short2 == null) {
      assertNull(expected.short2);
    } else {
      assertEquals(expected.short2.shortValue(), short2.get());
    }

    OrcLazyInt lazyInt2 = (OrcLazyInt) row.getFieldValue(6);
    IntWritable int2 = (IntWritable) lazyInt2.materialize();
    if (int2 == null) {
      assertNull(expected.int2);
    } else {
      assertEquals(expected.int2.intValue(), int2.get());
    }

    OrcLazyLong lazyLong2 = (OrcLazyLong) row.getFieldValue(7);
    LongWritable long2 = (LongWritable) lazyLong2.materialize();
    if (long2 == null) {
      assertNull(expected.long2);
    } else {
      assertEquals(expected.long2.longValue(), long2.get());
    }

    OrcLazyShort lazyShort3 = (OrcLazyShort) row.getFieldValue(8);
    ShortWritable short3 = (ShortWritable) lazyShort3.materialize();
    if (short3 == null) {
      assertNull(expected.short3);
    } else {
      assertEquals(expected.short3.shortValue(), short3.get());
    }

    OrcLazyInt lazyInt3 = (OrcLazyInt) row.getFieldValue(9);
    IntWritable int3 = (IntWritable) lazyInt3.materialize();
    if (int3 == null) {
View Full Code Here

    return latestRead;
  }


  ShortWritable createWritable(Object previous, short v) throws IOException {
    ShortWritable result = null;
    if (previous == null) {
      result = new ShortWritable();
    } else {
      result = (ShortWritable) previous;
    }
    result.set(v);
    return result;
  }
View Full Code Here

    return readShort();
  }

  @Override
  public Object next(Object previous) throws IOException {
    ShortWritable result = null;
    if (valuePresent) {
      result = createWritable(previous, readShort());
    }
    return result;
  }
View Full Code Here

    public Object getPrimitiveWritableObject(Object o) {
        ShortOption object = (ShortOption) o;
        if (object == null || object.isNull()) {
            return null;
        }
        return new ShortWritable(object.get());
    }
View Full Code Here

    p.add(cfb, qualBool, Bytes.toBytes("true"));

    Object[] expectedFieldsData = {
      new Text("test-row1"),
      new ByteWritable((byte)123),
      new ShortWritable((short)456),
      new IntWritable(789),
      new LongWritable(1000),
      new FloatWritable(-0.01F),
      new DoubleWritable(5.3),
      new Text("Hadoop, HBase, and Hive"),
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.serde2.io.ShortWritable

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.