Package com.facebook.hive.orc.lazy

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


    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here


   * @throws Exception
   */
  @Test
  public void TestCopyString() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyString lazyString = new OrcLazyString(new LazyStringTreeReader(0, 0) {
      int getCalls = 0;

      @Override
      public Object get(long currentRow, Object previous) throws IOException {
        if (getCalls == 0) {
          return new Text("a");
        }

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

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

    StringObjectInspector stringOI = (StringObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.stringTypeInfo);

    OrcLazyString lazyString2 = (OrcLazyString) stringOI.copyObject(lazyString);

    Assert.assertEquals("a", ((Text) lazyString.materialize()).toString());
    Assert.assertEquals("a", ((Text) lazyString2.materialize()).toString());
  }
View Full Code Here

      case LONG:
        return new OrcLazyLong((LazyLongTreeReader)createLazyTreeReader(columnId, types, included));
      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:
View Full Code Here

    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void TestCopyString() throws Exception {
    ReaderWriterProfiler.setProfilerOptions(null);
    OrcLazyString lazyString = new OrcLazyString(new LazyStringTreeReader(0, 0) {
      int getCalls = 0;

      @Override
      public Object get(long currentRow, Object previous) throws IOException {
        if (getCalls == 0) {
          return new Text("a");
        }

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

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

    StringObjectInspector stringOI = (StringObjectInspector)
        OrcLazyObjectInspectorUtils.createLazyObjectInspector(TypeInfoFactory.stringTypeInfo);

    OrcLazyString lazyString2 = (OrcLazyString) stringOI.copyObject(lazyString);

    Assert.assertEquals("a", ((Text) lazyString.materialize()).toString());
    Assert.assertEquals("a", ((Text) lazyString2.materialize()).toString());
  }
View Full Code Here

    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here

    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here

    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here

      case LONG:
        return new OrcLazyLong((LazyLongTreeReader)createLazyTreeReader(columnId, types, included));
      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:
View Full Code Here

    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());

    // Currently copies are not supported for complex types
  }
View Full Code Here

TOP

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

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.