DRILL-1468: Ensure text reader returns all columns when the
field `columns` present in projected field list


Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/81fb18a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/81fb18a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/81fb18a0

Branch: refs/heads/master
Commit: 81fb18a08a07dd2ccf13194f614460cc27a2e2f3
Parents: 8773cb0
Author: Hanifi Gunes <hgu...@maprtech.com>
Authored: Mon Sep 29 18:34:03 2014 -0700
Committer: Steven Phillips <sphill...@maprtech.com>
Committed: Mon Sep 29 21:19:34 2014 -0700

----------------------------------------------------------------------
 .../exec/store/text/DrillTextRecordReader.java      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/81fb18a0/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java
index 7b8761c..e0cce8b 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/text/DrillTextRecordReader.java
@@ -18,9 +18,14 @@
 package org.apache.drill.exec.store.text;
 
 import java.io.IOException;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
+import javax.annotation.Nullable;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
 import org.apache.drill.common.exceptions.DrillRuntimeException;
 import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.common.expression.FieldReference;
@@ -102,6 +107,17 @@ public class DrillTextRecordReader extends 
AbstractRecordReader {
     }
   }
 
+  @Override
+  public boolean isStarQuery() {
+    return super.isStarQuery() || Iterables.tryFind(getColumns(), new 
Predicate<SchemaPath>() {
+      private final SchemaPath COLUMNS = SchemaPath.getSimplePath("columns");
+      @Override
+      public boolean apply(@Nullable SchemaPath path) {
+        return path.equals(COLUMNS);
+      }
+    }).isPresent();
+  }
+
   public OperatorContext getOperatorContext() {
     return operatorContext;
   }

Reply via email to