diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcUtils.java index 0776018..db2ca15 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/OrcUtils.java @@ -57,6 +57,10 @@ ObjectInspector inspector) { int numFlattenedCols = getFlattenedColumnsCount(inspector); boolean[] results = new boolean[numFlattenedCols]; + if ("*".equals(selectedColumns)) { + Arrays.fill(results, true); + return results; + } if (selectedColumns != null && !selectedColumns.isEmpty()) { includeColumnsImpl(results, selectedColumns.toLowerCase(), allColumns, inspector); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java index 58e19cb..beaf231 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/orc/RecordReaderImpl.java @@ -666,7 +666,6 @@ private static Object getBaseObjectForComparison(PredicateLeaf.Type type, Object private final List sargLeaves; private final int[] filterColumns; private final long rowIndexStride; - private final OrcProto.BloomFilterIndex[] bloomFilterIndices; // same as the above array, but indices are set to true private final boolean[] sargColumns; public SargApplier(SearchArgument sarg, String[] columnNames, long rowIndexStride, @@ -674,7 +673,6 @@ public SargApplier(SearchArgument sarg, String[] columnNames, long rowIndexStrid this.sarg = sarg; sargLeaves = sarg.getLeaves(); filterColumns = mapSargColumns(sargLeaves, columnNames, 0); - bloomFilterIndices = new OrcProto.BloomFilterIndex[types.size()]; this.rowIndexStride = rowIndexStride; // included will not be null, row options will fill the array with trues if null sargColumns = new boolean[includedCount]; @@ -694,7 +692,8 @@ public SargApplier(SearchArgument sarg, String[] columnNames, long rowIndexStrid * @throws IOException */ public boolean[] pickRowGroups( - StripeInformation stripe, OrcProto.RowIndex[] indexes) throws IOException { + StripeInformation stripe, OrcProto.RowIndex[] indexes, + OrcProto.BloomFilterIndex[] bloomFilterIndices) throws IOException { long rowsInStripe = stripe.getNumberOfRows(); int groupsInStripe = (int) ((rowsInStripe + rowIndexStride - 1) / rowIndexStride); boolean[] result = new boolean[groupsInStripe]; // TODO: avoid alloc? @@ -705,7 +704,7 @@ public SargApplier(SearchArgument sarg, String[] columnNames, long rowIndexStrid OrcProto.ColumnStatistics stats = indexes[filterColumns[pred]].getEntry(rowGroup).getStatistics(); OrcProto.BloomFilter bf = null; - if (bloomFilterIndices[filterColumns[pred]] != null) { + if (bloomFilterIndices != null && bloomFilterIndices[filterColumns[pred]] != null) { bf = bloomFilterIndices[filterColumns[pred]].getBloomFilter(rowGroup); } leafValues[pred] = evaluatePredicateProto(stats, sargLeaves.get(pred), bf); @@ -749,7 +748,7 @@ public SargApplier(SearchArgument sarg, String[] columnNames, long rowIndexStrid return null; } readRowIndex(currentStripe, included, sargApp.sargColumns); - return sargApp.pickRowGroups(stripes.get(currentStripe), indexes); + return sargApp.pickRowGroups(stripes.get(currentStripe), indexes, bloomFilterIndices); } private void clearStreams() throws IOException {