You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@s2graph.apache.org by da...@apache.org on 2016/01/04 07:40:45 UTC

[12/46] incubator-s2graph git commit: add short circuit for IN clause

add short circuit for IN clause


Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/d358931b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/d358931b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/d358931b

Branch: refs/heads/feature/test_daewon
Commit: d358931b9bef535dc46cc65e12123e4a7061a45c
Parents: abf356c
Author: SteamShon <sh...@gmail.com>
Authored: Tue Dec 22 17:32:42 2015 +0900
Committer: SteamShon <sh...@gmail.com>
Committed: Tue Dec 22 17:32:42 2015 +0900

----------------------------------------------------------------------
 .../com/kakao/s2graph/core/rest/RequestParser.scala     |  2 +-
 .../kakao/s2graph/core/parsers/WhereParserTest.scala    | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/d358931b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
index f9a6d01..2081a18 100644
--- a/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
+++ b/s2core/src/main/scala/com/kakao/s2graph/core/rest/RequestParser.scala
@@ -202,7 +202,7 @@ class RequestParser(config: Config) extends JSONParser {
           val queryParams =
             for {
               labelGroup <- queryParamJsVals
-              queryParam <- parseQueryParam(labelMap, labelGroup)
+              queryParam <- parseQueryParam(labelGroup)
             } yield {
               val (_, columnName) =
                 if (queryParam.labelWithDir.dir == GraphUtil.directions("out")) {

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/d358931b/s2core/src/test/scala/com/kakao/s2graph/core/parsers/WhereParserTest.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/com/kakao/s2graph/core/parsers/WhereParserTest.scala b/s2core/src/test/scala/com/kakao/s2graph/core/parsers/WhereParserTest.scala
index 73d0d76..7663496 100644
--- a/s2core/src/test/scala/com/kakao/s2graph/core/parsers/WhereParserTest.scala
+++ b/s2core/src/test/scala/com/kakao/s2graph/core/parsers/WhereParserTest.scala
@@ -31,8 +31,8 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
 
   val labelMap = Map(label.label -> label)
 
-  def validate(labelMap: Map[String, Label])(edge: Edge)(sql: String)(expected: Boolean) = {
-    val whereOpt = WhereParser(labelMap).parse(sql)
+  def validate(label: Label)(edge: Edge)(sql: String)(expected: Boolean) = {
+    val whereOpt = WhereParser(label).parse(sql)
     whereOpt.isSuccess shouldBe true
 
     println("=================================================================")
@@ -57,7 +57,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
       val js = Json.obj("is_hidden" -> true, "is_blocked" -> false, "weight" -> 10, "time" -> 3, "name" -> "abc")
       val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
       val edge = Edge(srcVertex, tgtVertex, labelWithDir, 0.toByte, ts, propsInner)
-      val f = validate(labelMap)(edge) _
+      val f = validate(label)(edge) _
 
       /** labelName label is long-long relation */
       f(s"_to=${tgtVertex.innerId.toString}")(true)
@@ -77,7 +77,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
       val propsInner = Management.toProps(label, js.fields).map { case (k, v) => k -> InnerValLikeWithTs(v, ts) }.toMap + dummyTs
       val edge = Edge(srcVertex, tgtVertex, labelWithDir, 0.toByte, ts, propsInner)
 
-      val f = validate(labelMap)(edge) _
+      val f = validate(label)(edge) _
 
       // time == 3
       f("time >= 3")(true)
@@ -107,7 +107,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
       val labelWithDirection = if (schemaVer == VERSION2) labelWithDirV2 else labelWithDir
       val edge = Edge(srcVertex, tgtVertex, labelWithDirection, 0.toByte, ts, propsInner)
       val lname = if (schemaVer == VERSION2) labelNameV2 else labelName
-      val f = validate(labelMap)(edge) _
+      val f = validate(label)(edge) _
 
       f(s"_from = -1 or _to = ${tgtVertex.innerId.value}")(true)
       f(s"_from = ${srcVertex.innerId.value} and _to = ${tgtVertex.innerId.value}")(true)
@@ -139,7 +139,7 @@ class WhereParserTest extends FunSuite with Matchers with TestCommonWithModels {
       println(parentEdge.toString)
       println(grandParentEdge.toString)
 
-      val f = validate(labelMap)(edge) _
+      val f = validate(label)(edge) _
 
       // Compare edge's prop(`_from`) with edge's prop(`name`)
       f("_from = 1")(true)