You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@s2graph.apache.org by st...@apache.org on 2016/12/28 01:08:03 UTC

[2/2] incubator-s2graph git commit: [S2GRAPH-135] Change the way LabelIndexOption is implemented and improve it

[S2GRAPH-135] Change the way LabelIndexOption is implemented and improve it

JIRA:
    [S2GRAPH-135] https://issues.apache.org/jira/browse/S2GRAPH-135

Pull Request:
    Closes #103

Author
    daewon <bl...@gmail.com>


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

Branch: refs/heads/master
Commit: 146094b50f682f077b5984847e0389585ce4345e
Parents: 7951f55 20bdf92
Author: DO YUNG YOON <st...@apache.org>
Authored: Wed Dec 28 10:06:23 2016 +0900
Committer: DO YUNG YOON <st...@apache.org>
Committed: Wed Dec 28 10:06:23 2016 +0900

----------------------------------------------------------------------
 CHANGES                                         |   2 +
 .../scala/org/apache/s2graph/core/S2Edge.scala  |  52 ++++---
 .../apache/s2graph/core/mysqls/LabelIndex.scala |  52 +++----
 .../apache/s2graph/core/storage/Storage.scala   |  44 ++----
 .../core/Integrate/IntegrateCommon.scala        |  63 +++++++-
 .../core/Integrate/LabelIndexOptionTest.scala   | 144 +++++++++++++++++++
 6 files changed, 274 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/146094b5/CHANGES
----------------------------------------------------------------------
diff --cc CHANGES
index 362fa98,860d2f5..8328fec
--- a/CHANGES
+++ b/CHANGES
@@@ -99,6 -99,6 +99,8 @@@ Release 0.1.0 - unrelease
      S2GRAPH-121: Create `Result` class to hold traverse result edges (Committed by DOYUNG YOON).
   
      S2GRAPH-122: Change data types of Edge/IndexEdge/SnapshotEdge (Committed by DOYUNG YOON).
++ 
++    S2GRAPH-135: Change the way LabelIndexOption is implemented and improve it (Committed by daewon).
  
    BUG FIXES
  

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/146094b5/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
----------------------------------------------------------------------
diff --cc s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
index 9cfde75,5c2a5dc..1472786
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
@@@ -567,8 -577,23 +571,24 @@@ case class S2Edge(innerGraph: S2Graph
    override def label(): String = innerLabel.label
  }
  
 +case class EdgeId(srcVertexId: InnerValLike, tgtVertexId: InnerValLike, labelName: String, direction: String)
  
+ object EdgeMutate {
+   def filterIndexOptionForDegree(edges: Seq[IndexEdge]): Seq[IndexEdge] = edges.filter { ie =>
+     ie.indexOption.fold(true)(_.storeDegree)
+   }
+ 
+   def filterIndexOption(edges: Seq[IndexEdge]): Seq[IndexEdge] = edges.filter { ie =>
+     ie.indexOption.fold(true) { option =>
+       val hashValueOpt = ie.orders.find { case (k, v) => k == LabelMeta.fromHash }.map { case (k, v) =>
+         v.value.toString.toLong
+       }
+ 
+       option.sample(ie, hashValueOpt)
+     }
+   }
+ }
+ 
  case class EdgeMutate(edgesToDelete: List[IndexEdge] = List.empty[IndexEdge],
                        edgesToInsert: List[IndexEdge] = List.empty[IndexEdge],
                        newSnapshotEdge: Option[SnapshotEdge] = None) {

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/146094b5/s2core/src/main/scala/org/apache/s2graph/core/storage/Storage.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/146094b5/s2core/src/test/scala/org/apache/s2graph/core/Integrate/IntegrateCommon.scala
----------------------------------------------------------------------