Package com.facebook.hive.orc

Examples of com.facebook.hive.orc.OrcStruct$OrcStructInspector


    }
  }

  @Override
  public Object materialize(long row, Object previous) throws IOException {
    OrcStruct previousRow;
    if (previous != null) {
      previousRow = (OrcStruct) previous;
      previousRow.setFieldNames(fieldNames);
    } else {
      previousRow = new OrcStruct(fieldNames);
    }
    for (int i = 0; i < fields.length; i++) {
      previousRow.setFieldValue(i, fields[i]);
    }
    return previousRow;
  }
View Full Code Here


    }
  }

  @Override
  public Object next(Object previous) throws IOException {
    OrcStruct result = null;
    if (valuePresent) {
      if (previous == null) {
        result = new OrcStruct(fieldNames);
      } else {
        result = (OrcStruct) previous;

        // If the input format was initialized with a file with a
        // different number of fields, the number of fields needs to
        // be updated to the correct number
        result.setFieldNames(fieldNames);
      }
      for(int i=0; i < fields.length; ++i) {
        if (fields[i] != null) {
          result.setFieldValue(i,
              fields[i].getInComplexType(result.getFieldValue(i), previousRow));
        }
      }
    }
    return result;
  }
View Full Code Here

    if (data == null) {
      return null;
    }

    int offset = ((Field) fieldRef).getOffset();
    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (offset >= struct.getNumFields()) {
      return null;
    }

    return struct.getFieldValue(offset);
  }
View Full Code Here

  public List<Object> getStructFieldsDataAsList(Object data) {
    if (data == null) {
      return null;
    }

    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    List<Object> result = new ArrayList<Object>(struct.getNumFields());
    for (int i = 0; i < struct.getNumFields(); i++) {
      result.add(struct.getFieldValue(i));
    }
    return result;
  }
View Full Code Here

    if (data == null) {
      return null;
    }

    int offset = ((Field) fieldRef).getOffset();
    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (offset >= struct.getNumFields()) {
      return null;
    }

    return struct.getFieldValue(offset);
  }
View Full Code Here

  public List<Object> getStructFieldsDataAsList(Object data) {
    if (data == null) {
      return null;
    }

    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    List<Object> result = new ArrayList<Object>(struct.getNumFields());
    for (int i = 0; i < struct.getNumFields(); i++) {
      result.add(struct.getFieldValue(i));
    }
    return result;
  }
View Full Code Here

    if (data == null) {
      return null;
    }

    int offset = ((Field) fieldRef).getOffset();
    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    if (offset >= struct.getNumFields()) {
      return null;
    }

    return struct.getFieldValue(offset);
  }
View Full Code Here

  public List<Object> getStructFieldsDataAsList(Object data) {
    if (data == null) {
      return null;
    }

    OrcStruct struct;
    try {
      struct = (OrcStruct) ((OrcLazyStruct) data).materialize();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    List<Object> result = new ArrayList<Object>(struct.getNumFields());
    for (int i = 0; i < struct.getNumFields(); i++) {
      result.add(struct.getFieldValue(i));
    }
    return result;
  }
View Full Code Here

    }
  }

  @Override
  public Object materialize(long row, Object previous) throws IOException {
    OrcStruct previousRow;
    if (previous != null) {
      previousRow = (OrcStruct) previous;
      previousRow.setFieldNames(fieldNames);
    } else {
      previousRow = new OrcStruct(fieldNames);
    }
    for (int i = 0; i < fields.length; i++) {
      previousRow.setFieldValue(i, fields[i]);
    }
    return previousRow;
  }
View Full Code Here

TOP

Related Classes of com.facebook.hive.orc.OrcStruct$OrcStructInspector

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.