DRILL-1417: ensure star column is passed to scan in case non-partition columns are empty
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/70993d2d Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/70993d2d Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/70993d2d Branch: refs/heads/master Commit: 70993d2d44a02c8edc48a7dc2ea0b79bded82d28 Parents: fdbd6a9 Author: Hanifi Gunes <hgu...@maprtech.com> Authored: Wed Oct 22 17:35:35 2014 -0700 Committer: Jinfeng Ni <j...@maprtech.com> Committed: Fri Nov 7 10:50:56 2014 -0800 ---------------------------------------------------------------------- .../apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/70993d2d/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java index 0c13990..9cc1808 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java @@ -123,7 +123,7 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements List<Integer> selectedPartitionColumns = Lists.newArrayList(); boolean selectAllColumns = false; - if (AbstractRecordReader.isStarQuery(columns) || columns == null || columns.size() == 0) { + if (columns == null || columns.size() == 0 || AbstractRecordReader.isStarQuery(columns)) { selectAllColumns = true; } else { List<SchemaPath> newColumns = Lists.newArrayList(); @@ -136,6 +136,12 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements newColumns.add(column); } } + + // We must make sure to pass a table column(not to be confused with partition column) to the underlying record + // reader. + if (newColumns.size()==0) { + newColumns.add(AbstractRecordReader.STAR_COLUMN); + } // Create a new sub scan object with the new set of columns; scan = new EasySubScan(scan.getWorkUnits(), scan.getFormatPlugin(), newColumns, scan.getSelectionRoot()); }