Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Drill, mail # dev - [3/4] git commit: Added support for the 'constant' operator, necessary to implement the SQL values operator.


Copy link to this message
-
[3/4] git commit: Added support for the 'constant' operator, necessary to implement the SQL values operator.
jacques@... 2013-06-19, 23:30
Added support for the 'constant' operator, necessary to implement the SQL values operator.

Signed-off-by: Jacques Nadeau <[EMAIL PROTECTED]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/97eb07ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/97eb07ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/97eb07ac

Branch: refs/heads/execwork
Commit: 97eb07ac84a106345e169e3fbf7588896d4d99c1
Parents: 65ffe9b
Author: Jason Altekruse <[EMAIL PROTECTED]l>
Authored: Wed Jun 5 10:58:36 2013 -0700
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Wed Jun 19 09:00:44 2013 -0700

----------------------------------------------------------------------
 .../drill/common/logical/JSONOptions.java       |   4 +
 .../drill/common/logical/data/Constant.java     |  44 ++++++++
 .../common/src/test/resources/logback.xml       |   6 +-
 .../apache/drill/exec/ref/rops/ConstantROP.java | 112 +++++++++++++++++++
 .../drill/exec/ref/rse/JSONRecordReader.java    |   2 +-
 .../drill/exec/ref/rops/ConstantROPTest.java    |  97 ++++++++++++++++
 .../exec/ref/src/test/resources/constant.json   |   4 +
 .../exec/ref/src/test/resources/constant2.json  |  42 +++++++
 8 files changed, 307 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/97eb07ac/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/JSONOptions.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/JSONOptions.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/JSONOptions.java
index d4d97f6..bc8ca05 100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/JSONOptions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/JSONOptions.java
@@ -69,6 +69,10 @@ public class JSONOptions {
   public JsonNode path(String name){
     return root.path(name);
   }
+
+  public JsonNode getRoot(){
+      return root;
+  }
  
   private static synchronized ObjectMapper getMapper(){
     if(MAPPER == null){

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/97eb07ac/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Constant.java
----------------------------------------------------------------------
diff --git a/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Constant.java b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Constant.java
new file mode 100644
index 0000000..84d5939
--- /dev/null
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/logical/data/Constant.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.apache.drill.common.logical.data;
+
+import com.google.common.base.Preconditions;
+import org.apache.drill.common.expression.FieldReference;
+import org.apache.drill.common.logical.JSONOptions;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+@JsonTypeName("constant")
+public class Constant extends SourceOperator{
+
+    private final JSONOptions content;
+
+    @JsonCreator
+    public Constant(@JsonProperty("content") JSONOptions content){
+        super();
+        this.content = content;
+        Preconditions.checkNotNull(content, "content attribute is required for source operator 'constant'.");
+    }
+
+    public JSONOptions getContent() {
+        return content;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/97eb07ac/sandbox/prototype/common/src/test/resources/logback.xml
diff --git a/sandbox/prototype/common/src/test/resources/logback.xml b/sandbox/prototype/common/src/test/resources/logback.xml
index fbccc38..dc62c42 100644
+++ b/sandbox/prototype/common/src/test/resources/logback.xml
@@ -22,13 +22,13 @@
       <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
     </encoder>
     <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-    <!-- daily rollover -->
+
     <fileNamePattern>/logs/test-common.%d{yyyy-MM-dd}.log</fileNamePattern>
-    <!-- keep 30 days' worth of history -->
+
     <maxHistory>30</maxHistory>
     </rollingPolicy>
   </appender>
-  
+
   <logger name="org.apache.drill" additivity="false">
     <level value="debug" />
     <appender-ref ref="SOCKET" />

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/97eb07ac/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/rops/ConstantROP.java
diff --git a/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/rops/ConstantROP.java b/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/rops/ConstantROP.java
new file mode 10