atlas git commit: ATLAS-2134: Code Improvements.

2017-09-13 Thread amestry
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 221e829fc -> 4c7430ddf


ATLAS-2134: Code Improvements.


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/4c7430dd
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/4c7430dd
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/4c7430dd

Branch: refs/heads/branch-0.8
Commit: 4c7430ddf8865cb1163decf75d71735e991399ff
Parents: 221e829
Author: ashutoshm 
Authored: Wed Sep 13 19:05:41 2017 -0700
Committer: ashutoshm 
Committed: Wed Sep 13 19:06:36 2017 -0700

--
 .../apache/atlas/repository/impexp/ZipSource.java  |  2 +-
 .../atlas/query/GraphPersistenceStrategies.scala   |  2 ++
 .../scala/org/apache/atlas/query/QueryParser.scala | 17 ++---
 3 files changed, 13 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/4c7430dd/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java 
b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
index 4c23582..bd51d3b 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
@@ -175,7 +175,7 @@ public class ZipSource implements EntityImportStream {
 currentPosition++;
 return getEntityWithExtInfo(this.iterator.next());
 } catch (AtlasBaseException e) {
-e.printStackTrace();
+LOG.error("getNextEntityWithExtInfo", e);
 return null;
 }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/4c7430dd/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
--
diff --git 
a/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
 
b/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
index 752a522..c2b3436 100755
--- 
a/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
+++ 
b/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
@@ -284,6 +284,8 @@ case class GraphPersistenceStrategy1(g: AtlasGraph[_,_]) 
extends GraphPersistenc
 case DataTypes.TypeCategory.TRAIT =>
 throw new UnsupportedOperationException(s"load for 
${aInfo.dataType()} not supported")
 case DataTypes.TypeCategory.CLASS => loadStructAttribute(dataType, 
aInfo, i, v)
+case DataTypes.TypeCategory.RELATIONSHIP =>
+throw new UnsupportedOperationException(s"load for 
${aInfo.dataType()} not supported")
 }
 }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/4c7430dd/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
--
diff --git a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala 
b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
index 7b7cd98..4bc6e74 100755
--- a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
+++ b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
@@ -233,6 +233,7 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
 def querySrc: Parser[Expression] = rep1sep(singleQrySrc, opt(COMMA)) ^^ { 
l => l match {
 case h :: Nil => h
 case h :: t => t.foldLeft(h)(merge(_, _))
+case Nil => null
 }
 }
 
@@ -277,21 +278,21 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
   case o ~ odr ~ None => (odr, true)
   case o ~ odr ~ asc => (odr, asc.get)
 }
-
+
 def limitOffset: Parser[(Int, Int)] = LIMIT ~ lmt ~ opt (offset) ^^ {
   case l ~ lt ~ None => (lt.toInt, 0)
   case l ~ lt ~ of => (lt.toInt, of.get.toInt)
 }
-
+
 def offset = OFFSET ~ ofset  ^^ {
   case offset ~ of  => of
 }
-
+
 def asce = asc ^^ {
   case DESC  => false
   case  _ => true
 }
-
+
 def loopExpression(implicit queryParams: QueryParams): Parser[(Expression, 
Option[Literal[Integer]], Option[String])] =
 LOOP ~ (LPAREN ~> query <~ RPAREN) ~ opt(intConstant <~ TIMES) ~ 
opt(AS ~> alias) ^^ {
 case l ~ e ~ None ~ a => (e, None, a)
@@ -361,17 +362,19 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
 case h :: t => { //the left-most part of the identifier (h) can be
 

atlas git commit: ATLAS-2134: Code Improvements.

2017-09-13 Thread amestry
Repository: atlas
Updated Branches:
  refs/heads/master 1dc7f5499 -> 8eb9c9567


ATLAS-2134: Code Improvements.


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/8eb9c956
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/8eb9c956
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/8eb9c956

Branch: refs/heads/master
Commit: 8eb9c95677c0466835fc5aa6cbcfa630616cbd3b
Parents: 1dc7f54
Author: ashutoshm 
Authored: Wed Sep 13 19:05:41 2017 -0700
Committer: ashutoshm 
Committed: Wed Sep 13 19:06:04 2017 -0700

--
 .../apache/atlas/repository/impexp/ZipSource.java  |  2 +-
 .../atlas/query/GraphPersistenceStrategies.scala   |  2 ++
 .../scala/org/apache/atlas/query/QueryParser.scala | 17 ++---
 3 files changed, 13 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/atlas/blob/8eb9c956/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
--
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java 
b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
index 4c23582..bd51d3b 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ZipSource.java
@@ -175,7 +175,7 @@ public class ZipSource implements EntityImportStream {
 currentPosition++;
 return getEntityWithExtInfo(this.iterator.next());
 } catch (AtlasBaseException e) {
-e.printStackTrace();
+LOG.error("getNextEntityWithExtInfo", e);
 return null;
 }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/8eb9c956/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
--
diff --git 
a/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
 
b/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
index 752a522..c2b3436 100755
--- 
a/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
+++ 
b/repository/src/main/scala/org/apache/atlas/query/GraphPersistenceStrategies.scala
@@ -284,6 +284,8 @@ case class GraphPersistenceStrategy1(g: AtlasGraph[_,_]) 
extends GraphPersistenc
 case DataTypes.TypeCategory.TRAIT =>
 throw new UnsupportedOperationException(s"load for 
${aInfo.dataType()} not supported")
 case DataTypes.TypeCategory.CLASS => loadStructAttribute(dataType, 
aInfo, i, v)
+case DataTypes.TypeCategory.RELATIONSHIP =>
+throw new UnsupportedOperationException(s"load for 
${aInfo.dataType()} not supported")
 }
 }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/8eb9c956/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
--
diff --git a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala 
b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
index 7b7cd98..4bc6e74 100755
--- a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
+++ b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala
@@ -233,6 +233,7 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
 def querySrc: Parser[Expression] = rep1sep(singleQrySrc, opt(COMMA)) ^^ { 
l => l match {
 case h :: Nil => h
 case h :: t => t.foldLeft(h)(merge(_, _))
+case Nil => null
 }
 }
 
@@ -277,21 +278,21 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
   case o ~ odr ~ None => (odr, true)
   case o ~ odr ~ asc => (odr, asc.get)
 }
-
+
 def limitOffset: Parser[(Int, Int)] = LIMIT ~ lmt ~ opt (offset) ^^ {
   case l ~ lt ~ None => (lt.toInt, 0)
   case l ~ lt ~ of => (lt.toInt, of.get.toInt)
 }
-
+
 def offset = OFFSET ~ ofset  ^^ {
   case offset ~ of  => of
 }
-
+
 def asce = asc ^^ {
   case DESC  => false
   case  _ => true
 }
-
+
 def loopExpression(implicit queryParams: QueryParams): Parser[(Expression, 
Option[Literal[Integer]], Option[String])] =
 LOOP ~ (LPAREN ~> query <~ RPAREN) ~ opt(intConstant <~ TIMES) ~ 
opt(AS ~> alias) ^^ {
 case l ~ e ~ None ~ a => (e, None, a)
@@ -361,17 +362,19 @@ object QueryParser extends StandardTokenParsers with 
QueryKeywords with Expressi
 case h :: t => { //the left-most part of the identifier (h) can be