You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ad...@apache.org on 2015/09/18 20:38:34 UTC
drill git commit: DRILL-3767:
SchemaPath.getCompoundPath(String...strings) reverses it's input array
Repository: drill
Updated Branches:
refs/heads/master 813903a34 -> 3f5ebafca
DRILL-3767: SchemaPath.getCompoundPath(String...strings) reverses it's input array
this closes #155
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/3f5ebafc
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/3f5ebafc
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/3f5ebafc
Branch: refs/heads/master
Commit: 3f5ebafcaa8fc0ed08d5964081e4c22a6906d46b
Parents: 813903a
Author: adeneche <ad...@gmail.com>
Authored: Fri Sep 11 10:31:59 2015 -0700
Committer: adeneche <ad...@gmail.com>
Committed: Fri Sep 18 10:37:00 2015 -0700
----------------------------------------------------------------------
.../drill/common/expression/SchemaPath.java | 25 ++++++--------------
1 file changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/3f5ebafc/common/src/main/java/org/apache/drill/common/expression/SchemaPath.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/expression/SchemaPath.java b/common/src/main/java/org/apache/drill/common/expression/SchemaPath.java
index 1d7f922..9718071 100644
--- a/common/src/main/java/org/apache/drill/common/expression/SchemaPath.java
+++ b/common/src/main/java/org/apache/drill/common/expression/SchemaPath.java
@@ -18,10 +18,7 @@
package org.apache.drill.common.expression;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Iterator;
-import java.util.List;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
@@ -39,7 +36,6 @@ import org.apache.drill.exec.proto.UserBitShared.NamePart;
import org.apache.drill.exec.proto.UserBitShared.NamePart.Type;
import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.google.common.base.Preconditions;
@@ -54,15 +50,15 @@ public class SchemaPath extends LogicalExpressionBase {
}
public static SchemaPath getCompoundPath(String... strings) {
- List<String> paths = Arrays.asList(strings);
- Collections.reverse(paths);
NameSegment s = null;
- for (String p : paths) {
- s = new NameSegment(p, s);
+ // loop through strings in reverse order
+ for (int i = strings.length - 1; i >= 0; i--) {
+ s = new NameSegment(strings[i], s);
}
return new SchemaPath(s);
}
+ @SuppressWarnings("unused")
public PathSegment getLastSegment() {
PathSegment s= rootSegment;
while (s.getChild() != null) {
@@ -71,10 +67,6 @@ public class SchemaPath extends LogicalExpressionBase {
return s;
}
- /**
- *
- * @param simpleName
- */
@Deprecated
public SchemaPath(String simpleName, ExpressionPosition pos) {
super(pos);
@@ -165,6 +157,7 @@ public class SchemaPath extends LogicalExpressionBase {
return new SchemaPath(newRoot);
}
+ @SuppressWarnings("unused")
public SchemaPath getUnindexedArrayChild() {
NameSegment newRoot = rootSegment.cloneWithNewChild(new ArraySegment(null));
return new SchemaPath(newRoot);
@@ -220,10 +213,7 @@ public class SchemaPath extends LogicalExpressionBase {
}
SchemaPath other = (SchemaPath) obj;
- if (rootSegment == null) {
- return true;
- }
- return rootSegment.contains(other.rootSegment);
+ return rootSegment == null || rootSegment.contains(other.rootSegment);
}
@Override
@@ -270,8 +260,7 @@ public class SchemaPath extends LogicalExpressionBase {
}
@Override
- public SchemaPath deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException,
- JsonProcessingException {
+ public SchemaPath deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
String expr = jp.getText();
if (expr == null || expr.isEmpty()) {