Skip to content

Commit 3ced2ba

Browse files
committed
Eliminate warnings in SparkOrcNewRecordReader
1 parent 1f50a58 commit 3ced2ba

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sql/hive/src/main/java/org/apache/hadoop/hive/ql/io/orc/SparkOrcNewRecordReader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
import org.apache.hadoop.io.NullWritable;
2323
import org.apache.hadoop.mapreduce.InputSplit;
2424
import org.apache.hadoop.mapreduce.TaskAttemptContext;
25+
import org.apache.orc.TypeDescription;
2526

2627
import java.io.IOException;
28+
import java.util.List;
2729

2830
/**
2931
* This is based on hive-exec-1.2.1
@@ -41,10 +43,11 @@ public class SparkOrcNewRecordReader extends
4143

4244
public SparkOrcNewRecordReader(Reader file, Configuration conf,
4345
long offset, long length) throws IOException {
44-
if (file.getTypes().isEmpty()) {
46+
List<TypeDescription> subTypes = file.getSchema().getChildren();
47+
if (subTypes == null) {
4548
numColumns = 0;
4649
} else {
47-
numColumns = file.getTypes().get(0).getSubtypesCount();
50+
numColumns = subTypes.size();
4851
}
4952
value = new OrcStruct(numColumns);
5053
this.reader = OrcInputFormat.createReaderFromFile(file, conf, offset,

0 commit comments

Comments
 (0)