// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/OrcLazyRow.java
// public class OrcLazyRow extends OrcLazyStruct {
// 
//   private OrcLazyObject[] fields;
//   private final List<String> fieldNames;
// 
//   public OrcLazyRow(OrcLazyObject[] fields, List<String> fieldNames) {
//     super(null);
//     this.fields = fields;
//     this.fieldNames = fieldNames;
//   }
// 
//   @Override
//   public void next() {
//     super.next();
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.next();
//       }
//     }
//   }
// 
//   @Override
//   public void startStripe(Map<StreamName, InStream> streams, List<OrcProto.ColumnEncoding> encodings,
//       RowIndex[] indexes, long rowBaseInStripe) throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.startStripe(streams, encodings, indexes, rowBaseInStripe);
//       }
//     }
//   }
// 
//   @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;
//   }
// 
//   @Override
//   public void seekToRow(long rowNumber) throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.seekToRow(rowNumber);
//       }
//     }
//   }
// 
//   public int getNumFields() {
//     return fields.length;
//   }
// 
//   public OrcLazyObject getFieldValue(int index) {
//     if (index >= fields.length) {
//       return null;
//     }
// 
//     return fields[index];
//   }
// 
//   public void reset(OrcLazyRow other) throws IOException {
//     this.fields = other.getRawFields();
//     seekToRow(0);
//   }
// 
//   public OrcLazyObject[] getRawFields() {
//     return fields;
//   }
// 
//   @Override
//   public void close() throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.close();
//       }
//     }
//   }
// }


import com.facebook.hive.orc.lazy.OrcLazyRow;
import java.io.IOException;
//  Copyright (c) 2013, Facebook, Inc.  All rights reserved.

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.hive.orc;



/**
 * A row-by-row iterator for ORC files.
 */
public interface RecordReader {
  /**
   * Does the reader have more rows available.
   * @return true if there are more rows
   * @throws java.io.IOException
   */
  boolean hasNext() throws IOException;

  /**
   * Read the next row.
   * @param previous a row object that can be reused by the reader
   * @return the row that was read
   * @throws java.io.IOException
   */
  Object next(Object previous) throws IOException;

  /**
   * Get the row number of the row that will be returned by the following
   * call to next().
   * @return the row number from 0 to the number of rows in the file
   * @throws java.io.IOException
   */
  long getRowNumber() throws IOException;

  /**
   * Get the progress of the reader through the rows.
   * @return a fraction between 0.0 and 1.0 of rows read
   * @throws java.io.IOException
   */
  float getProgress() throws IOException;

  /**
   * Release the resources associated with the given reader.
   * @throws java.io.IOException
   */
  void close() throws IOException;

  /**
   * Seek to a particular row number.
   * The row number here refers to row number in that particular file.
   * We might be reading only a part of the file but the rowCount will still be the count with respect to the
   * complete file.
   */
  void seekToRow(long rowCount) throws IOException;

  /**
   * Get the underlying reader.
   */
// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/OrcLazyRow.java
// public class OrcLazyRow extends OrcLazyStruct {
// 
//   private OrcLazyObject[] fields;
//   private final List<String> fieldNames;
// 
//   public OrcLazyRow(OrcLazyObject[] fields, List<String> fieldNames) {
//     super(null);
//     this.fields = fields;
//     this.fieldNames = fieldNames;
//   }
// 
//   @Override
//   public void next() {
//     super.next();
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.next();
//       }
//     }
//   }
// 
//   @Override
//   public void startStripe(Map<StreamName, InStream> streams, List<OrcProto.ColumnEncoding> encodings,
//       RowIndex[] indexes, long rowBaseInStripe) throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.startStripe(streams, encodings, indexes, rowBaseInStripe);
//       }
//     }
//   }
// 
//   @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;
//   }
// 
//   @Override
//   public void seekToRow(long rowNumber) throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.seekToRow(rowNumber);
//       }
//     }
//   }
// 
//   public int getNumFields() {
//     return fields.length;
//   }
// 
//   public OrcLazyObject getFieldValue(int index) {
//     if (index >= fields.length) {
//       return null;
//     }
// 
//     return fields[index];
//   }
// 
//   public void reset(OrcLazyRow other) throws IOException {
//     this.fields = other.getRawFields();
//     seekToRow(0);
//   }
// 
//   public OrcLazyObject[] getRawFields() {
//     return fields;
//   }
// 
//   @Override
//   public void close() throws IOException {
//     for (OrcLazyObject field : fields) {
//       if (field != null) {
//         field.close();
//       }
//     }
//   }
// }


// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/RecordReader.java
import com.facebook.hive.orc.lazy.OrcLazyRow;
import java.io.IOException;

//  Copyright (c) 2013, Facebook, Inc.  All rights reserved.

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.hive.orc;



/**
 * A row-by-row iterator for ORC files.
 */
public interface RecordReader {
  /**
   * Does the reader have more rows available.
   * @return true if there are more rows
   * @throws java.io.IOException
   */
  boolean hasNext() throws IOException;

  /**
   * Read the next row.
   * @param previous a row object that can be reused by the reader
   * @return the row that was read
   * @throws java.io.IOException
   */
  Object next(Object previous) throws IOException;

  /**
   * Get the row number of the row that will be returned by the following
   * call to next().
   * @return the row number from 0 to the number of rows in the file
   * @throws java.io.IOException
   */
  long getRowNumber() throws IOException;

  /**
   * Get the progress of the reader through the rows.
   * @return a fraction between 0.0 and 1.0 of rows read
   * @throws java.io.IOException
   */
  float getProgress() throws IOException;

  /**
   * Release the resources associated with the given reader.
   * @throws java.io.IOException
   */
  void close() throws IOException;

  /**
   * Seek to a particular row number.
   * The row number here refers to row number in that particular file.
   * We might be reading only a part of the file but the rowCount will still be the count with respect to the
   * complete file.
   */
  void seekToRow(long rowCount) throws IOException;

  /**
   * Get the underlying reader.
   */
  OrcLazyRow getReader();