diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java b/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java index b01e780efdfda..9d68c38d99b25 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSourceFactory.java @@ -109,12 +109,6 @@ public Optional createPageSource( HiveFileContext hiveFileContext, Optional encryptionInformation) { - if (!columns.isEmpty() && columns.stream().allMatch(hiveColumnHandle -> hiveColumnHandle.getColumnType() == AGGREGATED)) { - throw new UnsupportedOperationException("Partial aggregation pushdown only supported for ORC/Parquet files. " + - "Table " + tableName.toString() + " has file (" + fileSplit.getPath() + ") of format " + storage.getStorageFormat().getOutputFormat() + - ". Set session property hive.pushdown_partial_aggregations_into_scan=false and execute query again"); - } - RcFileEncoding rcFileEncoding; if (LazyBinaryColumnarSerDe.class.getName().equals(storage.getStorageFormat().getSerDe())) { rcFileEncoding = new BinaryRcFileEncoding(); @@ -130,6 +124,12 @@ else if (ColumnarSerDe.class.getName().equals(storage.getStorageFormat().getSerD throw new PrestoException(HIVE_BAD_DATA, "RCFile is empty: " + fileSplit.getPath()); } + if (!columns.isEmpty() && columns.stream().allMatch(hiveColumnHandle -> hiveColumnHandle.getColumnType() == AGGREGATED)) { + throw new UnsupportedOperationException("Partial aggregation pushdown only supported for ORC/Parquet files. " + + "Table " + tableName.toString() + " has file (" + fileSplit.getPath() + ") of format " + storage.getStorageFormat().getOutputFormat() + + ". Set session property hive.pushdown_partial_aggregations_into_scan=false and execute query again"); + } + FSDataInputStream inputStream; Path path = new Path(fileSplit.getPath()); try {