Package com.facebook.hive.orc.lazy

Examples of com.facebook.hive.orc.lazy.OrcLazyShort


    assertEquals(1, ((ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize()).get());
    obj = new OrcLazyByte((OrcLazyByte) row.getFieldValue(1));
    assertEquals(1, ((ByteWritable) obj.materialize()).get());

    assertEquals(1, ((ShortWritable) ((OrcLazyShort) row.getFieldValue(2)).materialize()).get());
    obj = new OrcLazyShort((OrcLazyShort) row.getFieldValue(2));
    assertEquals(1, ((ShortWritable) obj.materialize()).get());

    assertEquals(1, ((IntWritable) ((OrcLazyInt) row.getFieldValue(3)).materialize()).get());
    obj = new OrcLazyInt((OrcLazyInt) row.getFieldValue(3));
    assertEquals(1, ((IntWritable) obj.materialize()).get());
View Full Code Here


    } else {
      assertEquals(expected.byte1.byteValue(),
          ((ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize()).get());
    }

    OrcLazyShort short1 = (OrcLazyShort) row.getFieldValue(2);
    try
    {
      short s1 = short1.materializeShort();
      assertEquals(expected.short1.shortValue(), s1);
    }
    catch(IOException e) {
      assert(short1.nextIsNull());
      assertNull(expected.short1);
    }

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

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

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

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

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

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

    OrcLazyInt int3 = (OrcLazyInt) row.getFieldValue(9);
    if (int3.nextIsNull()) {
      assertNull(expected.int3);
View Full Code Here

      assertNull(expected.byte1);
    } 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());
    }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void TestCopyShort() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyShort lazyShort = new OrcLazyShort(new LazyShortTreeReader(0, 0) {
      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");
      }

      @Override
      protected boolean seekToRow(long currentRow) throws IOException {
        return true;
      }
    });

    ShortObjectInspector shortOI = (ShortObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.shortTypeInfo);

    OrcLazyShort lazyShort2 = (OrcLazyShort) shortOI.copyObject(lazyShort);

    Assert.assertEquals(1, ((ShortWritable) lazyShort.materialize()).get());
    Assert.assertEquals(1, ((ShortWritable) lazyShort2.materialize()).get());
  }
View Full Code Here

      case DOUBLE:
        return new OrcLazyDouble((LazyDoubleTreeReader)createLazyTreeReader(columnId, types, included));
      case FLOAT:
        return new OrcLazyFloat((LazyFloatTreeReader)createLazyTreeReader(columnId, types, included));
      case SHORT:
        return new OrcLazyShort((LazyShortTreeReader)createLazyTreeReader(columnId, types, included));
      case LONG:
        return new OrcLazyLong((LazyLongTreeReader)createLazyTreeReader(columnId, types, included));
      case INT:
        return new OrcLazyInt((LazyIntTreeReader)createLazyTreeReader(columnId, types, included));
      case STRING:
View Full Code Here

    assertEquals(1, ((ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize()).get());
    obj = new OrcLazyByte((OrcLazyByte) row.getFieldValue(1));
    assertEquals(1, ((ByteWritable) obj.materialize()).get());

    assertEquals(1, ((ShortWritable) ((OrcLazyShort) row.getFieldValue(2)).materialize()).get());
    obj = new OrcLazyShort((OrcLazyShort) row.getFieldValue(2));
    assertEquals(1, ((ShortWritable) obj.materialize()).get());

    assertEquals(1, ((IntWritable) ((OrcLazyInt) row.getFieldValue(3)).materialize()).get());
    obj = new OrcLazyInt((OrcLazyInt) row.getFieldValue(3));
    assertEquals(1, ((IntWritable) obj.materialize()).get());
View Full Code Here

    } else {
      assertEquals(expected.byte1.byteValue(),
          ((ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize()).get());
    }

    OrcLazyShort short1 = (OrcLazyShort) row.getFieldValue(2);
    try
    {
      short s1 = short1.materializeShort();
      assertEquals(expected.short1.shortValue(), s1);
    }
    catch(IOException e) {
      assert(short1.nextIsNull());
      assertNull(expected.short1);
    }

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

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

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

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

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

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

    OrcLazyInt int3 = (OrcLazyInt) row.getFieldValue(9);
    if (int3.nextIsNull()) {
      assertNull(expected.int3);
View Full Code Here

      assertNull(expected.byte1);
    } 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());
    }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void TestCopyShort() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyShort lazyShort = new OrcLazyShort(new LazyShortTreeReader(0, 0) {
      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");
      }

      @Override
      protected boolean seekToRow(long currentRow) throws IOException {
        return true;
      }
    });

    ShortObjectInspector shortOI = (ShortObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.shortTypeInfo);

    OrcLazyShort lazyShort2 = (OrcLazyShort) shortOI.copyObject(lazyShort);

    Assert.assertEquals(1, ((ShortWritable) lazyShort.materialize()).get());
    Assert.assertEquals(1, ((ShortWritable) lazyShort2.materialize()).get());
  }
View Full Code Here

    assertEquals(1, ((ByteWritable) ((OrcLazyByte) row.getFieldValue(1)).materialize()).get());
    obj = new OrcLazyByte((OrcLazyByte) row.getFieldValue(1));
    assertEquals(1, ((ByteWritable) obj.materialize()).get());

    assertEquals(1, ((ShortWritable) ((OrcLazyShort) row.getFieldValue(2)).materialize()).get());
    obj = new OrcLazyShort((OrcLazyShort) row.getFieldValue(2));
    assertEquals(1, ((ShortWritable) obj.materialize()).get());

    assertEquals(1, ((IntWritable) ((OrcLazyInt) row.getFieldValue(3)).materialize()).get());
    obj = new OrcLazyInt((OrcLazyInt) row.getFieldValue(3));
    assertEquals(1, ((IntWritable) obj.materialize()).get());
View Full Code Here

TOP

Related Classes of com.facebook.hive.orc.lazy.OrcLazyShort

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.