diff options
author | Sameer Agarwal <sameer@databricks.com> | 2016-03-25 11:48:05 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-03-25 11:48:05 -0700 |
commit | b5f8c36e3c93750cea1473019ddd95538eccb4f3 (patch) | |
tree | fb40775a3421edca832d3ecc7f988bf65c15c850 | |
parent | 43b15e01c46ea1971569f74c9201a55de39e8917 (diff) | |
download | spark-b5f8c36e3c93750cea1473019ddd95538eccb4f3.tar.gz spark-b5f8c36e3c93750cea1473019ddd95538eccb4f3.tar.bz2 spark-b5f8c36e3c93750cea1473019ddd95538eccb4f3.zip |
[SPARK-14144][SQL] Explicitly identify/catch UnsupportedOperationException during parquet reader initialization
## What changes were proposed in this pull request?
This PR is a minor cleanup task as part of https://issues.apache.org/jira/browse/SPARK-14008 to explicitly identify/catch the `UnsupportedOperationException` while initializing the vectorized parquet reader. Other exceptions will simply be thrown back to `SqlNewHadoopPartition`.
## How was this patch tested?
N/A (cleanup only; no new functionality added)
Author: Sameer Agarwal <sameer@databricks.com>
Closes #11950 from sameeragarwal/parquet-cleanup.
-rw-r--r-- | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java index ab09208d5a..c06342c3d4 100644 --- a/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java +++ b/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java @@ -104,11 +104,12 @@ public class VectorizedParquetRecordReader extends SpecificParquetRecordReaderBa * Tries to initialize the reader for this split. Returns true if this reader supports reading * this split and false otherwise. */ - public boolean tryInitialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) { + public boolean tryInitialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) + throws IOException, InterruptedException { try { initialize(inputSplit, taskAttemptContext); return true; - } catch (Exception e) { + } catch (UnsupportedOperationException e) { return false; } } @@ -118,7 +119,7 @@ public class VectorizedParquetRecordReader extends SpecificParquetRecordReaderBa */ @Override public void initialize(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) - throws IOException, InterruptedException { + throws IOException, InterruptedException, UnsupportedOperationException { super.initialize(inputSplit, taskAttemptContext); initializeInternal(); } @@ -128,7 +129,8 @@ public class VectorizedParquetRecordReader extends SpecificParquetRecordReaderBa * objects to use this class. `columns` can contain the list of columns to project. */ @Override - public void initialize(String path, List<String> columns) throws IOException { + public void initialize(String path, List<String> columns) throws IOException, + UnsupportedOperationException { super.initialize(path, columns); initializeInternal(); } @@ -248,7 +250,7 @@ public class VectorizedParquetRecordReader extends SpecificParquetRecordReaderBa return true; } - private void initializeInternal() throws IOException { + private void initializeInternal() throws IOException, UnsupportedOperationException { /** * Check that the requested schema is supported. */ @@ -256,14 +258,14 @@ public class VectorizedParquetRecordReader extends SpecificParquetRecordReaderBa for (int i = 0; i < requestedSchema.getFieldCount(); ++i) { Type t = requestedSchema.getFields().get(i); if (!t.isPrimitive() || t.isRepetition(Type.Repetition.REPEATED)) { - throw new IOException("Complex types not supported."); + throw new UnsupportedOperationException("Complex types not supported."); } String[] colPath = requestedSchema.getPaths().get(i); if (fileSchema.containsPath(colPath)) { ColumnDescriptor fd = fileSchema.getColumnDescription(colPath); if (!fd.equals(requestedSchema.getColumns().get(i))) { - throw new IOException("Schema evolution not supported."); + throw new UnsupportedOperationException("Schema evolution not supported."); } missingColumns[i] = false; } else { |