Commit 8eb9c956 by ashutoshm

ATLAS-2134: Code Improvements.

parent 1dc7f549
...@@ -175,7 +175,7 @@ public class ZipSource implements EntityImportStream { ...@@ -175,7 +175,7 @@ public class ZipSource implements EntityImportStream {
currentPosition++; currentPosition++;
return getEntityWithExtInfo(this.iterator.next()); return getEntityWithExtInfo(this.iterator.next());
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
e.printStackTrace(); LOG.error("getNextEntityWithExtInfo", e);
return null; return null;
} }
} }
......
...@@ -284,6 +284,8 @@ case class GraphPersistenceStrategy1(g: AtlasGraph[_,_]) extends GraphPersistenc ...@@ -284,6 +284,8 @@ case class GraphPersistenceStrategy1(g: AtlasGraph[_,_]) extends GraphPersistenc
case DataTypes.TypeCategory.TRAIT => case DataTypes.TypeCategory.TRAIT =>
throw new UnsupportedOperationException(s"load for ${aInfo.dataType()} not supported") throw new UnsupportedOperationException(s"load for ${aInfo.dataType()} not supported")
case DataTypes.TypeCategory.CLASS => loadStructAttribute(dataType, aInfo, i, v) case DataTypes.TypeCategory.CLASS => loadStructAttribute(dataType, aInfo, i, v)
case DataTypes.TypeCategory.RELATIONSHIP =>
throw new UnsupportedOperationException(s"load for ${aInfo.dataType()} not supported")
} }
} }
......
...@@ -233,6 +233,7 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi ...@@ -233,6 +233,7 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi
def querySrc: Parser[Expression] = rep1sep(singleQrySrc, opt(COMMA)) ^^ { l => l match { def querySrc: Parser[Expression] = rep1sep(singleQrySrc, opt(COMMA)) ^^ { l => l match {
case h :: Nil => h case h :: Nil => h
case h :: t => t.foldLeft(h)(merge(_, _)) case h :: t => t.foldLeft(h)(merge(_, _))
case Nil => null
} }
} }
...@@ -277,21 +278,21 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi ...@@ -277,21 +278,21 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi
case o ~ odr ~ None => (odr, true) case o ~ odr ~ None => (odr, true)
case o ~ odr ~ asc => (odr, asc.get) case o ~ odr ~ asc => (odr, asc.get)
} }
def limitOffset: Parser[(Int, Int)] = LIMIT ~ lmt ~ opt (offset) ^^ { def limitOffset: Parser[(Int, Int)] = LIMIT ~ lmt ~ opt (offset) ^^ {
case l ~ lt ~ None => (lt.toInt, 0) case l ~ lt ~ None => (lt.toInt, 0)
case l ~ lt ~ of => (lt.toInt, of.get.toInt) case l ~ lt ~ of => (lt.toInt, of.get.toInt)
} }
def offset = OFFSET ~ ofset ^^ { def offset = OFFSET ~ ofset ^^ {
case offset ~ of => of case offset ~ of => of
} }
def asce = asc ^^ { def asce = asc ^^ {
case DESC => false case DESC => false
case _ => true case _ => true
} }
def loopExpression(implicit queryParams: QueryParams): Parser[(Expression, Option[Literal[Integer]], Option[String])] = def loopExpression(implicit queryParams: QueryParams): Parser[(Expression, Option[Literal[Integer]], Option[String])] =
LOOP ~ (LPAREN ~> query <~ RPAREN) ~ opt(intConstant <~ TIMES) ~ opt(AS ~> alias) ^^ { LOOP ~ (LPAREN ~> query <~ RPAREN) ~ opt(intConstant <~ TIMES) ~ opt(AS ~> alias) ^^ {
case l ~ e ~ None ~ a => (e, None, a) case l ~ e ~ None ~ a => (e, None, a)
...@@ -361,17 +362,19 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi ...@@ -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 case h :: t => { //the left-most part of the identifier (h) can be
t.foldLeft(id(h).asInstanceOf[Expression])(_.field(_)) t.foldLeft(id(h).asInstanceOf[Expression])(_.field(_))
} }
case Nil => null
} }
} }
def alias = ident | stringLit def alias = ident | stringLit
def lmt = intConstant def lmt = intConstant
def ofset = intConstant def ofset = intConstant
def asc = ident | stringLit def asc = ident | stringLit
def literal = booleanConstant ^^ { def literal = booleanConstant ^^ {
boolean(_) boolean(_)
} | } |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment