Repository: incubator-s2graph Updated Branches: refs/heads/master cdcc0769f -> 5ac470e91
[S2GRAPH-40]: PostProcess.toHashKey gives different hash key with same value when edge's label schema version is different. use toString rather hashCode on different version of InnerVal v1 and v2 InnerVal use different bytes encoding scheme. JIRA: [S2GRAPH-40] https://issues.apache.org/jira/browse/S2GRAPH-40 Pull Request: Closes #23 Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/5ac470e9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/5ac470e9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/5ac470e9 Branch: refs/heads/master Commit: 5ac470e91a1bc2353285edd8e47ad1e394491ffb Parents: cdcc076 Author: DO YUNG YOON <[email protected]> Authored: Tue Feb 23 16:42:01 2016 +0900 Committer: DO YUNG YOON <[email protected]> Committed: Tue Feb 23 16:42:01 2016 +0900 ---------------------------------------------------------------------- CHANGES | 3 ++ .../com/kakao/s2graph/core/PostProcess.scala | 29 ++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/5ac470e9/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index e53d7a6..0a0a10b 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,9 @@ Release 0.12.1 - unreleased S2GRAPH-39: Better exception message on converting between Json and InnerVal (Committed by DOYUNG YOON). + S2GRAPH-40: PostProcess.toHashKey gives different hash key with same value when edge's label schema version is different + (Committed by DOYUNG YOON). + BUG FIXES S2GRAPH-18: Query Option "interval" is Broken. http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/5ac470e9/s2core/src/main/scala/com/kakao/s2graph/core/PostProcess.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/com/kakao/s2graph/core/PostProcess.scala b/s2core/src/main/scala/com/kakao/s2graph/core/PostProcess.scala index b51397b..4289c87 100644 --- a/s2core/src/main/scala/com/kakao/s2graph/core/PostProcess.scala +++ b/s2core/src/main/scala/com/kakao/s2graph/core/PostProcess.scala @@ -1,19 +1,26 @@ package com.kakao.s2graph.core import com.kakao.s2graph.core.GraphExceptions.BadQueryException -import com.kakao.s2graph.core._ -import com.kakao.s2graph.core.mysqls._ + +import com.kakao.s2graph.core.mysqls.{ColumnMeta, Label, ServiceColumn, LabelMeta} import com.kakao.s2graph.core.types.{InnerVal, InnerValLike} +import com.kakao.s2graph.core.utils.logger import play.api.libs.json.{Json, _} - -import scala.collection.mutable.ListBuffer +import scala.collection.mutable.{ArrayBuffer, ListBuffer} object PostProcess extends JSONParser { + + + type EDGE_VALUES = Map[String, JsValue] + type ORDER_BY_VALUES = (Any, Any, Any, Any) + type RAW_EDGE = (EDGE_VALUES, Double, ORDER_BY_VALUES) + /** - * Result Entity score field name - */ - val timeoutResults = Json.obj("size" -> 0, "results" -> Json.arr(), "isTimeout" -> true) - val emptyResults = Json.obj("size" -> 0, "results" -> Json.arr(), "isEmpty" -> true) + * Result Entity score field name + */ + val emptyDegrees = Seq.empty[JsValue] + val timeoutResults = Json.obj("size" -> 0, "degrees" -> Json.arr(), "results" -> Json.arr(), "isTimeout" -> true) + val emptyResults = Json.obj("size" -> 0, "degrees" -> Json.arr(), "results" -> Json.arr(), "isEmpty" -> true) def badRequestResults(ex: => Exception) = ex match { case ex: BadQueryException => Json.obj("message" -> ex.msg) case _ => Json.obj("message" -> ex.getMessage) @@ -86,8 +93,8 @@ object PostProcess extends JSONParser { field <- fields } yield { field match { - case "from" | "_from" => edge.srcVertex.innerId - case "to" | "_to" => edge.tgtVertex.innerId + case "from" | "_from" => edge.srcVertex.innerId.toIdString() + case "to" | "_to" => edge.tgtVertex.innerId.toIdString() case "label" => edge.labelWithDir.labelId case "direction" => JsString(GraphUtil.fromDirection(edge.labelWithDir.dir)) case "_timestamp" | "timestamp" => edge.ts @@ -112,7 +119,7 @@ object PostProcess extends JSONParser { q = queryRequest.query edgeWithScore <- queryResult.edgeWithScoreLs (edge, score) = EdgeWithScore.unapply(edgeWithScore).get - } yield toHashKey(edge, queryRequest.queryParam, q.filterOutFields) + } yield toHashKey(edge, queryRequest.queryParam, q.filterOutFields) } def summarizeWithListExcludeFormatted(queryRequestWithResultLs: Seq[QueryRequestWithResult], exclude: Seq[QueryRequestWithResult]) = {
