[1/2] drill git commit: DRILL-4679: When convert() functions are present, ensure that ProjectRecordBatch produces a schema even for empty result set.

2016-05-20 Thread amansinha
Repository: drill
Updated Branches:
  refs/heads/master 1a8430eac -> 3d92d2829


DRILL-4679: When convert() functions are present, ensure that 
ProjectRecordBatch produces a schema even for empty result set.

Add unit tests

Modify doAlloc() to accept record count parameter (addresses review comment)


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

Branch: refs/heads/master
Commit: bd6079cb42f68d03922004abdb5f9182b8cb8caf
Parents: 1a8430e
Author: Aman Sinha 
Authored: Tue May 17 14:35:06 2016 -0700
Committer: Aman Sinha 
Committed: Fri May 20 13:52:04 2016 -0700

--
 .../expr/fn/DrillComplexWriterFuncHolder.java   |  4 ++
 .../impl/project/ProjectRecordBatch.java| 40 ++--
 .../physical/impl/TestConvertFunctions.java | 69 
 3 files changed, 109 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/drill/blob/bd6079cb/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
--
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
index 747a08b..a0bf134 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/DrillComplexWriterFuncHolder.java
@@ -44,6 +44,10 @@ public class DrillComplexWriterFuncHolder extends 
DrillSimpleFuncHolder{
 this.ref = ref;
   }
 
