http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java
index 2a1db01..cb5183e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/BatchPrinter.java
@@ -37,7 +37,7 @@ public class BatchPrinter {
List<ValueVector> vectors = Lists.newArrayList();
int numBatches = 0;
for (VectorWrapper vw : batch) {
- columns.add(vw.getValueVectors()[0].getField().getAsSchemaPath().toExpr());
+ columns.add(vw.getValueVectors()[0].getField().getPath());
numBatches = vw.getValueVectors().length;
}
int width = columns.size();
@@ -71,7 +71,7 @@ public class BatchPrinter {
List<String> columns = Lists.newArrayList();
List<ValueVector> vectors = Lists.newArrayList();
for (VectorWrapper vw : batch) {
- columns.add(vw.getValueVector().getField().getAsSchemaPath().toExpr());
+ columns.add(vw.getValueVector().getField().getPath());
vectors.add(vw.getValueVector());
}
int width = columns.size();
@@ -106,7 +106,7 @@ public class BatchPrinter {
List<String> columns = Lists.newArrayList();
List<ValueVector> vectors = Lists.newArrayList();
for (VectorWrapper vw : batch) {
- columns.add(vw.getValueVector().getField().getAsSchemaPath().toExpr());
+ columns.add(vw.getValueVector().getField().getPath());
vectors.add(vw.getValueVector());
}
int width = columns.size();
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java
index 9f4115b..b150179 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/util/VectorUtil.java
@@ -40,7 +40,7 @@ public class VectorUtil {
System.out.println(rows + " row(s):");
List<String> columns = Lists.newArrayList();
for (VectorWrapper<?> vw : va) {
- columns.add(vw.getValueVector().getField().getPath().getAsUnescapedPath());
+ columns.add(vw.getValueVector().getField().getPath());
}
int width = columns.size();
@@ -55,7 +55,7 @@ public class VectorUtil {
try{
o = vw.getValueVector().getAccessor().getObject(row);
}catch(Exception e){
- throw new RuntimeException("failure while trying to read column " + vw.getField().getPath().toExpr());
+ throw new RuntimeException("failure while trying to read column " + vw.getField().getPath());
}
if (o == null) {
//null value
@@ -83,7 +83,7 @@ public class VectorUtil {
if (includeHeader) {
List<String> columns = Lists.newArrayList();
for (VectorWrapper<?> vw : va) {
- columns.add(vw.getValueVector().getField().getPath().getAsUnescapedPath());
+ columns.add(vw.getValueVector().getField().getPath());
}
formattedResults.append(Joiner.on(delimiter).join(columns));
@@ -134,7 +134,7 @@ public class VectorUtil {
width += columnWidth + 2;
formats.add("| %-" + columnWidth + "s");
MaterializedField field = vw.getValueVector().getField();
- columns.add(field.getPath().getAsUnescapedPath() + "<" + field.getType().getMinorType() + "(" + field.getType().getMode() + ")" + ">");
+ columns.add(field.getPath() + "<" + field.getType().getMinorType() + "(" + field.getType().getMode() + ")" + ">");
columnIndex++;
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
new file mode 100644
index 0000000..0394029
--- /dev/null
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/FieldIdUtil.java
@@ -0,0 +1,223 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.exec.vector.complex;
+
+import org.apache.drill.common.expression.PathSegment;
+import org.apache.drill.common.expression.SchemaPath;
+import org.apache.drill.common.types.TypeProtos.DataMode;
+import org.apache.drill.common.types.TypeProtos.MajorType;
+import org.apache.drill.common.types.TypeProtos.MinorType;
+import org.apache.drill.exec.record.TypedFieldId;
+import org.apache.drill.exec.vector.ValueVector;
+
+import java.util.List;
+
+public class FieldIdUtil {
+ static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FieldIdUtil.class);
+
+ public static TypedFieldId getFieldIdIfMatchesUnion(UnionVector unionVector, TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
+ if (seg.isNamed()) {
+ ValueVector v = unionVector.getMap();
+ if (v != null) {
+ return getFieldIdIfMatches(v, builder, addToBreadCrumb, seg);
+ } else {
+ return null;
+ }
+ } else if (seg.isArray()) {
+ ValueVector v = unionVector.getList();
+ if (v != null) {
+ return getFieldIdIfMatches(v, builder, addToBreadCrumb, seg);
+ } else {
+ return null;
+ }
+ }
+ return null;
+ }
+
+
+ public static TypedFieldId getFieldIdIfMatches(ValueVector vector, TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
+ if (vector instanceof RepeatedMapVector && seg != null && seg.isArray() && !seg.isLastPath()) {
+ if (addToBreadCrumb) {
+ addToBreadCrumb = false;
+ builder.remainder(seg);
+ }
+ // skip the first array segment as there is no corresponding child vector.
+ seg = seg.getChild();
+
+ // multi-level numbered access to a repeated map is not possible so return if the next part is also an array
+ // segment.
+ if (seg.isArray()) {
+ return null;
+ }
+ }
+
+ if (seg == null) {
+ if (addToBreadCrumb) {
+ builder.intermediateType(vector.getField().getType());
+ }
+ return builder.finalType(vector.getField().getType()).build();
+ }
+
+ if (seg.isArray()) {
+ if (seg.isLastPath()) {
+ MajorType type;
+ if (vector instanceof AbstractContainerVector) {
+ type = ((AbstractContainerVector) vector).getLastPathType();
+ } else if (vector instanceof ListVector) {
+ type = ((ListVector) vector).getDataVector().getField().getType();
+ builder.listVector();
+ } else {
+ throw new UnsupportedOperationException("FieldIdUtil does not support vector of type " + vector.getField().getType());
+ }
+ builder //
+ .withIndex() //
+ .finalType(type);
+
+ // remainder starts with the 1st array segment in SchemaPath.
+ // only set remainder when it's the only array segment.
+ if (addToBreadCrumb) {
+ addToBreadCrumb = false;
+ builder.remainder(seg);
+ }
+ return builder.build();
+ } else {
+ if (addToBreadCrumb) {
+ addToBreadCrumb = false;
+ builder.remainder(seg);
+ }
+ }
+ } else {
+ if (vector instanceof ListVector) {
+ return null;
+ }
+ }
+
+ ValueVector v;
+ if (vector instanceof AbstractContainerVector) {
+ VectorWithOrdinal vord = ((AbstractContainerVector) vector).getChildVectorWithOrdinal(seg.isArray() ? null : seg.getNameSegment().getPath());
+ if (vord == null) {
+ return null;
+ }
+ v = vord.vector;
+ if (addToBreadCrumb) {
+ builder.intermediateType(v.getField().getType());
+ builder.addId(vord.ordinal);
+ }
+ } else if (vector instanceof ListVector) {
+ v = ((ListVector) vector).getDataVector();
+ } else {
+ throw new UnsupportedOperationException("FieldIdUtil does not support vector of type " + vector.getField().getType());
+ }
+
+ if (v instanceof AbstractContainerVector) {
+ // we're looking for a multi path.
+ AbstractContainerVector c = (AbstractContainerVector) v;
+ return getFieldIdIfMatches(c, builder, addToBreadCrumb, seg.getChild());
+ } else if(v instanceof ListVector) {
+ ListVector list = (ListVector) v;
+ return getFieldIdIfMatches(list, builder, addToBreadCrumb, seg.getChild());
+ } else if (v instanceof UnionVector) {
+ return getFieldIdIfMatchesUnion((UnionVector) v, builder, addToBreadCrumb, seg.getChild());
+ } else {
+ if (seg.isNamed()) {
+ if(addToBreadCrumb) {
+ builder.intermediateType(v.getField().getType());
+ }
+ builder.finalType(v.getField().getType());
+ } else {
+ builder.finalType(v.getField().getType().toBuilder().setMode(DataMode.OPTIONAL).build());
+ }
+
+ if (seg.isLastPath()) {
+ return builder.build();
+ } else {
+ PathSegment child = seg.getChild();
+ if (child.isLastPath() && child.isArray()) {
+ if (addToBreadCrumb) {
+ builder.remainder(child);
+ }
+ builder.withIndex();
+ builder.finalType(v.getField().getType().toBuilder().setMode(DataMode.OPTIONAL).build());
+ return builder.build();
+ } else {
+ logger.warn("You tried to request a complex type inside a scalar object or path or type is wrong.");
+ return null;
+ }
+ }
+ }
+ }
+
+ public static TypedFieldId getFieldId(ValueVector vector, int id, SchemaPath expectedPath, boolean hyper) {
+ if (!expectedPath.getRootSegment().getNameSegment().getPath().equalsIgnoreCase(vector.getField().getPath())) {
+ return null;
+ }
+ PathSegment seg = expectedPath.getRootSegment();
+
+ TypedFieldId.Builder builder = TypedFieldId.newBuilder();
+ if (hyper) {
+ builder.hyper();
+ }
+ if (vector instanceof UnionVector) {
+ builder.addId(id).remainder(expectedPath.getRootSegment().getChild());
+ List<MinorType> minorTypes = ((UnionVector) vector).getSubTypes();
+ MajorType.Builder majorTypeBuilder = MajorType.newBuilder().setMinorType(MinorType.UNION);
+ for (MinorType type : minorTypes) {
+ majorTypeBuilder.addSubType(type);
+ }
+ MajorType majorType = majorTypeBuilder.build();
+ builder.intermediateType(majorType);
+ if (seg.isLastPath()) {
+ builder.finalType(majorType);
+ return builder.build();
+ } else {
+ return getFieldIdIfMatchesUnion((UnionVector) vector, builder, false, seg.getChild());
+ }
+ } else if (vector instanceof ListVector) {
+ ListVector list = (ListVector) vector;
+ builder.intermediateType(vector.getField().getType());
+ builder.addId(id);
+ return getFieldIdIfMatches(list, builder, true, expectedPath.getRootSegment().getChild());
+ } else
+ if (vector instanceof AbstractContainerVector) {
+ // we're looking for a multi path.
+ AbstractContainerVector c = (AbstractContainerVector) vector;
+ builder.intermediateType(vector.getField().getType());
+ builder.addId(id);
+ return getFieldIdIfMatches(c, builder, true, expectedPath.getRootSegment().getChild());
+
+ } else {
+ builder.intermediateType(vector.getField().getType());
+ builder.addId(id);
+ builder.finalType(vector.getField().getType());
+ if (seg.isLastPath()) {
+ return builder.build();
+ } else {
+ PathSegment child = seg.getChild();
+ if (child.isArray() && child.isLastPath()) {
+ builder.remainder(child);
+ builder.withIndex();
+ builder.finalType(vector.getField().getType().toBuilder().setMode(DataMode.OPTIONAL).build());
+ return builder.build();
+ } else {
+ return null;
+ }
+
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/FieldSelection.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/FieldSelection.java b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/FieldSelection.java
index dfaf5de..acf5552 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/FieldSelection.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/vector/complex/fn/FieldSelection.java
@@ -33,7 +33,7 @@ import com.google.common.collect.Maps;
/**
* This class manages the projection pushdown for a complex path.
*/
-class FieldSelection {
+public class FieldSelection {
public static final FieldSelection INVALID_NODE = new FieldSelection(null, ValidityMode.NEVER_VALID);
public static final FieldSelection ALL_VALID = new FieldSelection(null, ValidityMode.ALWAYS_VALID);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/DrillTestWrapper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/DrillTestWrapper.java b/exec/java-exec/src/test/java/org/apache/drill/DrillTestWrapper.java
index 35e668c..e828eb8 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/DrillTestWrapper.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/DrillTestWrapper.java
@@ -224,12 +224,12 @@ public class DrillTestWrapper {
logger.debug("reading batch with " + loader.getRecordCount() + " rows, total read so far " + totalRecords);
totalRecords += loader.getRecordCount();
for (VectorWrapper w : loader) {
- String field = w.getField().toExpr();
+ String field = SchemaPath.getSimplePath(w.getField().getPath()).toExpr();
if (!combinedVectors.containsKey(field)) {
MaterializedField mf = w.getField();
ValueVector[] vvList = (ValueVector[]) Array.newInstance(mf.getValueClass(), 1);
vvList[0] = w.getValueVector();
- combinedVectors.put(mf.getPath().toExpr(), new HyperVectorValueIterator(mf, new HyperVectorWrapper(mf,
+ combinedVectors.put(SchemaPath.getSimplePath(mf.getPath()).toExpr(), new HyperVectorValueIterator(mf, new HyperVectorWrapper(mf,
vvList)));
} else {
combinedVectors.get(field).getHyperVector().addVector(w.getValueVector());
@@ -272,13 +272,13 @@ public class DrillTestWrapper {
if (schema == null) {
schema = loader.getSchema();
for (MaterializedField mf : schema) {
- combinedVectors.put(mf.getPath().toExpr(), new ArrayList());
+ combinedVectors.put(SchemaPath.getSimplePath(mf.getPath()).toExpr(), new ArrayList());
}
}
logger.debug("reading batch with " + loader.getRecordCount() + " rows, total read so far " + totalRecords);
totalRecords += loader.getRecordCount();
for (VectorWrapper w : loader) {
- String field = w.getField().toExpr();
+ String field = SchemaPath.getSimplePath(w.getField().getPath()).toExpr();
for (int j = 0; j < loader.getRecordCount(); j++) {
Object obj = w.getValueVector().getAccessor().getObject(j);
if (obj != null) {
@@ -317,13 +317,13 @@ public class DrillTestWrapper {
}
for(int i = 0; i < schema.getFieldCount(); ++i) {
- final SchemaPath actualSchemaPath = schema.getColumn(i).getPath();
+ final String actualSchemaPath = schema.getColumn(i).getPath();
final TypeProtos.MajorType actualMajorType = schema.getColumn(i).getType();
- final SchemaPath expectedSchemaPath = schema.getColumn(i).getPath();
+ final String expectedSchemaPath = schema.getColumn(i).getPath();
final TypeProtos.MajorType expectedlMajorType = schema.getColumn(i).getType();
- if(!actualSchemaPath.equals(expectedSchemaPath)
+ if(!actualSchemaPath.equalsIgnoreCase(expectedSchemaPath)
|| !actualMajorType.equals(expectedlMajorType)) {
throw new Exception("The type of the " + i + "-th column is '" + actualSchemaPath + "' mismatched, expected: '"
+ expectedlMajorType + "'");
@@ -486,7 +486,7 @@ public class DrillTestWrapper {
private Map<SchemaPath, TypeProtos.MajorType> getTypeMapFromBatch(QueryDataBatch batch) {
Map<SchemaPath, TypeProtos.MajorType> typeMap = new HashMap();
for (int i = 0; i < batch.getHeader().getDef().getFieldCount(); i++) {
- typeMap.put(MaterializedField.create(batch.getHeader().getDef().getField(i)).getPath(),
+ typeMap.put(SchemaPath.getSimplePath(MaterializedField.create(batch.getHeader().getDef().getField(i)).getPath()),
batch.getHeader().getDef().getField(i).getMajorType());
}
return typeMap;
@@ -529,9 +529,9 @@ public class DrillTestWrapper {
else if (obj instanceof byte[]) {
obj = new String((byte[]) obj, "UTF-8");
}
- record.put(w.getField().toExpr(), obj);
+ record.put(SchemaPath.getSimplePath(w.getField().getPath()).toExpr(), obj);
}
- record.put(w.getField().toExpr(), obj);
+ record.put(SchemaPath.getSimplePath(w.getField().getPath()).toExpr(), obj);
}
materializedRecords.add(record);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java b/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java
index f9e0b00..3922a38 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/PlanTestBase.java
@@ -308,7 +308,7 @@ public class PlanTestBase extends BaseTestQuery {
throw new Exception("Looks like you did not provide an explain plan query, please add EXPLAIN PLAN FOR to the beginning of your query.");
}
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestWriteToDisk.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestWriteToDisk.java b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestWriteToDisk.java
index 0dd20b6..a382a42 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestWriteToDisk.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/cache/TestWriteToDisk.java
@@ -67,12 +67,8 @@ public class TestWriteToDisk extends ExecTest {
bit.run();
final DrillbitContext context = bit.getContext();
- final MaterializedField intField = MaterializedField.create(
- new SchemaPath("int", ExpressionPosition.UNKNOWN),
- Types.required(TypeProtos.MinorType.INT));
- final MaterializedField binField = MaterializedField.create(
- new SchemaPath("binary", ExpressionPosition.UNKNOWN),
- Types.required(TypeProtos.MinorType.VARBINARY));
+ final MaterializedField intField = MaterializedField.create("int", Types.required(TypeProtos.MinorType.INT));
+ final MaterializedField binField = MaterializedField.create("binary", Types.required(TypeProtos.MinorType.VARBINARY));
try (final IntVector intVector = (IntVector) TypeHelper.getNewVector(intField, context.getAllocator());
final VarBinaryVector binVector =
(VarBinaryVector) TypeHelper.getNewVector(binField, context.getAllocator())) {
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
index ef102b6..29aaf3a 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestOptiqPlans.java
@@ -142,7 +142,7 @@ public class TestOptiqPlans extends ExecTest {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
loader.load(b.getHeader().getDef(), b.getData());
for (final VectorWrapper<?> vw : loader) {
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
@@ -171,7 +171,7 @@ public class TestOptiqPlans extends ExecTest {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
loader.load(b.getHeader().getDef(), b.getData());
for (final VectorWrapper<?> vw : loader) {
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
@@ -200,7 +200,7 @@ public class TestOptiqPlans extends ExecTest {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
loader.load(b.getHeader().getDef(), b.getData());
for (final VectorWrapper<?> vw : loader) {
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
@@ -239,7 +239,7 @@ public class TestOptiqPlans extends ExecTest {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
loader.load(b.getHeader().getDef(), b.getData());
for (final VectorWrapper vw : loader) {
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
@@ -278,7 +278,7 @@ public class TestOptiqPlans extends ExecTest {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
loader.load(b.getHeader().getDef(), b.getData());
for (final VectorWrapper vw : loader) {
- System.out.println(vw.getValueVector().getField().toExpr());
+ System.out.println(vw.getValueVector().getField().getPath());
final ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
final Object o = vv.getAccessor().getObject(i);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
index 5d0ea2d..182e19e 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestSimpleFragmentRun.java
@@ -72,7 +72,7 @@ public class TestSimpleFragmentRun extends PopUnitTestBase {
} else {
System.out.print("\t");
}
- System.out.print(value.getField().toExpr());
+ System.out.print(value.getField().getPath());
System.out.print("[");
System.out.print(value.getField().getType().getMinorType());
System.out.print("]");
@@ -147,7 +147,7 @@ public class TestSimpleFragmentRun extends PopUnitTestBase {
} else {
System.out.print("\t");
}
- System.out.print(v.getField().toExpr());
+ System.out.print(v.getField().getPath());
System.out.print("[");
System.out.print(v.getField().getType().getMinorType());
System.out.print("]");
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
index a533620..d56a65f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoin.java
@@ -87,7 +87,7 @@ public class TestMergeJoin extends PopUnitTestBase {
while (exec.next()) {
totalRecordCount += exec.getRecordCount();
for (final ValueVector v : exec) {
- System.out.print("[" + v.getField().toExpr() + "] ");
+ System.out.print("[" + v.getField().getPath() + "] ");
}
System.out.println("\n");
for (int valueIdx = 0; valueIdx < exec.getRecordCount(); valueIdx++) {
@@ -150,7 +150,7 @@ public class TestMergeJoin extends PopUnitTestBase {
for (int valueIdx = 0; valueIdx < exec.getRecordCount(); valueIdx++) {
final List<Object> row = Lists.newArrayList();
for (final ValueVector v : exec) {
- row.add(v.getField().toExpr() + ":" + v.getAccessor().getObject(valueIdx));
+ row.add(v.getField().getPath() + ":" + v.getAccessor().getObject(valueIdx));
}
for (final Object cell : row) {
if (cell == null) {
@@ -207,7 +207,7 @@ public class TestMergeJoin extends PopUnitTestBase {
for (int valueIdx = 0; valueIdx < exec.getRecordCount(); valueIdx++) {
final List<Object> row = Lists.newArrayList();
for (final ValueVector v : exec) {
- row.add(v.getField().toExpr() + ":" + v.getAccessor().getObject(valueIdx));
+ row.add(v.getField().getPath() + ":" + v.getAccessor().getObject(valueIdx));
}
for (final Object cell : row) {
if (cell == null) {
@@ -263,7 +263,7 @@ public class TestMergeJoin extends PopUnitTestBase {
for (int valueIdx = 0; valueIdx < exec.getRecordCount(); valueIdx++) {
final List<Object> row = Lists.newArrayList();
for (final ValueVector v : exec) {
- row.add(v.getField().toExpr() + ":" + v.getAccessor().getObject(valueIdx));
+ row.add(v.getField().getPath() + ":" + v.getAccessor().getObject(valueIdx));
}
for (final Object cell : row) {
if (cell == null) {
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
index 3e0deb2..c83a30f 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/join/TestMergeJoinAdvanced.java
@@ -89,6 +89,7 @@ public class TestMergeJoinAdvanced extends BaseTestQuery {
}
@Test
+ @Ignore // TODO file JIRA to fix this
public void testFix2967() throws Exception {
setSessionOption(PlannerSettings.BROADCAST.getOptionName(), "false");
setSessionOption(PlannerSettings.HASHJOIN.getOptionName(), "false");
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
index 80bf17e..537a583 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/mergereceiver/TestMergingReceiver.java
@@ -101,7 +101,7 @@ public class TestMergingReceiver extends PopUnitTestBase {
final MaterializedField materializedField = vv.getField();
final int numValues = va.getValueCount();
for(int valueIdx = 0; valueIdx < numValues; ++valueIdx) {
- if (materializedField.getAsSchemaPath().getRootSegment().getPath().equals("blue")) {
+ if (materializedField.getPath().equals("blue")) {
final long longValue = ((Long) va.getObject(valueIdx)).longValue();
// check that order is ascending
if (lastBlueValue != null) {
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
index c01f5d8..7d28c9b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/ExpressionTreeMaterializerTest.java
@@ -59,7 +59,7 @@ public class ExpressionTreeMaterializerTest extends ExecTest {
FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
private MaterializedField getField(int fieldId, String name, MajorType type) {
- return MaterializedField.create(SchemaPath.getSimplePath(name), type);
+ return MaterializedField.create(name, type);
}
@Test
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestMaterializedField.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestMaterializedField.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestMaterializedField.java
index dbe4dc2..3380a52 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestMaterializedField.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/TestMaterializedField.java
@@ -66,7 +66,7 @@ public class TestMaterializedField {
for (final MaterializedField field:new MaterializedField[]{parent, child}) {
for (Object[] args:matrix) {
- final SchemaPath path = SchemaPath.getSimplePath(args[0].toString());
+ final String path = args[0].toString();
final TypeProtos.MajorType type = TypeProtos.MajorType.class.cast(args[1]);
final MaterializedField clone = field.withPathAndType(path, type);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestLoad.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestLoad.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestLoad.java
index c3af451..8ac7c45 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestLoad.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestLoad.java
@@ -51,12 +51,12 @@ public class TestLoad extends ExecTest {
@Test
public void testLoadValueVector() throws Exception {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(drillConfig);
- final ValueVector fixedV = new IntVector(MaterializedField.create(new SchemaPath("ints", ExpressionPosition.UNKNOWN),
+ final ValueVector fixedV = new IntVector(MaterializedField.create("ints",
Types.required(MinorType.INT)), allocator);
final ValueVector varlenV = new VarCharVector(MaterializedField.create(
- new SchemaPath("chars", ExpressionPosition.UNKNOWN), Types.required(MinorType.VARCHAR)), allocator);
- final ValueVector nullableVarlenV = new NullableVarCharVector(MaterializedField.create(new SchemaPath("chars",
- ExpressionPosition.UNKNOWN), Types.optional(MinorType.VARCHAR)), allocator);
+ "chars", Types.required(MinorType.VARCHAR)), allocator);
+ final ValueVector nullableVarlenV = new NullableVarCharVector(MaterializedField.create("chars",
+ Types.optional(MinorType.VARCHAR)), allocator);
final List<ValueVector> vectors = Lists.newArrayList(fixedV, varlenV, nullableVarlenV);
for (final ValueVector v : vectors) {
@@ -88,7 +88,7 @@ public class TestLoad extends ExecTest {
} else {
System.out.print("\t");
}
- System.out.print(v.getField().toExpr());
+ System.out.print(v.getField().getPath());
System.out.print("[");
System.out.print(v.getField().getType().getMinorType());
System.out.print("]");
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
index 96f2b33..38c6ebc 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestValueVector.java
@@ -70,7 +70,7 @@ import com.google.common.collect.ImmutableMap;
public class TestValueVector extends ExecTest {
//private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestValueVector.class);
- private final static SchemaPath EMPTY_SCHEMA_PATH = SchemaPath.getSimplePath("");
+ private final static String EMPTY_SCHEMA_PATH = "";
private DrillConfig drillConfig;
private BufferAllocator allocator;
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
index 155706e..10656f4 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestBitRpc.java
@@ -140,7 +140,7 @@ public class TestBitRpc extends ExecTest {
List<ValueVector> vectors = Lists.newArrayList();
for (int i = 0; i < 5; i++) {
Float8Vector v = (Float8Vector) TypeHelper.getNewVector(
- MaterializedField.create(new SchemaPath("a", ExpressionPosition.UNKNOWN), Types.required(MinorType.FLOAT8)),
+ MaterializedField.create("a", Types.required(MinorType.FLOAT8)),
allocator);
v.allocateNew(records);
v.getMutator().generateTestData(records);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
index 4976bca..8b9cd28 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
@@ -126,12 +126,12 @@ public class ParquetResultListener implements UserResultsListener {
for (final VectorWrapper vw : batchLoader) {
final ValueVector vv = vw.getValueVector();
- currentField = props.fields.get(vv.getField().getPath().getRootSegment().getPath());
- if (!valuesChecked.containsKey(vv.getField().getPath().getRootSegment().getPath())) {
- valuesChecked.put(vv.getField().getPath().getRootSegment().getPath(), 0);
+ currentField = props.fields.get(vv.getField().getPath());
+ if (!valuesChecked.containsKey(vv.getField().getPath())) {
+ valuesChecked.put(vv.getField().getPath(), 0);
columnValCounter = 0;
} else {
- columnValCounter = valuesChecked.get(vv.getField().getPath().getRootSegment().getPath());
+ columnValCounter = valuesChecked.get(vv.getField().getPath());
}
printColumnMajor(vv);
@@ -145,9 +145,9 @@ public class ParquetResultListener implements UserResultsListener {
columnValCounter += vv.getAccessor().getValueCount();
}
- valuesChecked.remove(vv.getField().getPath().getRootSegment().getPath());
+ valuesChecked.remove(vv.getField().getPath());
assertEquals("Mismatched value count for vectors in the same batch.", valueCount, vv.getAccessor().getValueCount());
- valuesChecked.put(vv.getField().getPath().getRootSegment().getPath(), columnValCounter);
+ valuesChecked.put(vv.getField().getPath(), columnValCounter);
}
if (ParquetRecordReaderTest.VERBOSE_DEBUG){
@@ -184,7 +184,7 @@ public class ParquetResultListener implements UserResultsListener {
public void printColumnMajor(ValueVector vv) {
if (ParquetRecordReaderTest.VERBOSE_DEBUG){
- System.out.println("\n" + vv.getField().getAsSchemaPath().getRootSegment().getPath());
+ System.out.println("\n" + vv.getField().getPath());
}
for (int j = 0; j < vv.getAccessor().getValueCount(); j++) {
if (ParquetRecordReaderTest.VERBOSE_DEBUG){
@@ -211,7 +211,7 @@ public class ParquetResultListener implements UserResultsListener {
System.out.println();
for (VectorWrapper vw : batchLoader) {
ValueVector v = vw.getValueVector();
- System.out.print(Strings.padStart(v.getField().getAsSchemaPath().getRootSegment().getPath(), 20, ' ') + " ");
+ System.out.print(Strings.padStart(v.getField().getPath(), 20, ' ') + " ");
}
System.out.println();
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
index 9282a45..8714b30 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
@@ -65,7 +65,7 @@ public class TestParquetPhysicalPlan extends ExecTest {
count += b.getHeader().getRowCount();
loader.load(b.getHeader().getDef(), b.getData());
for (VectorWrapper vw : loader) {
- System.out.print(vw.getValueVector().getField().toExpr() + ": ");
+ System.out.print(vw.getValueVector().getField().getPath() + ": ");
ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
Object o = vv.getAccessor().getObject(i);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 1813cc7..d23e56f 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
@@ -69,7 +69,7 @@ public class DrillColumnMetaDataList extends BasicList<ColumnMetaData>{
final MaterializedField field = schema.getColumn(colOffset);
Class<?> objectClass = getObjectClasses.get( colOffset );
- final String columnName = field.getPath().getRootSegment().getPath();
+ final String columnName = field.getPath();
final MajorType rpcDataType = field.getType();
final AvaticaType bundledSqlDataType = getAvaticaType(rpcDataType);
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 9e332a5..d82fd61 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
@@ -70,13 +70,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(SchemaPath.getSimplePath("/path/to/testInt"));
+ when(exampleIntField.getPath()).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(SchemaPath.getSimplePath("/path/to/testString"));
+ when(exampleStringField.getPath()).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/9a3a5c4f/exec/vector/pom.xml
----------------------------------------------------------------------
diff --git a/exec/vector/pom.xml b/exec/vector/pom.xml
index 2d62631..9a40d71 100644
--- a/exec/vector/pom.xml
+++ b/exec/vector/pom.xml
@@ -33,11 +33,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.drill</groupId>
- <artifactId>drill-logical</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.drill.memory</groupId>
<artifactId>drill-memory-base</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/includes/vv_imports.ftl
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/includes/vv_imports.ftl b/exec/vector/src/main/codegen/includes/vv_imports.ftl
index 3b1ec64..11e0f5d 100644
--- a/exec/vector/src/main/codegen/includes/vv_imports.ftl
+++ b/exec/vector/src/main/codegen/includes/vv_imports.ftl
@@ -33,7 +33,6 @@ import org.apache.drill.exec.vector.*;
import org.apache.drill.common.exceptions.*;
import org.apache.drill.exec.exception.*;
import org.apache.drill.exec.expr.holders.*;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.common.types.TypeProtos.*;
import org.apache.drill.common.types.Types;
import org.apache.drill.common.util.DrillStringUtils;
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/BasicTypeHelper.java b/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
index a81265b..dfc8e4a 100644
--- a/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
+++ b/exec/vector/src/main/codegen/templates/BasicTypeHelper.java
@@ -25,7 +25,6 @@ package org.apache.drill.exec.expr;
<#include "/@includes/vv_imports.ftl" />
import org.apache.drill.exec.vector.complex.UnionVector;
-import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.common.types.TypeProtos.MajorType;
@@ -68,9 +67,8 @@ public class BasicTypeHelper {
throw new UnsupportedOperationException(buildErrorMessage("get size", major));
}
- public static ValueVector getNewVector(SchemaPath parentPath, String name, BufferAllocator allocator, MajorType type, CallBack callback){
- SchemaPath child = parentPath.getChild(name);
- MaterializedField field = MaterializedField.create(child, type);
+ public static ValueVector getNewVector(String name, BufferAllocator allocator, MajorType type, CallBack callback){
+ MaterializedField field = MaterializedField.create(name, type);
return getNewVector(field, allocator, callback);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 8e77dcc..eb0d616 100644
--- a/exec/vector/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/vector/src/main/codegen/templates/FixedValueVectors.java
@@ -183,7 +183,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
@Override
public void load(SerializedField metadata, DrillBuf buffer) {
- Preconditions.checkArgument(this.field.matches(metadata), "The field %s doesn't match the provided metadata %s.", this.field, metadata);
+ Preconditions.checkArgument(this.field.getPath().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 * ${type.width};
@@ -203,7 +203,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator){
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator){
return new TransferImpl(getField().withPath(ref), allocator);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/NullableValueVectors.java b/exec/vector/src/main/codegen/templates/NullableValueVectors.java
index d2c17ff..6c0a16b 100644
--- a/exec/vector/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/vector/src/main/codegen/templates/NullableValueVectors.java
@@ -248,7 +248,7 @@ public final class ${className} extends BaseDataValueVector implements <#if type
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator){
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator){
return new TransferImpl(getField().withPath(ref), allocator);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/templates/RepeatedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/RepeatedValueVectors.java b/exec/vector/src/main/codegen/templates/RepeatedValueVectors.java
index ca39d71..2a758eb 100644
--- a/exec/vector/src/main/codegen/templates/RepeatedValueVectors.java
+++ b/exec/vector/src/main/codegen/templates/RepeatedValueVectors.java
@@ -84,7 +84,7 @@ public final class Repeated${minor.class}Vector extends BaseRepeatedValueVector
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator){
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator){
return new TransferImpl(getField().withPath(ref), allocator);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/templates/UnionVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/UnionVector.java b/exec/vector/src/main/codegen/templates/UnionVector.java
index a5e1c0d..dbdefba 100644
--- a/exec/vector/src/main/codegen/templates/UnionVector.java
+++ b/exec/vector/src/main/codegen/templates/UnionVector.java
@@ -31,7 +31,6 @@ package org.apache.drill.exec.vector.complex;
import java.util.Iterator;
import org.apache.drill.exec.vector.complex.impl.ComplexCopier;
import org.apache.drill.exec.util.CallBack;
-import org.apache.drill.common.expression.PathSegment;
import org.apache.drill.exec.expr.BasicTypeHelper;
/*
@@ -94,7 +93,7 @@ public class UnionVector implements ValueVector {
return;
}
majorType = MajorType.newBuilder(this.majorType).addSubType(type).build();
- field = MaterializedField.create(field.getPath(), majorType);
+ field = MaterializedField.create(field.getName(), majorType);
if (callBack != null) {
callBack.doWork();
}
@@ -208,7 +207,7 @@ public class UnionVector implements ValueVector {
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator) {
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator) {
return new TransferImpl(field.withPath(ref), allocator);
}
@@ -351,24 +350,6 @@ public class UnionVector implements ValueVector {
return vectors.iterator();
}
- public TypedFieldId getFieldIdIfMatches(TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
- if (seg.isNamed()) {
- ValueVector v = getMap();
- if (v != null) {
- return ((AbstractContainerVector) v).getFieldIdIfMatches(builder, addToBreadCrumb, seg);
- } else {
- return null;
- }
- } else if (seg.isArray()) {
- ValueVector v = getList();
- if (v != null) {
- return ((ListVector) v).getFieldIdIfMatches(builder, addToBreadCrumb, seg);
- }
- else return null;
- }
- return null;
- }
-
public class Accessor extends BaseValueVector.BaseAccessor {
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/codegen/templates/VariableLengthVectors.java b/exec/vector/src/main/codegen/templates/VariableLengthVectors.java
index 56d2d52..27432d2 100644
--- a/exec/vector/src/main/codegen/templates/VariableLengthVectors.java
+++ b/exec/vector/src/main/codegen/templates/VariableLengthVectors.java
@@ -179,7 +179,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator){
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator){
return new TransferImpl(getField().withPath(ref), allocator);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 f8fb71c..92019ec 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
@@ -17,39 +17,37 @@
*/
package org.apache.drill.exec.record;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
-import java.util.Map;
+import java.util.Objects;
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.expression.SchemaPath;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.exec.expr.BasicTypeHelper;
+import org.apache.drill.exec.proto.UserBitShared.NamePart;
import org.apache.drill.exec.proto.UserBitShared.SerializedField;
public class MaterializedField {
- private final Key key;
+ private final String name;
+ private final MajorType type;
// use an ordered set as existing code relies on order (e,g. parquet writer)
private final LinkedHashSet<MaterializedField> children;
- private MaterializedField(SchemaPath path, MajorType type) {
- this(path, type, new LinkedHashSet<MaterializedField>());
- }
-
- private MaterializedField(SchemaPath path, MajorType type, LinkedHashSet<MaterializedField> children) {
- this.key = new Key(path, type);
+ private MaterializedField(String name, MajorType type, LinkedHashSet<MaterializedField> children) {
+ this.name = name;
+ this.type = type;
this.children = children;
}
public static MaterializedField create(SerializedField serField){
- MaterializedField field = new MaterializedField(SchemaPath.create(serField.getNamePart()), serField.getMajorType());
+ LinkedHashSet<MaterializedField> children = new LinkedHashSet<>();
for (SerializedField sf:serField.getChildList()) {
- field.addChild(MaterializedField.create(sf));
+ children.add(MaterializedField.create(sf));
}
- return field;
+ return new MaterializedField(serField.getNamePart().getName(), serField.getMajorType(), children);
}
/**
@@ -65,13 +63,19 @@ public class MaterializedField {
public SerializedField.Builder getAsBuilder(){
- return SerializedField.newBuilder() //
- .setMajorType(key.type) //
- .setNamePart(key.path.getAsNamePart());
+ return SerializedField.newBuilder()
+ .setMajorType(type)
+ .setNamePart(NamePart.newBuilder().setName(name).build());
}
public Collection<MaterializedField> getChildren() {
- return children;
+ return new ArrayList<>(children);
+ }
+
+ public MaterializedField newWithChild(MaterializedField child) {
+ MaterializedField newField = clone();
+ newField.addChild(child);
+ return newField;
}
public void addChild(MaterializedField field){
@@ -79,33 +83,32 @@ public class MaterializedField {
}
public MaterializedField clone() {
- return withPathAndType(getPath(), getType());
+ return withPathAndType(name, getType());
}
public MaterializedField withType(MajorType type) {
- return withPathAndType(getPath(), type);
+ return withPathAndType(name, type);
}
- public MaterializedField withPath(SchemaPath path) {
- return withPathAndType(path, getType());
+ public MaterializedField withPath(String name) {
+ return withPathAndType(name, getType());
}
- public MaterializedField withPathAndType(final SchemaPath path, final MajorType type) {
+ public MaterializedField withPathAndType(String name, final MajorType type) {
final LinkedHashSet<MaterializedField> newChildren = new LinkedHashSet<>(children.size());
- final MaterializedField clone = new MaterializedField(path, type, newChildren);
for (final MaterializedField child:children) {
newChildren.add(child.clone());
}
- return clone;
+ 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();
- }
+// 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.
@@ -114,26 +117,8 @@ public class MaterializedField {
return f.equals(this);
}
- public static MaterializedField create(String path, MajorType type){
- SchemaPath p = SchemaPath.getSimplePath(path);
- return create(p, type);
- }
-
- public static MaterializedField create(SchemaPath path, MajorType type) {
- return new MaterializedField(path, type);
- }
-
- public SchemaPath getPath(){
- return key.path;
- }
-
- /**
- * Get the schema path. Deprecated, use getPath() instead.
- * @return the SchemaPath of this field.
- */
- @Deprecated
- public SchemaPath getAsSchemaPath(){
- return getPath();
+ public static MaterializedField create(String name, MajorType type){
+ return new MaterializedField(name, type, new LinkedHashSet<MaterializedField>());
}
// public String getName(){
@@ -157,30 +142,42 @@ public class MaterializedField {
// return sb.toString();
// }
+ public String getPath() {
+ return getName();
+ }
+
+ public String getLastName() {
+ return getName();
+ }
+
+ public String getName() {
+ return name;
+ }
+
public int getWidth() {
- return key.type.getWidth();
+ return type.getWidth();
}
public MajorType getType() {
- return key.type;
+ return type;
}
public int getScale() {
- return key.type.getScale();
+ return type.getScale();
}
public int getPrecision() {
- return key.type.getPrecision();
+ return type.getPrecision();
}
public boolean isNullable() {
- return key.type.getMode() == DataMode.OPTIONAL;
+ return type.getMode() == DataMode.OPTIONAL;
}
public DataMode getDataMode() {
- return key.type.getMode();
+ return type.getMode();
}
public MaterializedField getOtherNullableVersion(){
- MajorType mt = key.type;
+ MajorType mt = type;
DataMode newDataMode = null;
switch (mt.getMode()){
case OPTIONAL:
@@ -192,29 +189,16 @@ public class MaterializedField {
default:
throw new UnsupportedOperationException();
}
- return new MaterializedField(key.path, mt.toBuilder().setMode(newDataMode).build());
+ return new MaterializedField(name, mt.toBuilder().setMode(newDataMode).build(), children);
}
public Class<?> getValueClass() {
return BasicTypeHelper.getValueVectorClass(getType().getMinorType(), getDataMode());
}
- public boolean matches(SchemaPath path) {
- if (!path.isSimplePath()) {
- return false;
- }
-
- return key.path.equals(path);
- }
-
-
@Override
public int hashCode() {
- int result = 1;
- // DRILL-1872: Compute hashCode only on key. See also the comment
- // in MapVector$MapTransferPair
- result = ((key == null) ? 0 : key.hashCode());
- return result;
+ return Objects.hash(this.name, this.type, this.children);
}
@Override
@@ -232,14 +216,8 @@ public class MaterializedField {
// DRILL-1872: Compute equals only on key. See also the comment
// in MapVector$MapTransferPair
- if (key == null) {
- if (other.key != null) {
- return false;
- }
- } else if (!key.equals(other.key)) {
- return false;
- }
- return true;
+ return this.name.equalsIgnoreCase(other.name) &&
+ Objects.equals(this.type, other.type);
}
@@ -247,7 +225,7 @@ public class MaterializedField {
public String toString() {
final int maxLen = 10;
String childStr = children != null && !children.isEmpty() ? toString(children, maxLen) : "";
- return key.path + "(" + key.type.getMinorType().name() + ":" + key.type.getMode().name() + ")" + childStr;
+ return name + "(" + type.getMinorType().name() + ":" + type.getMode().name() + ")" + childStr;
}
@@ -264,61 +242,4 @@ public class MaterializedField {
builder.append("]");
return builder.toString();
}
-
- public Key key() {
- return key;
- }
-
- public String toExpr(){
- return key.path.toExpr();
- }
-
- /**
- * Since the {@code MaterializedField) itself is mutable, in certain cases, it is not suitable
- * as a key of a {@link Map}. This inner class allows the {@link MaterializedField} object to be
- * used for this purpose.
- */
- public class Key {
-
- private final SchemaPath path;
- private final MajorType type;
-
- private Key(SchemaPath path, MajorType type) {
- this.path = path;
- this.type = type;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((path == null) ? 0 : path.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Key other = (Key) obj;
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
- return false;
- }
-
- return true;
- }
-
- }
-
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java b/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
deleted file mode 100644
index a322f72..0000000
--- a/exec/vector/src/main/java/org/apache/drill/exec/record/TypedFieldId.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/**
- * 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.exec.record;
-
-import java.util.Arrays;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.drill.common.expression.PathSegment;
-import org.apache.drill.common.types.TypeProtos.MajorType;
-import org.apache.drill.exec.expr.BasicTypeHelper;
-import org.apache.drill.exec.vector.ValueVector;
-
-import com.carrotsearch.hppc.IntArrayList;
-import com.google.common.base.Preconditions;
-
-public class TypedFieldId {
- final MajorType finalType;
- final MajorType secondaryFinal;
- final MajorType intermediateType;
- final int[] fieldIds;
- final boolean isHyperReader;
- final boolean isListVector;
- final PathSegment remainder;
-
- public TypedFieldId(MajorType type, int... fieldIds) {
- this(type, type, type, false, null, fieldIds);
- }
-
- public TypedFieldId(MajorType type, IntArrayList breadCrumb, PathSegment remainder) {
- this(type, type, type, false, remainder, breadCrumb.toArray());
- }
-
- public TypedFieldId(MajorType type, boolean isHyper, int... fieldIds) {
- this(type, type, type, isHyper, null, fieldIds);
- }
-
- public TypedFieldId(MajorType intermediateType, MajorType secondaryFinal, MajorType finalType, boolean isHyper, PathSegment remainder, int... fieldIds) {
- this(intermediateType, secondaryFinal, finalType, isHyper, false, remainder, fieldIds);
- }
-
- public TypedFieldId(MajorType intermediateType, MajorType secondaryFinal, MajorType finalType, boolean isHyper, boolean isListVector, PathSegment remainder, int... fieldIds) {
- super();
- this.intermediateType = intermediateType;
- this.finalType = finalType;
- this.secondaryFinal = secondaryFinal;
- this.fieldIds = fieldIds;
- this.isHyperReader = isHyper;
- this.isListVector = isListVector;
- this.remainder = remainder;
- }
-
- public TypedFieldId cloneWithChild(int id) {
- int[] fieldIds = ArrayUtils.add(this.fieldIds, id);
- return new TypedFieldId(intermediateType, secondaryFinal, finalType, isHyperReader, remainder, fieldIds);
- }
-
- public PathSegment getLastSegment() {
- if (remainder == null) {
- return null;
- }
- PathSegment seg = remainder;
- while (seg.getChild() != null) {
- seg = seg.getChild();
- }
- return seg;
- }
-
- public TypedFieldId cloneWithRemainder(PathSegment remainder) {
- return new TypedFieldId(intermediateType, secondaryFinal, finalType, isHyperReader, remainder, fieldIds);
- }
-
- public boolean hasRemainder() {
- return remainder != null;
- }
-
- public PathSegment getRemainder() {
- return remainder;
- }
-
- public boolean isHyperReader() {
- return isHyperReader;
- }
-
- public boolean isListVector() {
- return isListVector;
- }
-
- public MajorType getIntermediateType() {
- return intermediateType;
- }
-
- public Class<? extends ValueVector> getIntermediateClass() {
- return (Class<? extends ValueVector>) BasicTypeHelper.getValueVectorClass(intermediateType.getMinorType(),
- intermediateType.getMode());
- }
-
- public MajorType getFinalType() {
- return finalType;
- }
-
- public int[] getFieldIds() {
- return fieldIds;
- }
-
- public MajorType getSecondaryFinal() {
- return secondaryFinal;
- }
-
- public static Builder newBuilder() {
- return new Builder();
- }
-
- public static class Builder{
- final IntArrayList ids = new IntArrayList();
- MajorType finalType;
- MajorType intermediateType;
- MajorType secondaryFinal;
- PathSegment remainder;
- boolean hyperReader = false;
- boolean withIndex = false;
- boolean isListVector = false;
-
- public Builder addId(int id) {
- ids.add(id);
- return this;
- }
-
- public Builder withIndex() {
- withIndex = true;
- return this;
- }
-
- public Builder remainder(PathSegment remainder) {
- this.remainder = remainder;
- return this;
- }
-
- public Builder hyper() {
- this.hyperReader = true;
- return this;
- }
-
- public Builder listVector() {
- this.isListVector = true;
- return this;
- }
-
- public Builder finalType(MajorType finalType) {
- this.finalType = finalType;
- return this;
- }
-
- public Builder secondaryFinal(MajorType secondaryFinal) {
- this.secondaryFinal = secondaryFinal;
- return this;
- }
-
- public Builder intermediateType(MajorType intermediateType) {
- this.intermediateType = intermediateType;
- return this;
- }
-
- public TypedFieldId build() {
- Preconditions.checkNotNull(intermediateType);
- Preconditions.checkNotNull(finalType);
-
- if (intermediateType == null) {
- intermediateType = finalType;
- }
- if (secondaryFinal == null) {
- secondaryFinal = finalType;
- }
-
- MajorType actualFinalType = finalType;
- //MajorType secondaryFinal = finalType;
-
- // if this has an index, switch to required type for output
- //if(withIndex && intermediateType == finalType) actualFinalType = finalType.toBuilder().setMode(DataMode.REQUIRED).build();
-
- // if this isn't a direct access, switch the final type to nullable as offsets may be null.
- // TODO: there is a bug here with some things.
- //if(intermediateType != finalType) actualFinalType = finalType.toBuilder().setMode(DataMode.OPTIONAL).build();
-
- return new TypedFieldId(intermediateType, secondaryFinal, actualFinalType, hyperReader, isListVector, remainder, ids.toArray());
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + Arrays.hashCode(fieldIds);
- result = prime * result + ((finalType == null) ? 0 : finalType.hashCode());
- result = prime * result + ((intermediateType == null) ? 0 : intermediateType.hashCode());
- result = prime * result + (isHyperReader ? 1231 : 1237);
- result = prime * result + ((remainder == null) ? 0 : remainder.hashCode());
- result = prime * result + ((secondaryFinal == null) ? 0 : secondaryFinal.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- TypedFieldId other = (TypedFieldId) obj;
- if (!Arrays.equals(fieldIds, other.fieldIds)) {
- return false;
- }
- if (finalType == null) {
- if (other.finalType != null) {
- return false;
- }
- } else if (!finalType.equals(other.finalType)) {
- return false;
- }
- if (intermediateType == null) {
- if (other.intermediateType != null) {
- return false;
- }
- } else if (!intermediateType.equals(other.intermediateType)) {
- return false;
- }
- if (isHyperReader != other.isHyperReader) {
- return false;
- }
- if (remainder == null) {
- if (other.remainder != null) {
- return false;
- }
- } else if (!remainder.equals(other.remainder)) {
- return false;
- }
- if (secondaryFinal == null) {
- if (other.secondaryFinal != null) {
- return false;
- }
- } else if (!secondaryFinal.equals(other.secondaryFinal)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- final int maxLen = 10;
- return "TypedFieldId [fieldIds="
- + (fieldIds != null ? Arrays.toString(Arrays.copyOf(fieldIds, Math.min(fieldIds.length, maxLen))) : null)
- + ", remainder=" + remainder + "]";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 23ad778..f520ea4 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
@@ -24,7 +24,6 @@ import java.util.Iterator;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterators;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.proto.UserBitShared.SerializedField;
import org.apache.drill.exec.record.MaterializedField;
@@ -66,13 +65,13 @@ public abstract class BaseValueVector implements ValueVector {
return field;
}
- public MaterializedField getField(FieldReference ref){
+ public MaterializedField getField(String ref){
return getField().withPath(ref);
}
@Override
public TransferPair getTransferPair(BufferAllocator allocator) {
- return getTransferPair(new FieldReference(getField().getPath()), allocator);
+ return getTransferPair(getField().getPath(), allocator);
}
@Override
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 3ba11e2..2b22f52 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
@@ -20,7 +20,6 @@ package org.apache.drill.exec.vector;
import com.google.common.base.Preconditions;
import io.netty.buffer.DrillBuf;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.exec.exception.OversizedAllocationException;
import org.apache.drill.exec.expr.holders.BitHolder;
import org.apache.drill.exec.expr.holders.NullableBitHolder;
@@ -185,7 +184,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
@Override
public void load(SerializedField metadata, DrillBuf buffer) {
- Preconditions.checkArgument(this.field.matches(metadata), "The field %s doesn't match the provided metadata %s.", this.field, metadata);
+ Preconditions.checkArgument(this.field.getPath().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();
@@ -213,7 +212,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator) {
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator) {
return new TransferImpl(getField().withPath(ref), allocator);
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
index 494f234..4479db0 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ObjectVector.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.exec.expr.holders.ObjectHolder;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.exception.OutOfMemoryException;
@@ -157,7 +156,7 @@ public class ObjectVector extends BaseValueVector {
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator) {
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator) {
throw new UnsupportedOperationException("ObjectVector does not support this");
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
index a4a071e..47cf143 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ValueVector.java
@@ -21,7 +21,6 @@ import java.io.Closeable;
import io.netty.buffer.DrillBuf;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.exec.exception.OutOfMemoryException;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.proto.UserBitShared.SerializedField;
@@ -104,7 +103,7 @@ public interface ValueVector extends Closeable, Iterable<ValueVector> {
*/
TransferPair getTransferPair(BufferAllocator allocator);
- TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator);
+ TransferPair getTransferPair(String ref, BufferAllocator allocator);
/**
* Returns a new {@link org.apache.drill.exec.record.TransferPair transfer pair} that is used to transfer underlying
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 2ecaef6..dc8928e 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
@@ -20,7 +20,6 @@ package org.apache.drill.exec.vector;
import java.util.Collection;
import com.google.common.base.Preconditions;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.common.types.TypeProtos;
import org.apache.drill.exec.record.MaterializedField;
@@ -62,7 +61,7 @@ public class VectorDescriptor {
}
public VectorDescriptor withName(final String name) {
- return new VectorDescriptor(field.withPath(new FieldReference(name)));
+ return new VectorDescriptor(field.withPath(name));
}
public VectorDescriptor withType(final TypeProtos.MajorType type) {
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
----------------------------------------------------------------------
diff --git a/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java b/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
index 165fc14..e79542b 100644
--- a/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
+++ b/exec/vector/src/main/java/org/apache/drill/exec/vector/ZeroVector.java
@@ -21,7 +21,6 @@ import java.util.Iterator;
import com.google.common.collect.Iterators;
import io.netty.buffer.DrillBuf;
-import org.apache.drill.common.expression.FieldReference;
import org.apache.drill.common.types.Types;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.exception.OutOfMemoryException;
@@ -151,7 +150,7 @@ public class ZeroVector implements ValueVector {
}
@Override
- public TransferPair getTransferPair(FieldReference ref, BufferAllocator allocator) {
+ public TransferPair getTransferPair(String ref, BufferAllocator allocator) {
return defaultPair;
}
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 0ac2417..5dd794e 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
@@ -21,14 +21,12 @@ import java.util.Collection;
import javax.annotation.Nullable;
-import org.apache.drill.common.expression.PathSegment;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.exec.exception.OutOfMemoryException;
import org.apache.drill.exec.memory.BufferAllocator;
import org.apache.drill.exec.record.MaterializedField;
-import org.apache.drill.exec.record.TypedFieldId;
import org.apache.drill.exec.util.CallBack;
import org.apache.drill.exec.vector.ValueVector;
@@ -45,7 +43,7 @@ import com.google.common.collect.Sets;
public abstract class AbstractContainerVector implements ValueVector {
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AbstractContainerVector.class);
- protected final MaterializedField field;
+ protected MaterializedField field;
protected final BufferAllocator allocator;
protected final CallBack callBack;
@@ -111,10 +109,6 @@ public abstract class AbstractContainerVector implements ValueVector {
throw new IllegalStateException(String.format("Vector requested [%s] was different than type stored [%s]. Drill doesn't yet support hetergenous types.", clazz.getSimpleName(), v.getClass().getSimpleName()));
}
- public TypedFieldId getFieldIdIfMatches(TypedFieldId.Builder builder, boolean addToBreadCrumb, PathSegment seg) {
- return FieldIdUtil.getFieldIdIfMatches(this, builder, addToBreadCrumb, seg);
- }
-
MajorType getLastPathType() {
if((this.getField().getType().getMinorType() == MinorType.LIST &&
this.getField().getType().getMode() == DataMode.REPEATED)) { // Use Repeated scalar type instead of Required List.
http://git-wip-us.apache.org/repos/asf/drill/blob/9a3a5c4f/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 6597311..08952ab 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
@@ -130,7 +130,7 @@ public abstract class AbstractMapVector extends AbstractContainerVector {
create = true;
}
if (create) {
- final T vector = (T) BasicTypeHelper.getNewVector(field.getPath(), name, allocator, type, callBack);
+ final T vector = (T) BasicTypeHelper.getNewVector(name, allocator, type, callBack);
putChild(name, vector);
if (callBack!=null) {
callBack.doWork();
|