Repository: drill
Updated Branches:
  refs/heads/master e57514aad -> d105950a7


http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/parquet/metadata_files_with_old_versions/v3_1/metadata_table_t2.requires_replace.txt
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/parquet/metadata_files_with_old_versions/v3_1/metadata_table_t2.requires_replace.txt
 
b/exec/java-exec/src/test/resources/parquet/metadata_files_with_old_versions/v3_1/metadata_table_t2.requires_replace.txt
new file mode 100644
index 0000000..b611d13
--- /dev/null
+++ 
b/exec/java-exec/src/test/resources/parquet/metadata_files_with_old_versions/v3_1/metadata_table_t2.requires_replace.txt
@@ -0,0 +1,76 @@
+{
+  "metadata_version" : "3.1",
+  "columnTypeInfo" : {
+    "n_name" : {
+      "name" : [ "n_name" ],
+      "primitiveType" : "BINARY",
+      "originalType" : "UTF8",
+      "precision" : 0,
+      "scale" : 0,
+      "repetitionLevel" : 0,
+      "definitionLevel" : 0
+    },
+    "n_nationkey" : {
+      "name" : [ "n_nationkey" ],
+      "primitiveType" : "INT32",
+      "originalType" : null,
+      "precision" : 0,
+      "scale" : 0,
+      "repetitionLevel" : 0,
+      "definitionLevel" : 0
+    },
+    "n_regionkey" : {
+      "name" : [ "n_regionkey" ],
+      "primitiveType" : "INT32",
+      "originalType" : null,
+      "precision" : 0,
+      "scale" : 0,
+      "repetitionLevel" : 0,
+      "definitionLevel" : 0
+    },
+    "n_comment" : {
+      "name" : [ "n_comment" ],
+      "primitiveType" : "BINARY",
+      "originalType" : "UTF8",
+      "precision" : 0,
+      "scale" : 0,
+      "repetitionLevel" : 0,
+      "definitionLevel" : 0
+    }
+  },
+  "files" : [ {
+    "path" : "0_0_0.parquet",
+    "length" : 2424,
+    "rowGroups" : [ {
+      "start" : 4,
+      "length" : 1802,
+      "rowCount" : 25,
+      "hostAffinity" : {
+        "localhost" : 1.0
+      },
+      "columns" : [ {
+        "name" : [ "n_nationkey" ],
+        "minValue" : 0,
+        "maxValue" : 24,
+        "nulls" : 0
+      }, {
+        "name" : [ "n_name" ],
+        "minValue" : "ALGERIA",
+        "maxValue" : "VIETNAM",
+        "nulls" : 0
+      }, {
+        "name" : [ "n_regionkey" ],
+        "minValue" : 0,
+        "maxValue" : 4,
+        "nulls" : 0
+      }, {
+        "name" : [ "n_comment" ],
+        "minValue" : " haggle. carefully final deposits detect slyly agai",
+        "maxValue" : "y final packages. slow foxes cajole quickly. quickly 
silent platelets breach ironic accounts. unusual pinto be",
+        "nulls" : 0
+      } ]
+    } ]
+  } ],
+  "directories" : [ ],
+  "drillVersion" : "1.12.0-SNAPSHOT"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_directories_with_absolute_paths.requires_replace.txt
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_directories_with_absolute_paths.requires_replace.txt
 
b/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_directories_with_absolute_paths.requires_replace.txt
deleted file mode 100644
index 8a9989d..0000000
--- 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_directories_with_absolute_paths.requires_replace.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "directories" : [ "file:REPLACED_IN_TEST/absolute_paths_metadata/t1", 
"file:REPLACED_IN_TEST/absolute_paths_metadata/t2" ]
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths.requires_replace.txt
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths.requires_replace.txt
 
b/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths.requires_replace.txt
deleted file mode 100644
index e3734f3..0000000
--- 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths.requires_replace.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-{
-  "metadata_version" : "v3",
-  "columnTypeInfo" : {
-    "n_name" : {
-      "name" : [ "n_name" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_nationkey" : {
-      "name" : [ "n_nationkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_regionkey" : {
-      "name" : [ "n_regionkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_comment" : {
-      "name" : [ "n_comment" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    }
-  },
-  "files" : [ {
-    "path" : "REPLACED_IN_TEST/absolute_paths_metadata/t1/0_0_0.parquet",
-    "length" : 2424,
-    "rowGroups" : [ {
-      "start" : 4,
-      "length" : 1802,
-      "rowCount" : 25,
-      "hostAffinity" : {
-        "localhost" : 1.0
-      },
-      "columns" : [ {
-        "name" : [ "n_nationkey" ],
-        "minValue" : 0,
-        "maxValue" : 24,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_name" ],
-        "minValue" : "ALGERIA",
-        "maxValue" : "VIETNAM",
-        "nulls" : 0
-      }, {
-        "name" : [ "n_regionkey" ],
-        "minValue" : 0,
-        "maxValue" : 4,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_comment" ],
-        "minValue" : " haggle. carefully final deposits detect slyly agai",
-        "maxValue" : "y final packages. slow foxes cajole quickly. quickly 
silent platelets breach ironic accounts. unusual pinto be",
-        "nulls" : 0
-      } ]
-    } ]
-  }, {
-    "path" : "REPLACED_IN_TEST/absolute_paths_metadata/t2/0_0_0.parquet",
-    "length" : 2424,
-    "rowGroups" : [ {
-      "start" : 4,
-      "length" : 1802,
-      "rowCount" : 25,
-      "hostAffinity" : {
-        "localhost" : 1.0
-      },
-      "columns" : [ {
-        "name" : [ "n_nationkey" ],
-        "minValue" : 0,
-        "maxValue" : 24,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_name" ],
-        "minValue" : "ALGERIA",
-        "maxValue" : "VIETNAM",
-        "nulls" : 0
-      }, {
-        "name" : [ "n_regionkey" ],
-        "minValue" : 0,
-        "maxValue" : 4,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_comment" ],
-        "minValue" : " haggle. carefully final deposits detect slyly agai",
-        "maxValue" : "y final packages. slow foxes cajole quickly. quickly 
silent platelets breach ironic accounts. unusual pinto be",
-        "nulls" : 0
-      } ]
-    } ]
-  } ],
-  "directories" : [ "file:REPLACED_IN_TEST/absolute_paths_metadata/t1", 
"file:REPLACED_IN_TEST/absolute_paths_metadata/t2" ],
-  "drillVersion" : "1.11.0"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t1.requires_replace.txt
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t1.requires_replace.txt
 
b/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t1.requires_replace.txt
deleted file mode 100644
index 62a8c80..0000000
--- 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t1.requires_replace.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-  "metadata_version" : "v3",
-  "columnTypeInfo" : {
-    "n_name" : {
-      "name" : [ "n_name" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_nationkey" : {
-      "name" : [ "n_nationkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_regionkey" : {
-      "name" : [ "n_regionkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_comment" : {
-      "name" : [ "n_comment" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    }
-  },
-  "files" : [ {
-    "path" : "REPLACED_IN_TEST/absolute_paths_metadata/t1/0_0_0.parquet",
-    "length" : 2424,
-    "rowGroups" : [ {
-      "start" : 4,
-      "length" : 1802,
-      "rowCount" : 25,
-      "hostAffinity" : {
-        "localhost" : 1.0
-      },
-      "columns" : [ {
-        "name" : [ "n_nationkey" ],
-        "minValue" : 0,
-        "maxValue" : 24,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_name" ],
-        "minValue" : "ALGERIA",
-        "maxValue" : "VIETNAM",
-        "nulls" : 0
-      }, {
-        "name" : [ "n_regionkey" ],
-        "minValue" : 0,
-        "maxValue" : 4,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_comment" ],
-        "minValue" : " haggle. carefully final deposits detect slyly agai",
-        "maxValue" : "y final packages. slow foxes cajole quickly. quickly 
silent platelets breach ironic accounts. unusual pinto be",
-        "nulls" : 0
-      } ]
-    } ]
-  } ],
-  "directories" : [ ],
-  "drillVersion" : "1.11.0"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t2.requires_replace.txt
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t2.requires_replace.txt
 
b/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t2.requires_replace.txt
deleted file mode 100644
index b70c8fa..0000000
--- 
a/exec/java-exec/src/test/resources/parquet/metadata_with_absolute_path/metadata_table_with_absolute_paths_t2.requires_replace.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-  "metadata_version" : "v3",
-  "columnTypeInfo" : {
-    "n_name" : {
-      "name" : [ "n_name" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_nationkey" : {
-      "name" : [ "n_nationkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_regionkey" : {
-      "name" : [ "n_regionkey" ],
-      "primitiveType" : "INT32",
-      "originalType" : null,
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    },
-    "n_comment" : {
-      "name" : [ "n_comment" ],
-      "primitiveType" : "BINARY",
-      "originalType" : "UTF8",
-      "precision" : 0,
-      "scale" : 0,
-      "repetitionLevel" : 0,
-      "definitionLevel" : 0
-    }
-  },
-  "files" : [ {
-    "path" : "REPLACED_IN_TEST/absolute_paths_metadata/t2/0_0_0.parquet",
-    "length" : 2424,
-    "rowGroups" : [ {
-      "start" : 4,
-      "length" : 1802,
-      "rowCount" : 25,
-      "hostAffinity" : {
-        "localhost" : 1.0
-      },
-      "columns" : [ {
-        "name" : [ "n_nationkey" ],
-        "minValue" : 0,
-        "maxValue" : 24,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_name" ],
-        "minValue" : "ALGERIA",
-        "maxValue" : "VIETNAM",
-        "nulls" : 0
-      }, {
-        "name" : [ "n_regionkey" ],
-        "minValue" : 0,
-        "maxValue" : 4,
-        "nulls" : 0
-      }, {
-        "name" : [ "n_comment" ],
-        "minValue" : " haggle. carefully final deposits detect slyly agai",
-        "maxValue" : "y final packages. slow foxes cajole quickly. quickly 
silent platelets breach ironic accounts. unusual pinto be",
-        "nulls" : 0
-      } ]
-    } ]
-  } ],
-  "directories" : [ ],
-  "drillVersion" : "1.11.0"
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/java-exec/src/test/resources/store/parquet/complex/baseline8.json
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/test/resources/store/parquet/complex/baseline8.json 
b/exec/java-exec/src/test/resources/store/parquet/complex/baseline8.json
index 290d896..095ef11 100644
--- a/exec/java-exec/src/test/resources/store/parquet/complex/baseline8.json
+++ b/exec/java-exec/src/test/resources/store/parquet/complex/baseline8.json
@@ -1,16 +1,21 @@
 {
-  "notexists" : null,
-  "id" : 4
+  "notexists1" : null,
+  "id" : 4,
+  "notexists2" : null
 } {
-  "notexists" : null,
-  "id" : 6
+  "notexists1" : null,
+  "id" : 6,
+  "notexists2" : null
 } {
-  "notexists" : null,
-  "id" : 17
+  "notexists1" : null,
+  "id" : 17,
+  "notexists2" : null
 } {
-  "notexists" : null,
-  "id" : 17
+  "notexists1" : null,
+  "id" : 17,
+  "notexists2" : null
 } {
-  "notexists" : null,
-  "id" : 8
+  "notexists1" : null,
+  "id" : 8,
+  "notexists2" : null
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillColumnMetaDataList.java
----------------------------------------------------------------------
diff --git 
a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillColumnMetaDataList.java
 
b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillColumnMetaDataList.java
index 79007bb..90dcafe 100644
--- 
a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillColumnMetaDataList.java
+++ 
b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillColumnMetaDataList.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -118,9 +118,9 @@ public class DrillColumnMetaDataList extends 
BasicList<ColumnMetaData>{
         new ArrayList<>(schema.getFieldCount());
     for (int colOffset = 0; colOffset < schema.getFieldCount(); colOffset++) {
       final MaterializedField field = schema.getColumn(colOffset);
-      Class<?> objectClass = getObjectClasses.get( colOffset );
+      Class<?> objectClass = getObjectClasses.get(colOffset);
 
-      final String columnName = field.getPath();
+      final String columnName = field.getName();
 
       final MajorType rpcDataType = field.getType();
       final AvaticaType bundledSqlDataType = getAvaticaType(rpcDataType);

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/jdbc/src/test/java/org/apache/drill/jdbc/DrillColumnMetaDataListTest.java
----------------------------------------------------------------------
diff --git 
a/exec/jdbc/src/test/java/org/apache/drill/jdbc/DrillColumnMetaDataListTest.java
 
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/DrillColumnMetaDataListTest.java
index 9bd8502..be21d3b 100644
--- 
a/exec/jdbc/src/test/java/org/apache/drill/jdbc/DrillColumnMetaDataListTest.java
+++ 
b/exec/jdbc/src/test/java/org/apache/drill/jdbc/DrillColumnMetaDataListTest.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -68,13 +68,13 @@ public class DrillColumnMetaDataListTest {
     // Create mock columns
     final MaterializedField exampleIntField = mock(MaterializedField.class);
     MajorType exampleIntType = 
MajorType.newBuilder().setMinorType(MinorType.INT).build();
-    when(exampleIntField.getPath()).thenReturn("/path/to/testInt");
+    when(exampleIntField.getName()).thenReturn("/path/to/testInt");
     when(exampleIntField.getType()).thenReturn(exampleIntType);
     when(exampleIntField.getDataMode()).thenReturn(DataMode.OPTIONAL);
 
     final MaterializedField exampleStringField = mock(MaterializedField.class);
     MajorType exampleStringType = 
MajorType.newBuilder().setMinorType(MinorType.VARCHAR).build();
-    when(exampleStringField.getPath()).thenReturn("/path/to/testString");
+    when(exampleStringField.getName()).thenReturn("/path/to/testString");
     when(exampleStringField.getType()).thenReturn(exampleStringType);
     when(exampleStringField.getDataMode()).thenReturn(DataMode.REQUIRED);
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/FixedValueVectors.java 
b/exec/vector/src/main/codegen/templates/FixedValueVectors.java
index e8cdcf8..bbda672 100644
--- a/exec/vector/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/vector/src/main/codegen/templates/FixedValueVectors.java
@@ -220,7 +220,8 @@ public final class ${minor.class}Vector extends 
BaseDataValueVector implements F
 
   @Override
   public void load(SerializedField metadata, DrillBuf buffer) {
-    
Preconditions.checkArgument(this.field.getPath().equals(metadata.getNamePart().getName()),
 "The field %s doesn't match the provided metadata %s.", this.field, metadata);
+    
Preconditions.checkArgument(this.field.getName().equals(metadata.getNamePart().getName()),
+                                "The field %s doesn't match the provided 
metadata %s.", this.field, metadata);
     final int actualLength = metadata.getBufferLength();
     final int valueCount = metadata.getValueCount();
     final int expectedLength = valueCount * VALUE_WIDTH;

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java 
b/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
index bc1ec3a..1ecedc6 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/record/MaterializedField.java
@@ -47,7 +47,7 @@ public class MaterializedField {
     this.children = children;
   }
 
-  public static MaterializedField create(SerializedField serField){
+  public static MaterializedField create(SerializedField serField) {
     LinkedHashSet<MaterializedField> children = new LinkedHashSet<>();
     for (SerializedField sf : serField.getChildList()) {
       children.add(MaterializedField.create(sf));
@@ -66,7 +66,7 @@ public class MaterializedField {
     return serializedFieldBuilder.build();
   }
 
-  public SerializedField.Builder getAsBuilder(){
+  public SerializedField.Builder getAsBuilder() {
     return SerializedField.newBuilder()
         .setMajorType(type)
         .setNamePart(NamePart.newBuilder().setName(name).build());
@@ -82,7 +82,7 @@ public class MaterializedField {
     return newField;
   }
 
-  public void addChild(MaterializedField field){
+  public void addChild(MaterializedField field) {
     children.add(field);
   }
 
@@ -106,47 +106,16 @@ public class MaterializedField {
     return new MaterializedField(name, type, newChildren);
   }
 
-//  public String getLastName(){
-//    PathSegment seg = key.path.getRootSegment();
-//    while (seg.getChild() != null) {
-//      seg = seg.getChild();
-//    }
-//    return seg.getNameSegment().getPath();
-//  }
-
   // TODO: rewrite without as direct match rather than conversion then match.
-  public boolean matches(SerializedField field){
+  public boolean matches(SerializedField field) {
     MaterializedField f = create(field);
     return f.equals(this);
   }
 
-  public static MaterializedField create(String name, MajorType type){
+  public static MaterializedField create(String name, MajorType type) {
     return new MaterializedField(name, type, new 
LinkedHashSet<MaterializedField>());
   }
 
-//  public String getName(){
-//    StringBuilder sb = new StringBuilder();
-//    boolean first = true;
-//    for(NamePart np : def.getNameList()){
-//      if(np.getType() == Type.ARRAY){
-//        sb.append("[]");
-//      }else{
-//        if(first){
-//          first = false;
-//        }else{
-//          sb.append(".");
-//        }
-//        sb.append('`');
-//        sb.append(np.getName());
-//        sb.append('`');
-//
-//      }
-//    }
-//    return sb.toString();
-//  }
-
-  public String getPath() { return getName(); }
-  public String getLastName() { return getName(); }
   public String getName() { return name; }
   public int getWidth() { return type.getWidth(); }
   public MajorType getType() { return type; }

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
index 2179829..2b6fde0 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/BaseValueVector.java
@@ -71,13 +71,13 @@ public abstract class BaseValueVector implements 
ValueVector {
     return field;
   }
 
-  public MaterializedField getField(String ref){
+  public MaterializedField getField(String ref) {
     return getField().withPath(ref);
   }
 
   @Override
   public TransferPair getTransferPair(BufferAllocator allocator) {
-    return getTransferPair(getField().getPath(), allocator);
+    return getTransferPair(getField().getName(), allocator);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
index 4d7098b..f879fc4 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/BitVector.java
@@ -221,7 +221,8 @@ public final class BitVector extends BaseDataValueVector 
implements FixedWidthVe
 
   @Override
   public void load(SerializedField metadata, DrillBuf buffer) {
-    
Preconditions.checkArgument(this.field.getPath().equals(metadata.getNamePart().getName()),
 "The field %s doesn't match the provided metadata %s.", this.field, metadata);
+    
Preconditions.checkArgument(this.field.getName().equals(metadata.getNamePart().getName()),
+                                "The field %s doesn't match the provided 
metadata %s.", this.field, metadata);
     final int valueCount = metadata.getValueCount();
     final int expectedLength = getSizeFromCount(valueCount);
     final int actualLength = metadata.getBufferLength();
@@ -280,7 +281,7 @@ public final class BitVector extends BaseDataValueVector 
implements FixedWidthVe
       if (target.data != null) {
         target.data.release();
       }
-      target.data = (DrillBuf) data.slice(firstByte, byteSize);
+      target.data = data.slice(firstByte, byteSize);
       target.data.retain(1);
     } else {
       // Copy data

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/VectorDescriptor.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/VectorDescriptor.java 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/VectorDescriptor.java
index dc8928e..7f1a3a6 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/VectorDescriptor.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/VectorDescriptor.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -49,7 +49,7 @@ public class VectorDescriptor {
   }
 
   public String getName() {
-    return field.getLastName();
+    return field.getName();
   }
 
   public Collection<MaterializedField> getChildren() {
@@ -57,7 +57,7 @@ public class VectorDescriptor {
   }
 
   public boolean hasName() {
-    return getName() != DEFAULT_NAME;
+    return !DEFAULT_NAME.equals(getName());
   }
 
   public VectorDescriptor withName(final String name) {

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleAccessor.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleAccessor.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleAccessor.java
index 2ebb32c..ea9b869 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleAccessor.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleAccessor.java
@@ -48,8 +48,20 @@ public interface TupleAccessor {
 
     MaterializedField column(int index);
 
+    /**
+     * Returns {@code MaterializedField} instance from schema using the name 
specified in param.
+     *
+     * @param name name of the column in the schema
+     * @return {@code MaterializedField} instance
+     */
     MaterializedField column(String name);
 
+    /**
+     * Returns index of the column in the schema with name specified in param.
+     *
+     * @param name name of the column in the schema
+     * @return index of the column in the schema
+     */
     int columnIndex(String name);
 
     int count();

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleReader.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleReader.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleReader.java
index 57425af..acca767 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleReader.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleReader.java
@@ -27,6 +27,13 @@ package org.apache.drill.exec.vector.accessor;
 
 public interface TupleReader extends TupleAccessor {
   ColumnReader column(int colIndex);
+
+  /**
+   * Returns column reader for the column with name specified in param.
+   *
+   * @param colName name of the column in the schema
+   * @return column reader
+   */
   ColumnReader column(String colName);
   Object get(int colIndex);
   String getAsString(int colIndex);

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleWriter.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleWriter.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleWriter.java
index 59eca79..563734e 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleWriter.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/accessor/TupleWriter.java
@@ -29,6 +29,13 @@ package org.apache.drill.exec.vector.accessor;
 
 public interface TupleWriter extends TupleAccessor {
   ColumnWriter column(int colIndex);
+
+  /**
+   * Returns column writer for the column with name specified in param.
+   *
+   * @param colName name of the column in the schema
+   * @return column writer
+   */
   ColumnWriter column(String colName);
   void set(int colIndex, Object value);
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
index 2c5baa3..d5b66f9 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractContainerVector.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -88,7 +88,7 @@ public abstract class AbstractContainerVector implements 
ValueVector {
       @Nullable
       @Override
       public String apply(MaterializedField field) {
-        return Preconditions.checkNotNull(field).getLastName();
+        return Preconditions.checkNotNull(field).getName();
       }
     }));
   }
@@ -96,9 +96,9 @@ public abstract class AbstractContainerVector implements 
ValueVector {
   /**
    * Clears out all underlying child vectors.
    */
- @Override
+  @Override
   public void close() {
-    for (ValueVector vector:(Iterable<ValueVector>)this) {
+    for (ValueVector vector : this) {
       vector.close();
     }
   }
@@ -112,14 +112,14 @@ public abstract class AbstractContainerVector implements 
ValueVector {
   }
 
   MajorType getLastPathType() {
-    if((this.getField().getType().getMinorType() == MinorType.LIST  &&
+    if ((this.getField().getType().getMinorType() == MinorType.LIST &&
         this.getField().getType().getMode() == DataMode.REPEATED)) {  // Use 
Repeated scalar type instead of Required List.
       VectorWithOrdinal vord = getChildVectorWithOrdinal(null);
       ValueVector v = vord.vector;
-      if (! (v instanceof  AbstractContainerVector)) {
+      if (!(v instanceof AbstractContainerVector)) {
         return v.getField().getType();
       }
-    } else if (this.getField().getType().getMinorType() == MinorType.MAP  &&
+    } else if (this.getField().getType().getMinorType() == MinorType.MAP &&
         this.getField().getType().getMode() == DataMode.REPEATED) {  // Use 
Required Map
       return 
this.getField().getType().toBuilder().setMode(DataMode.REQUIRED).build();
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
index 30db41e..6b60471 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/AbstractMapVector.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -43,7 +43,7 @@ public abstract class AbstractMapVector extends 
AbstractContainerVector {
   private static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(AbstractContainerVector.class);
 
   // Maintains a map with key as field name and value is the vector itself
-  private final MapWithOrdinal<String, ValueVector> vectors =  new 
MapWithOrdinal<>();
+  private final MapWithOrdinal<String, ValueVector> vectors = new 
MapWithOrdinal<>();
 
   protected AbstractMapVector(MaterializedField field, BufferAllocator 
allocator, CallBack callBack) {
     super(field.clone(), allocator, callBack);
@@ -51,7 +51,7 @@ public abstract class AbstractMapVector extends 
AbstractContainerVector {
     // create the hierarchy of the child vectors based on the materialized 
field
     for (MaterializedField child : clonedField.getChildren()) {
       if (!child.equals(BaseRepeatedValueVector.OFFSETS_FIELD)) {
-        final String fieldName = child.getLastName();
+        final String fieldName = child.getName();
         final ValueVector v = BasicTypeHelper.getNewVector(child, allocator, 
callBack);
         putVector(fieldName, v);
       }
@@ -60,7 +60,7 @@ public abstract class AbstractMapVector extends 
AbstractContainerVector {
 
   @Override
   public void close() {
-    for(final ValueVector valueVector : vectors.values()) {
+    for (final ValueVector valueVector : vectors.values()) {
       valueVector.close();
     }
     vectors.clear();
@@ -135,7 +135,7 @@ public abstract class AbstractMapVector extends 
AbstractContainerVector {
     if (create) {
       final T vector = (T) BasicTypeHelper.getNewVector(name, allocator, type, 
callBack);
       putChild(name, vector);
-      if (callBack!=null) {
+      if (callBack != null) {
         callBack.doWork();
       }
       return vector;

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
index c61fd00..9569946 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/ListVector.java
@@ -14,7 +14,7 @@
  * 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.exec.vector.complex;
 
 import com.google.common.collect.ObjectArrays;
@@ -259,7 +259,7 @@ public class ListVector extends BaseRepeatedValueVector {
   }
 
   public UnionVector promoteToUnion() {
-    MaterializedField newField = 
MaterializedField.create(getField().getPath(), Types.optional(MinorType.UNION));
+    MaterializedField newField = 
MaterializedField.create(getField().getName(), Types.optional(MinorType.UNION));
     UnionVector vector = new UnionVector(newField, allocator, null);
     replaceDataVector(vector);
     reader = new UnionListReader(this);

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
index f9ff58d..19c910b 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/MapVector.java
@@ -105,7 +105,7 @@ public class MapVector extends AbstractMapVector {
 
   @Override
   public void setInitialCapacity(int numRecords) {
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
+    for (final ValueVector v : this) {
       v.setInitialCapacity(numRecords);
     }
   }
@@ -116,7 +116,7 @@ public class MapVector extends AbstractMapVector {
       return 0;
     }
     long buffer = 0;
-    for (final ValueVector v : (Iterable<ValueVector>)this) {
+    for (final ValueVector v : this) {
       buffer += v.getBufferSize();
     }
 
@@ -130,7 +130,7 @@ public class MapVector extends AbstractMapVector {
     }
 
     long bufferSize = 0;
-    for (final ValueVector v : (Iterable<ValueVector>) this) {
+    for (final ValueVector v : this) {
       bufferSize += v.getBufferSizeFor(valueCount);
     }
 
@@ -147,7 +147,7 @@ public class MapVector extends AbstractMapVector {
 
   @Override
   public TransferPair getTransferPair(BufferAllocator allocator) {
-    return new MapTransferPair(this, getField().getPath(), allocator);
+    return new MapTransferPair(this, getField().getName(), allocator);
   }
 
   @Override
@@ -268,11 +268,11 @@ public class MapVector extends AbstractMapVector {
     for (final SerializedField child : fields) {
       final MaterializedField fieldDef = MaterializedField.create(child);
 
-      ValueVector vector = getChild(fieldDef.getLastName());
+      ValueVector vector = getChild(fieldDef.getName());
       if (vector == null) {
         // if we arrive here, we didn't have a matching vector.
         vector = BasicTypeHelper.getNewVector(fieldDef, allocator);
-        putChild(fieldDef.getLastName(), vector);
+        putChild(fieldDef.getName(), vector);
       }
       if (child.getValueCount() == 0) {
         vector.clear();

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
index 999e29e..ae1f0b1 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/RepeatedMapVector.java
@@ -88,7 +88,7 @@ public class RepeatedMapVector extends AbstractMapVector
   @Override
   public void setInitialCapacity(int numRecords) {
     offsets.setInitialCapacity(numRecords + 1);
-    for(final ValueVector v : (Iterable<ValueVector>) this) {
+    for (final ValueVector v : this) {
       v.setInitialCapacity(numRecords * 
RepeatedValueVector.DEFAULT_REPEAT_PER_RECORD);
     }
   }
@@ -159,7 +159,7 @@ public class RepeatedMapVector extends AbstractMapVector
 
   @Override
   public TransferPair getTransferPair(BufferAllocator allocator) {
-    return new RepeatedMapTransferPair(this, getField().getPath(), allocator);
+    return new RepeatedMapTransferPair(this, getField().getName(), allocator);
   }
 
   @Override
@@ -442,11 +442,11 @@ public class RepeatedMapVector extends AbstractMapVector
     for (int i = 1; i < children.size(); i++) {
       final SerializedField child = children.get(i);
       final MaterializedField fieldDef = MaterializedField.create(child);
-      ValueVector vector = getChild(fieldDef.getLastName());
+      ValueVector vector = getChild(fieldDef.getName());
       if (vector == null) {
         // if we arrive here, we didn't have a matching vector.
         vector = BasicTypeHelper.getNewVector(fieldDef, allocator);
-        putChild(fieldDef.getLastName(), vector);
+        putChild(fieldDef.getName(), vector);
       }
       final int vectorLength = child.getBufferLength();
       vector.load(child, buffer.slice(bufOffset, vectorLength));
@@ -486,7 +486,7 @@ public class RepeatedMapVector extends AbstractMapVector
         final Map<String, Object> vv = Maps.newLinkedHashMap();
         for (final MaterializedField field : getField().getChildren()) {
           if (!field.equals(BaseRepeatedValueVector.OFFSETS_FIELD)) {
-            fieldName = field.getLastName();
+            fieldName = field.getName();
             final Object value = 
getChild(fieldName).getAccessor().getObject(i);
             if (value != null) {
               vv.put(fieldName, value);

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
----------------------------------------------------------------------
diff --git 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
index dbbd092..10ac551 100644
--- 
a/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
+++ 
b/exec/vector/src/main/java/org/apache/drill/exec/vector/complex/impl/PromotableWriter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -149,7 +149,7 @@ public class PromotableWriter extends 
AbstractPromotableFieldWriter {
   }
 
   private FieldWriter promoteToUnion() {
-    String name = vector.getField().getLastName();
+    String name = vector.getField().getName();
     TransferPair tp = 
vector.getTransferPair(vector.getField().getType().getMinorType().name().toLowerCase(),
 vector.getAllocator());
     tp.transfer();
     if (parentContainer != null) {

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/logical/src/main/java/org/apache/drill/common/expression/FieldReference.java
----------------------------------------------------------------------
diff --git 
a/logical/src/main/java/org/apache/drill/common/expression/FieldReference.java 
b/logical/src/main/java/org/apache/drill/common/expression/FieldReference.java
index ba3bf7a..967ca9e 100644
--- 
a/logical/src/main/java/org/apache/drill/common/expression/FieldReference.java
+++ 
b/logical/src/main/java/org/apache/drill/common/expression/FieldReference.java
@@ -51,19 +51,8 @@ public class FieldReference extends SchemaPath {
     }
   }
 
-  private void checkSimpleString(CharSequence value) {
-    if (value.toString().contains(".")) {
-      throw new UnsupportedOperationException(
-          String.format(
-              "Unhandled field reference \"%s\"; a field reference identifier"
-              + " must not have the form of a qualified name (i.e., with 
\".\").",
-              value));
-    }
-  }
-
   public FieldReference(CharSequence value) {
     this(value, ExpressionPosition.UNKNOWN);
-    checkSimpleString(value);
   }
 
   /**
@@ -87,7 +76,6 @@ public class FieldReference extends SchemaPath {
     super(new NameSegment(value), pos);
     if (check) {
       checkData();
-      checkSimpleString(value);
     }
   }
 
@@ -117,7 +105,7 @@ public class FieldReference extends SchemaPath {
         JsonProcessingException {
       String ref = this._parseString(jp, ctxt);
       ref = ref.replace("`", "");
-      return new FieldReference(ref, ExpressionPosition.UNKNOWN, false);
+      return new FieldReference(ref, ExpressionPosition.UNKNOWN, true);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/logical/src/main/java/org/apache/drill/common/expression/PathSegment.java
----------------------------------------------------------------------
diff --git 
a/logical/src/main/java/org/apache/drill/common/expression/PathSegment.java 
b/logical/src/main/java/org/apache/drill/common/expression/PathSegment.java
index 744a07f..16bb255 100644
--- a/logical/src/main/java/org/apache/drill/common/expression/PathSegment.java
+++ b/logical/src/main/java/org/apache/drill/common/expression/PathSegment.java
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -17,11 +17,15 @@
  */
 package org.apache.drill.common.expression;
 
-public abstract class PathSegment{
+public abstract class PathSegment {
 
-  PathSegment child;
+  private PathSegment child;
 
-  int hash;
+  private int hash;
+
+  public PathSegment(PathSegment child) {
+    this.child = child;
+  }
 
   public abstract PathSegment cloneWithNewChild(PathSegment segment);
   @Override
@@ -35,13 +39,13 @@ public abstract class PathSegment{
     }
 
     public ArraySegment(int index, PathSegment child) {
-      this.child = child;
+      super(child);
       this.index = index;
-      assert index >=0;
+      assert index >= 0;
     }
 
     public ArraySegment(PathSegment child) {
-      this.child = child;
+      super(child);
       this.index = -1;
     }
 
@@ -50,6 +54,7 @@ public abstract class PathSegment{
     }
 
     public ArraySegment(int index) {
+      super(null);
       if (index < 0 ) {
         throw new IllegalArgumentException();
       }
@@ -100,8 +105,8 @@ public abstract class PathSegment{
     @Override
     public PathSegment clone() {
       PathSegment seg = index < 0 ? new ArraySegment(null) : new 
ArraySegment(index);
-      if (child != null) {
-        seg.setChild(child.clone());
+      if (getChild() != null) {
+        seg.setChild(getChild().clone());
       }
       return seg;
     }
@@ -109,8 +114,8 @@ public abstract class PathSegment{
     @Override
     public ArraySegment cloneWithNewChild(PathSegment newChild) {
       ArraySegment seg = index < 0 ? new ArraySegment(null) : new 
ArraySegment(index);
-      if (child != null) {
-        seg.setChild(child.cloneWithNewChild(newChild));
+      if (getChild() != null) {
+        seg.setChild(getChild().cloneWithNewChild(newChild));
       } else {
         seg.setChild(newChild);
       }
@@ -123,11 +128,12 @@ public abstract class PathSegment{
     private final String path;
 
     public NameSegment(CharSequence n, PathSegment child) {
-      this.child = child;
+      super(child);
       this.path = n.toString();
     }
 
     public NameSegment(CharSequence n) {
+      super(null);
       this.path = n.toString();
     }
 
@@ -180,8 +186,8 @@ public abstract class PathSegment{
     @Override
     public NameSegment clone() {
       NameSegment s = new NameSegment(this.path);
-      if (child != null) {
-        s.setChild(child.clone());
+      if (getChild() != null) {
+        s.setChild(getChild().clone());
       }
       return s;
     }
@@ -189,8 +195,8 @@ public abstract class PathSegment{
     @Override
     public NameSegment cloneWithNewChild(PathSegment newChild) {
       NameSegment s = new NameSegment(this.path);
-      if (child != null) {
-        s.setChild(child.cloneWithNewChild(newChild));
+      if (getChild() != null) {
+        s.setChild(getChild().cloneWithNewChild(newChild));
       } else {
         s.setChild(newChild);
       }
@@ -230,7 +236,7 @@ public abstract class PathSegment{
     int h = hash;
     if (h == 0) {
       h = segmentHashCode();
-      h = 31*h + ((child == null) ? 0 : child.hashCode());
+      h = h + ((child == null) ? 0 : 31 * child.hashCode());
       hash = h;
     }
     return h;

http://git-wip-us.apache.org/repos/asf/drill/blob/d105950a/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java
----------------------------------------------------------------------
diff --git 
a/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java 
b/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java
index 026fb09..8854e15 100644
--- a/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java
+++ b/logical/src/main/java/org/apache/drill/common/expression/SchemaPath.java
@@ -69,9 +69,6 @@ public class SchemaPath extends LogicalExpressionBase {
   public SchemaPath(String simpleName, ExpressionPosition pos) {
     super(pos);
     this.rootSegment = new NameSegment(simpleName);
-    if (simpleName.contains(".")) {
-      throw new IllegalStateException("This is deprecated and only supports 
simpe paths.");
-    }
   }
 
 
@@ -115,6 +112,37 @@ public class SchemaPath extends LogicalExpressionBase {
   }
 
   /**
+   * Parses input string using the same rules which are used for the field in 
the query.
+   * If a string contains dot outside back-ticks, or there are no backticks in 
the string,
+   * will be created {@link SchemaPath} with the {@link NameSegment}
+   * which contains one else {@link NameSegment}, etc.
+   * If a string contains [] then {@link ArraySegment} will be created.
+   *
+   * @param expr input string to be parsed
+   * @return {@link SchemaPath} instance
+   */
+  public static SchemaPath parseFromString(String expr) {
+    if (expr == null || expr.isEmpty()) {
+      return null;
+    }
+    try {
+      ExprLexer lexer = new ExprLexer(new ANTLRStringStream(expr));
+      CommonTokenStream tokens = new CommonTokenStream(lexer);
+      ExprParser parser = new ExprParser(tokens);
+
+      parse_return ret = parser.parse();
+
+      if (ret.e instanceof SchemaPath) {
+        return (SchemaPath) ret.e;
+      } else {
+        throw new IllegalStateException("Schema path is not a valid format.");
+      }
+    } catch (RecognitionException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  /**
    * A simple is a path where there are no repeated elements outside the 
lowest level of the path.
    * @return Whether this path is a simple path.
    */
@@ -227,25 +255,13 @@ public class SchemaPath extends LogicalExpressionBase {
     return ExpressionStringBuilder.toString(this);
   }
 
-  public String getAsUnescapedPath() {
-    StringBuilder sb = new StringBuilder();
-    PathSegment seg = getRootSegment();
-    if (seg.isArray()) {
-      throw new IllegalStateException("Drill doesn't currently support top 
level arrays");
-    }
-    sb.append(seg.getNameSegment().getPath());
-
-    while ( (seg = seg.getChild()) != null) {
-      if (seg.isNamed()) {
-        sb.append('.');
-        sb.append(seg.getNameSegment().getPath());
-      } else {
-        sb.append('[');
-        sb.append(seg.getArraySegment().getIndex());
-        sb.append(']');
-      }
-    }
-    return sb.toString();
+  /**
+   * Returns path string of {@code rootSegment}
+   *
+   * @return path string of {@code rootSegment}
+   */
+  public String getRootSegmentPath() {
+    return rootSegment.getPath();
   }
 
   public static class De extends StdDeserializer<SchemaPath> {
@@ -256,32 +272,7 @@ public class SchemaPath extends LogicalExpressionBase {
 
     @Override
     public SchemaPath deserialize(JsonParser jp, DeserializationContext ctxt) 
throws IOException {
-      String expr = jp.getText();
-
-      if (expr == null || expr.isEmpty()) {
-        return null;
-      }
-      try {
-        // logger.debug("Parsing expression string '{}'", expr);
-        ExprLexer lexer = new ExprLexer(new ANTLRStringStream(expr));
-        CommonTokenStream tokens = new CommonTokenStream(lexer);
-        ExprParser parser = new ExprParser(tokens);
-
-        //TODO: move functionregistry and error collector to injectables.
-        //ctxt.findInjectableValue(valueId, forProperty, beanInstance)
-        parse_return ret = parser.parse();
-
-        // ret.e.resolveAndValidate(expr, errorCollector);
-        if (ret.e instanceof SchemaPath) {
-          return (SchemaPath) ret.e;
-        } else {
-          throw new IllegalStateException("Schema path is not a valid 
format.");
-        }
-      } catch (RecognitionException e) {
-        throw new RuntimeException(e);
-      }
+      return parseFromString(jp.getText());
     }
-
   }
-
 }

Reply via email to