Github user tejasapatil commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13775#discussion_r83757435
  
    --- Diff: 
sql/hive/src/main/java/org/apache/hadoop/hive/ql/io/orc/VectorizedSparkOrcNewRecordReader.java
 ---
    @@ -0,0 +1,318 @@
    +/*
    + * 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 org.apache.hadoop.hive.ql.io.orc;
    +
    +import java.io.IOException;
    +import java.nio.charset.StandardCharsets;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.commons.lang.NotImplementedException;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.hive.ql.exec.vector.ColumnVector;
    +import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
    +import org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector;
    +import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector;
    +import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
    +import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
    +import org.apache.hadoop.io.NullWritable;
    +import org.apache.hadoop.mapred.JobConf;
    +import org.apache.hadoop.mapreduce.InputSplit;
    +import org.apache.hadoop.mapreduce.TaskAttemptContext;
    +import org.apache.hadoop.mapreduce.lib.input.FileSplit;
    +
    +import org.apache.spark.sql.catalyst.InternalRow;
    +import org.apache.spark.sql.catalyst.util.ArrayData;
    +import org.apache.spark.sql.catalyst.util.MapData;
    +import org.apache.spark.sql.types.DataType;
    +import org.apache.spark.sql.types.Decimal;
    +import org.apache.spark.unsafe.types.CalendarInterval;
    +import org.apache.spark.unsafe.types.UTF8String;
    +
    +/**
    + * A RecordReader that returns InternalRow for Spark SQL execution.
    + * This reader uses an internal reader that returns Hive's 
VectorizedRowBatch. An adapter
    + * class is used to return internal row by directly accessing data in 
column vectors.
    + */
    +public class VectorizedSparkOrcNewRecordReader
    +    extends org.apache.hadoop.mapreduce.RecordReader<NullWritable, 
InternalRow> {
    +  private final org.apache.hadoop.mapred.RecordReader<NullWritable, 
VectorizedRowBatch> reader;
    +  private final int numColumns;
    +  private VectorizedRowBatch internalValue;
    +  private float progress = 0.0f;
    +  private List<Integer> columnIDs;
    +
    +  private long numRowsOfBatch = 0;
    +  private int indexOfRow = 0;
    +
    +  private final Row row;
    +
    +  public VectorizedSparkOrcNewRecordReader(
    +      Reader file,
    +      JobConf conf,
    +      FileSplit fileSplit,
    +      List<Integer> columnIDs) throws IOException {
    +    List<OrcProto.Type> types = file.getTypes();
    +    numColumns = (types.size() == 0) ? 0 : types.get(0).getSubtypesCount();
    +    this.reader = new SparkVectorizedOrcRecordReader(file, conf,
    +      new org.apache.hadoop.mapred.FileSplit(fileSplit));
    +
    +    this.columnIDs = new ArrayList<>(columnIDs);
    +    this.internalValue = this.reader.createValue();
    +    this.progress = reader.getProgress();
    +    this.row = new Row(this.internalValue.cols, this.columnIDs);
    +  }
    +
    +  @Override
    +  public void close() throws IOException {
    +    reader.close();
    +  }
    +
    +  @Override
    +  public NullWritable getCurrentKey() throws IOException,
    +      InterruptedException {
    --- End diff --
    
    nit: move all the `InterruptedException` in the previous line. This might 
also apply to other places in the PR but I am not pointing out each instance.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to