Skip to content

Commit 697de21

Browse files
committed
Initial commit
1 parent a998e9d commit 697de21

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,21 +270,23 @@ public boolean nextBatch() throws IOException {
270270
private void initializeInternal() throws IOException, UnsupportedOperationException {
271271
// Check that the requested schema is supported.
272272
missingColumns = new boolean[requestedSchema.getFieldCount()];
273+
List<ColumnDescriptor> columns = requestedSchema.getColumns();
274+
List<String[]> paths = requestedSchema.getPaths();
273275
for (int i = 0; i < requestedSchema.getFieldCount(); ++i) {
274276
Type t = requestedSchema.getFields().get(i);
275277
if (!t.isPrimitive() || t.isRepetition(Type.Repetition.REPEATED)) {
276278
throw new UnsupportedOperationException("Complex types not supported.");
277279
}
278280

279-
String[] colPath = requestedSchema.getPaths().get(i);
281+
String[] colPath = paths.get(i);
280282
if (fileSchema.containsPath(colPath)) {
281283
ColumnDescriptor fd = fileSchema.getColumnDescription(colPath);
282-
if (!fd.equals(requestedSchema.getColumns().get(i))) {
284+
if (!fd.equals(columns.get(i))) {
283285
throw new UnsupportedOperationException("Schema evolution not supported.");
284286
}
285287
missingColumns[i] = false;
286288
} else {
287-
if (requestedSchema.getColumns().get(i).getMaxDefinitionLevel() == 0) {
289+
if (columns.get(i).getMaxDefinitionLevel() == 0) {
288290
// Column is missing in data but the required data is non-nullable. This file is invalid.
289291
throw new IOException("Required column is missing in data file. Col: " +
290292
Arrays.toString(colPath));

0 commit comments

Comments
 (0)