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

Switch to Threaded View
Drill, mail # dev - [4/4] git commit: Merge branch 'master' into execwork. Fix conflicts.


Copy link to this message
-
[4/4] git commit: Merge branch 'master' into execwork. Fix conflicts.
jacques@... 2013-06-19, 23:30
Merge branch 'master' into execwork.  Fix conflicts.

Conflicts:
sandbox/prototype/common/src/test/resources/logback.xml
sandbox/prototype/pom.xml
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/5a5d07f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/5a5d07f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/5a5d07f6

Branch: refs/heads/execwork
Commit: 5a5d07f69c17ed4c0f63d17f27cd652830a5d03e
Parents: 1be6bd4 97eb07a
Author: Jacques Nadeau <[EMAIL PROTECTED]>
Authored: Wed Jun 19 16:30:02 2013 -0700
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Wed Jun 19 16:30:02 2013 -0700

----------------------------------------------------------------------
 .../org/apache/drill/common/JSONOptions.java    |   4 +
 .../drill/common/logical/data/Constant.java     |  52 +++++++++
 .../apache/drill/common/logical/data/Scan.java  |  14 +--
 .../common/logical/data/SourceOperator.java     |   9 ++
 .../data/visitors/AbstractLogicalVisitor.java   |  32 ++++--
 .../logical/data/visitors/LogicalVisitor.java   |  18 +++
 .../apache/drill/exec/ref/rops/ConstantROP.java | 112 +++++++++++++++++++
 .../drill/exec/ref/rse/JSONRecordReader.java    |   2 +-
 .../drill/exec/ref/rops/ConstantROPTest.java    |  95 ++++++++++++++++
 .../exec/ref/src/test/resources/constant.json   |   4 +
 .../exec/ref/src/test/resources/constant2.json  |  42 +++++++
 sandbox/prototype/pom.xml                       |  46 ++++----
 sandbox/prototype/sqlline                       |  16 +++
 13 files changed, 404 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/5a5d07f6/sandbox/prototype/common/src/main/java/org/apache/drill/common/JSONOptions.java
----------------------------------------------------------------------
diff --cc sandbox/prototype/common/src/main/java/org/apache/drill/common/JSONOptions.java
index e309c60,0000000..8a185a4
mode 100644,000000..100644
--- a/sandbox/prototype/common/src/main/java/org/apache/drill/common/JSONOptions.java
+++ b/sandbox/prototype/common/src/main/java/org/apache/drill/common/JSONOptions.java
@@@ -1,111 -1,0 +1,115 @@@
 +/*******************************************************************************
 + * 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;
 +
 +import java.io.IOException;
 +import java.util.ArrayList;
 +import java.util.List;
 +
 +import com.fasterxml.jackson.core.*;
 +import com.fasterxml.jackson.core.type.TypeReference;
 +import com.fasterxml.jackson.databind.ObjectMapper;
 +import org.apache.drill.common.JSONOptions.De;
 +import org.apache.drill.common.JSONOptions.Se;
 +import org.apache.drill.common.config.DrillConfig;
 +import org.apache.drill.common.exceptions.LogicalPlanParsingException;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +import com.fasterxml.jackson.databind.DeserializationContext;
 +import com.fasterxml.jackson.databind.JsonNode;
 +import com.fasterxml.jackson.databind.SerializerProvider;
 +import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 +import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 +import com.fasterxml.jackson.databind.ser.std.StdSerializer;
 +
 +@JsonSerialize(using = Se.class)
 +@JsonDeserialize(using = De.class)
 +public class JSONOptions {
 +  
 +  final static Logger logger = LoggerFactory.getLogger(JSONOptions.class);
 +  
 +  private JsonNode root;
 +  private JsonLocation location;
 +  
 +  private JSONOptions(JsonNode n, JsonLocation location){
 +    this.root = n;
 +    this.location = location;
 +  }
 +  
 +  public <T> T getWith(DrillConfig config, Class<T> c){
 +    try {
 +      //logger.debug("Read tree {}", root);
 +      return config.getMapper().treeToValue(root, c);
 +    } catch (JsonProcessingException e) {
 +      throw new LogicalPlanParsingException(String.format("Failure while trying to convert late bound json options to type of %s. Reference was originally located at line %d, column %d.", c.getCanonicalName(), location.getLineNr(), location.getColumnNr()), e);
 +    }
 +  }
 +
 +  public <T> T getListWith(DrillConfig config, TypeReference<T> t) throws IOException {
 +      ObjectMapper mapper = config.getMapper();
 +      return mapper.treeAsTokens(root).readValueAs(t);
 +     // return mapper.treeToValue(root,  mapper.getTypeFactory().constructCollectionType(List.class, c));
 +  }
 +  
 +  public JsonNode path(String name){
 +    return root.path(name);
 +  }
++
++  public JsonNode getRoot(){
++      return root;
++  }
 +  
 +  public static class De extends StdDeserializer<JSONOptions> {
 +    
 +    public De() {
 +      super(JSONOptions.class);
 +      logger.debug("Creating Deserializer.");
 +    }
 +
 +    @Override
 +    public JSONOptions deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
 +        JsonProcessingException {
 +      JsonLocation l = jp.getT