Package com.facebook.hive.orc.lazy

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


        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here


   * @throws Exception
   */
  @Test
  public void TestCopyBinary() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyBinary lazyBinary = new OrcLazyBinary(new LazyBinaryTreeReader(0, 0) {
      int nextCalls = 0;

      @Override
      public Object next(Object previous) throws IOException {
        if (nextCalls == 0) {
          nextCalls++;
          return new BytesWritable("a".getBytes());
        }

        throw new IOException("next should only be called once");
      }

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

    BinaryObjectInspector binaryOI = (BinaryObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.binaryTypeInfo);

    OrcLazyBinary lazyBinary2 = (OrcLazyBinary) binaryOI.copyObject(lazyBinary);

    Assert.assertEquals("a", new String(((BytesWritable) lazyBinary.materialize()).getBytes()));
    Assert.assertEquals("a", new String(((BytesWritable) lazyBinary2.materialize()).getBytes()));
  }
View Full Code Here

      case INT:
        return new OrcLazyInt((LazyIntTreeReader)createLazyTreeReader(columnId, types, included));
      case STRING:
        return new OrcLazyString((LazyStringTreeReader)createLazyTreeReader(columnId, types, included));
      case BINARY:
        return new OrcLazyBinary((LazyBinaryTreeReader)createLazyTreeReader(columnId, types, included));
      case TIMESTAMP:
        return new OrcLazyTimestamp((LazyTimestampTreeReader)createLazyTreeReader(columnId, types, included));
      case STRUCT:
        return new OrcLazyStruct((LazyStructTreeReader)createLazyTreeReader(columnId, types, included));
      case LIST:
View Full Code Here

        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here

   * @throws Exception
   */
  @Test
  public void TestCopyBinary() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyBinary lazyBinary = new OrcLazyBinary(new LazyBinaryTreeReader(0, 0) {
      int nextCalls = 0;

      @Override
      public Object next(Object previous) throws IOException {
        if (nextCalls == 0) {
          nextCalls++;
          return new BytesWritable("a".getBytes());
        }

        throw new IOException("next should only be called once");
      }

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

    BinaryObjectInspector binaryOI = (BinaryObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.binaryTypeInfo);

    OrcLazyBinary lazyBinary2 = (OrcLazyBinary) binaryOI.copyObject(lazyBinary);

    Assert.assertEquals("a", new String(((BytesWritable) lazyBinary.materialize()).getBytes()));
    Assert.assertEquals("a", new String(((BytesWritable) lazyBinary2.materialize()).getBytes()));
  }
View Full Code Here

        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here

        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here

        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here

      case INT:
        return new OrcLazyInt((LazyIntTreeReader)createLazyTreeReader(columnId, types, included));
      case STRING:
        return new OrcLazyString((LazyStringTreeReader)createLazyTreeReader(columnId, types, included));
      case BINARY:
        return new OrcLazyBinary((LazyBinaryTreeReader)createLazyTreeReader(columnId, types, included));
      case TIMESTAMP:
        return new OrcLazyTimestamp((LazyTimestampTreeReader)createLazyTreeReader(columnId, types, included));
      case STRUCT:
        return new OrcLazyStruct((LazyStructTreeReader)createLazyTreeReader(columnId, types, included));
      case LIST:
View Full Code Here

        ((DoubleWritable) ((OrcLazyDouble) row.getFieldValue(6)).materialize()).get());
    obj = new OrcLazyDouble((OrcLazyDouble) row.getFieldValue(6));
    assertEquals(1.0, ((DoubleWritable) obj.materialize()).get());

    assertEquals(bytes(1), ((OrcLazyBinary) row.getFieldValue(7)).materialize());
    obj = new OrcLazyBinary((OrcLazyBinary) row.getFieldValue(7));
    assertEquals(bytes(1), obj.materialize());

    assertEquals("1", ((Text) ((OrcLazyString) row.getFieldValue(8)).materialize()).toString());
    obj = new OrcLazyString((OrcLazyString) row.getFieldValue(8));
    assertEquals("1", ((Text) obj.materialize()).toString());
View Full Code Here

TOP

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

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.