+  public FieldReference getReference() {
+return ref;
+  }
+
   @Override
   protected HoldingContainer generateEvalBody(ClassGenerator g, 
HoldingContainer[] inputVariables, String body, JVar[] workspaceJVars) {
 

http://git-wip-us.apache.org/repos/asf/drill/blob/bd6079cb/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
--
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
index 5ba7b5a..4ad5b8b 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
@@ -63,6 +63,7 @@ import org.apache.drill.exec.record.VectorWrapper;
 import org.apache.drill.exec.vector.AllocationHelper;
 import org.apache.drill.exec.vector.FixedWidthVector;
 import org.apache.drill.exec.vector.ValueVector;
+import org.apache.drill.exec.vector.complex.MapVector;
 import org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter;
 
 import com.carrotsearch.hppc.IntHashSet;
@@ -76,12 +77,14 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch {
   private Projector projector;
   private List allocationVectors;
   private List complexWriters;
+  private List complexExprList;
   private boolean hasRemainder = false;
   private int remainderIndex = 0;
   private int recordCount;
 
   private static final String EMPTY_STRING = "";
   private boolean first = true;
+  private boolean wasNone = false; // whether a NONE iter outcome was already 
seen
 
   private class ClassifierResult {
 public boolean isStar = false;
@@ -121,6 +124,9 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch {
 
   @Override
   public IterOutcome innerNext() {
+if (wasNone) {
+  return IterOutcome.NONE;
+}
 recordCount = 0;
 if (hasRemainder) {
   handleRemainder();
@@ -136,6 +142,10 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch {
 
   @Override
   protected IterOutcome doWork() {
+if (wasNone) {
+  return IterOutcome.NONE;
+}
+
 int incomingRecordCount = incoming.getRecordCount();
 
 if (first && incomingRecordCount == 0) {
@@ -146,6 +156,23 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch {
   if (next == IterOutcome.OUT_OF_MEMORY) {
 outOfMemory = true;
 return next;
+  } else if (next == IterOutcome.NONE) {
+// since this is first batch and we already got a NONE, need to 
set up the schema
+if (!doAlloc(0)) {
+  outOfMemory = true;
+  return IterOutcome.OUT_OF_MEMORY;
+}
+setValueCount(0);
+
+// Only need to add the 

[2/2] drill git commit: DRILL-4143: parquet metadata is only opened in drillbituser (process user)'s security context. Adding unit test for impersonated metadata update.

2016-05-20 Thread amansinha
DRILL-4143: parquet metadata is only opened in drillbituser (process user)'s 
security context. Adding unit test for impersonated metadata update.


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

Branch: refs/heads/master
Commit: 3d92d2829db2929e53c36df27f9979d6ff7a079a
Parents: bd6079c
Author: chunhui-shi 
Authored: Thu Apr 7 00:05:22 2016 -0700
Committer: Aman Sinha 
Committed: Fri May 20 14:49:19 2016 -0700

--
 .../drill/exec/store/parquet/Metadata.java  |  4 +++-
 .../TestImpersonationMetadata.java  | 24 
 2 files changed, 27 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/drill/blob/3d92d282/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
--
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
index 952f379..d7d31e5 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
@@ -27,7 +27,9 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.drill.common.expression.SchemaPath;
 import org.apache.drill.exec.store.TimedRunnable;
+import org.apache.drill.exec.store.dfs.DrillFileSystem;
 import org.apache.drill.exec.store.dfs.DrillPathFilter;
+import org.apache.drill.exec.util.ImpersonationUtil;
 import org.apache.hadoop.fs.BlockLocation;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -131,7 +133,7 @@ public class Metadata {
   }
 
   private Metadata(FileSystem fs) {
-this.fs = fs;
+this.fs = 
ImpersonationUtil.createFileSystem(ImpersonationUtil.getProcessUserName(), 
fs.getConf());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/drill/blob/3d92d282/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestImpersonationMetadata.java
--
diff --git 
a/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestImpersonationMetadata.java
 
b/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestImpersonationMetadata.java
index d5f191b..2121b6f 100644
--- 
a/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestImpersonationMetadata.java
+++ 
b/exec/java-exec/src/test/java/org/apache/drill/exec/impersonation/TestImpersonationMetadata.java
@@ -36,6 +36,7 @@ import java.util.Map;
 import static org.hamcrest.core.StringContains.containsString;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests impersonation on metadata related queries as SHOW FILES, SHOW TABLES, 
CREATE VIEW, CREATE TABLE and DROP TABLE
@@ -360,6 +361,29 @@ public class TestImpersonationMetadata extends 
BaseTestImpersonation {
 containsString("SYSTEM ERROR: RemoteException: Permission denied: 
user=drillTestUser2, access=WRITE, inode=\"/drillTestGrp0_755/"));
   }
 
+  @Test
+  public void testRefreshMetadata() throws Exception {
+final String tableName = "nation1";
+final String tableWS = "drillTestGrp1_700";
+
+updateClient(user1);
+test("USE " + Joiner.on(".").join(MINIDFS_STORAGE_PLUGIN_NAME, tableWS));
+
+test("CREATE TABLE " + tableName + " partition by (n_regionkey) AS SELECT 
* " +
+  "FROM cp.`tpch/nation.parquet`;");
+
+test( "refresh table metadata " + tableName + ";");
+
+test("SELECT * FROM " + tableName + ";");
+
+final Path tablePath = new Path(Path.SEPARATOR + tableWS + Path.SEPARATOR 
+ tableName);
+assertTrue ( fs.exists(tablePath) && fs.isDirectory(tablePath));
+fs.mkdirs(new Path(tablePath, "tmp5"));
+
+test("SELECT * from " + tableName + ";");
+
+  }
+
   @AfterClass
   public static void removeMiniDfsBasedStorage() throws Exception {
 
getDrillbitContext().getStorage().deletePlugin(MINIDFS_STORAGE_PLUGIN_NAME);



drill-site git commit: pull request: fix obdc => odbc spelling #505

2016-05-20 Thread bridgetb
Repository: drill-site
Updated Branches:
  refs/heads/asf-site d2b7c6611 -> d3a1b3eb2


pull request: fix obdc => odbc spelling #505


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

Branch: refs/heads/asf-site
Commit: d3a1b3eb261dbba1860ab7597cb2654b662ef940
Parents: d2b7c66
Author: Bridget Bevens 
Authored: Fri May 20 10:57:50 2016 -0700
Committer: Bridget Bevens 
Committed: Fri May 20 10:57:50 2016 -0700

--
 docs/configuring-odbc-on-linux/index.html | 4 ++--
 feed.xml  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/drill-site/blob/d3a1b3eb/docs/configuring-odbc-on-linux/index.html
--
diff --git a/docs/configuring-odbc-on-linux/index.html 
b/docs/configuring-odbc-on-linux/index.html
index 2853dbb..ae9104d 100644
--- a/docs/configuring-odbc-on-linux/index.html
+++ b/docs/configuring-odbc-on-linux/index.html
@@ -1064,7 +1064,7 @@
 
 
 
- 
+ May 20, 2016
 
 
 
@@ -1084,7 +1084,7 @@ steps:
 Sample Configuration Files
 
 Before you connect to Drill through an ODBC client tool
-on Linux, copy the following configuration files in 
/opt/mapr/drillobdc/Setup to your home directory unless the files 
already exist in your home directory:
+on Linux, copy the following configuration files in 
/opt/mapr/drillodbc/Setup to your home directory unless the files 
already exist in your home directory:
 
 
 mapr.drillodbc.ini

http://git-wip-us.apache.org/repos/asf/drill-site/blob/d3a1b3eb/feed.xml
--
diff --git a/feed.xml b/feed.xml
index c53b554..b27fcbd 100644
--- a/feed.xml
+++ b/feed.xml
@@ -6,8 +6,8 @@
 
 /
 
-Wed, 18 May 2016 11:48:35 -0700
-Wed, 18 May 2016 11:48:35 -0700
+Fri, 20 May 2016 10:54:25 -0700
+Fri, 20 May 2016 10:54:25 -0700
 Jekyll v2.5.2