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 2017/07/01 15:28:08 UTC

[17/46] incubator-s2graph git commit: [ReferenceEdgeTest] passed all, except shouldNotEvaluateToEqualDifferentId. reference equals is not supported.

[ReferenceEdgeTest] passed all, except shouldNotEvaluateToEqualDifferentId. reference equals is not supported.

- add dataType, schemaVersion in InnerValLike trait.


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

Branch: refs/heads/master
Commit: ee22c6087859eb71cfcf8964aadb02aac61a7847
Parents: 1328546
Author: DO YUNG YOON <st...@apache.org>
Authored: Wed Apr 26 15:33:16 2017 +0900
Committer: DO YUNG YOON <st...@apache.org>
Committed: Wed Apr 26 15:33:16 2017 +0900

----------------------------------------------------------------------
 .../org/apache/s2graph/core/JSONParser.scala    | 15 +++-
 .../scala/org/apache/s2graph/core/S2Edge.scala  | 10 +--
 .../scala/org/apache/s2graph/core/S2Graph.scala | 12 +++-
 .../org/apache/s2graph/core/S2Vertex.scala      |  2 +-
 .../apache/s2graph/core/S2VertexProperty.scala  | 10 ++-
 .../s2graph/core/types/InnerValLike.scala       | 72 +++++---------------
 .../apache/s2graph/core/types/VertexId.scala    |  4 +-
 .../apache/s2graph/core/types/v1/InnerVal.scala |  3 +
 .../apache/s2graph/core/types/v2/InnerVal.scala | 25 +++----
 .../core/tinkerpop/S2GraphProvider.scala        | 60 ++++++++++++----
 10 files changed, 110 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/JSONParser.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/JSONParser.scala b/s2core/src/main/scala/org/apache/s2graph/core/JSONParser.scala
index 90574f2..2324e8e 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/JSONParser.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/JSONParser.scala
@@ -115,7 +115,7 @@ object JSONParser {
   //    }
   //  }
   def isNumericType(dType: String): Boolean = {
-    dType == InnerVal.LONG || dType == InnerVal.INT ||
+    dType == InnerVal.BIGDECIMAL || dType == InnerVal.LONG || dType == InnerVal.INT ||
       dType == InnerVal.SHORT || dType == InnerVal.BYTE ||
       dType == InnerVal.FLOAT || dType == InnerVal.DOUBLE
   }
@@ -124,6 +124,15 @@ object JSONParser {
   def innerValToAny(innerValLike: InnerValLike, dataType: String): Any = {
     val dType = InnerVal.toInnerDataType(dataType)
     dType match {
+      case InnerVal.BIGDECIMAL =>
+        innerValLike.value match {
+          case b: BigDecimal => b
+          case l: Long => BigDecimal(l)
+          case i: Int => BigDecimal(i)
+          case f: Float => BigDecimal(f)
+          case d: Double => BigDecimal(d)
+          case _ => throw new RuntimeException(s"not supported data type: $innerValLike, ${innerValLike.value.getClass}, $dataType")
+        }
       case InnerVal.LONG =>
         innerValLike.value match {
           case b: BigDecimal => b.toLong
@@ -244,7 +253,7 @@ object JSONParser {
           dType match {
             case InnerVal.STRING => Some(InnerVal.withStr(jsValue.toString, version))
             //            case t if InnerVal.NUMERICS.contains(t) =>
-            case InnerVal.BYTE | InnerVal.SHORT | InnerVal.INT | InnerVal.LONG | InnerVal.FLOAT | InnerVal.DOUBLE =>
+            case InnerVal.BIGDECIMAL | InnerVal.BYTE | InnerVal.SHORT | InnerVal.INT | InnerVal.LONG | InnerVal.FLOAT | InnerVal.DOUBLE =>
               Some(InnerVal.withNumber(n.value, version))
             case _ => None
           }
@@ -254,7 +263,7 @@ object JSONParser {
             case InnerVal.STRING => Some(InnerVal.withStr(s, version))
             case InnerVal.BOOLEAN => Some(InnerVal.withBoolean(s.toBoolean, version))
             //            case t if InnerVal.NUMERICS.contains(t) =>
-            case InnerVal.BYTE | InnerVal.SHORT | InnerVal.INT | InnerVal.LONG | InnerVal.FLOAT | InnerVal.DOUBLE =>
+            case InnerVal.BIGDECIMAL | InnerVal.BYTE | InnerVal.SHORT | InnerVal.INT | InnerVal.LONG | InnerVal.FLOAT | InnerVal.DOUBLE =>
               Some(InnerVal.withNumber(BigDecimal(s), version))
             case _ => None
           }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
index 6b389f7..edb3783 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Edge.scala
@@ -30,7 +30,7 @@ import org.apache.s2graph.core.types._
 import org.apache.s2graph.core.utils.logger
 import org.apache.tinkerpop.gremlin.structure
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory
-import org.apache.tinkerpop.gremlin.structure.{Direction, Edge, Graph, Property, Vertex}
+import org.apache.tinkerpop.gremlin.structure.{Direction, Edge, Graph, Property, T, Vertex}
 import play.api.libs.json.{JsNumber, JsObject, Json}
 
 import scala.collection.JavaConverters._
@@ -330,7 +330,7 @@ case class S2Edge(innerGraph: S2Graph,
   lazy val tgtId = tgtVertex.innerIdVal
   lazy val labelName = innerLabel.label
   lazy val direction = GraphUtil.fromDirection(dir)
-  
+
   def toIndexEdge(labelIndexSeq: Byte): IndexEdge = IndexEdge(innerGraph, srcVertex, tgtVertex, innerLabel, dir, op, version, labelIndexSeq, propsWithTs)
 
   def serializePropsWithTs(): Array[Byte] = HBaseSerializable.propsToKeyValuesWithTs(propsWithTs.asScala.map(kv => kv._2.labelMeta.seq -> kv._2.innerValWithTs).toSeq)
@@ -629,7 +629,7 @@ case class S2Edge(innerGraph: S2Graph,
     if (keys.isEmpty) {
       propsWithTs.forEach(new BiConsumer[String, S2Property[_]] {
         override def accept(key: String, property: S2Property[_]): Unit = {
-          if (!LabelMeta.reservedMetaNamesSet(key) && property.isPresent)
+          if (!LabelMeta.reservedMetaNamesSet(key) && property.isPresent && key != T.id.name)
             ls.add(property.asInstanceOf[S2Property[V]])
         }
       })
@@ -689,9 +689,9 @@ case class S2Edge(innerGraph: S2Graph,
     val timestamp = if (this.innerLabel.consistencyLevel == "strong") 0l else ts
 //    EdgeId(srcVertex.innerId, tgtVertex.innerId, label(), "out", timestamp)
     if (direction == "out")
-      EdgeId(srcVertex.innerId, tgtVertex.innerId, label(), "out", timestamp)
+      EdgeId(srcVertex.id.innerId, tgtVertex.id.innerId, label(), "out", timestamp)
     else
-      EdgeId(tgtVertex.innerId, srcVertex.innerId, label(), "out", timestamp)
+      EdgeId(tgtVertex.id.innerId, srcVertex.id.innerId, label(), "out", timestamp)
   }
 
   override def id(): AnyRef = edgeId

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
index 20e19e4..78eb2b2 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Graph.scala
@@ -572,8 +572,8 @@ object S2Graph {
 //  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.GraphTest", method="*", reason="no"),
   // passed: , failed:
 
-//  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest", method="shouldNotEvaluateToEqualDifferentId", reason="Assigning the same ID to an Element update instead of throwing exception."),
-  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest", method="*", reason="no"),
+  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest", method="shouldNotEvaluateToEqualDifferentId", reason="Assigning the same ID to an Element update instead of throwing exception."),
+//  new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdgeTest", method="*", reason="no"),
   // passed: , failed: shouldNotEvaluateToEqualDifferentId, shouldConstructReferenceEdge
 
   new Graph.OptOut(test="org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexPropertyTest", method="*", reason="no"),
@@ -695,7 +695,6 @@ class S2Graph(_config: Config)(implicit val ec: ExecutionContext) extends Graph
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "lang", "string", useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "oid", "integer", useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "communityIndex", "integer", useCache = false)
-    ColumnMeta.findOrInsert(DefaultColumn.id.get, "test", "string", useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "testing", "string", useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "string", "string", useCache = false)
     ColumnMeta.findOrInsert(DefaultColumn.id.get, "boolean", "boolean", useCache = false)
@@ -1704,4 +1703,11 @@ class S2Graph(_config: Config)(implicit val ec: ExecutionContext) extends Graph
   override def features() = s2Features
 
   override def toString(): String = "[s2graph]"
+
+//  override def io[I <: Io[_ <: GraphReader.ReaderBuilder[_ <: GraphReader], _ <: GraphWriter.WriterBuilder[_ <: GraphWriter], _ <: Mapper.Builder[_]]](builder: Io.Builder[I]): I = {
+//    builder.graph(this).registry(new S2GraphIoRegistry).create().asInstanceOf[I]
+//
+//  }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
index 529ece4..9a9dfa8 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2Vertex.scala
@@ -244,7 +244,7 @@ case class S2Vertex(graph: S2Graph,
     if (keys.isEmpty) {
       props.forEach(new BiConsumer[String, VertexProperty[_]] {
         override def accept(key: String, property: VertexProperty[_]): Unit = {
-          if (!ColumnMeta.reservedMetaNamesSet(key) && property.isPresent)
+          if (!ColumnMeta.reservedMetaNamesSet(key) && property.isPresent && key != T.id.name)
             ls.add(property.asInstanceOf[VertexProperty[V]])
         }
       })

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/S2VertexProperty.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/S2VertexProperty.scala b/s2core/src/main/scala/org/apache/s2graph/core/S2VertexProperty.scala
index c5258fb..84e6de7 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/S2VertexProperty.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/S2VertexProperty.scala
@@ -22,12 +22,10 @@ package org.apache.s2graph.core
 import java.util
 
 import org.apache.s2graph.core.mysqls.ColumnMeta
-import org.apache.s2graph.core.types.CanInnerValLike
-import org.apache.tinkerpop.gremlin.structure.{Property, VertexProperty, Vertex => TpVertex}
+import org.apache.s2graph.core.types.{CanInnerValLike, InnerValLike}
+import org.apache.tinkerpop.gremlin.structure.{Property, VertexProperty}
 
-import scala.util.hashing.MurmurHash3
-
-case class S2VertexPropertyId[V](columnMeta: ColumnMeta, value: V)
+case class S2VertexPropertyId(columnMeta: ColumnMeta, value: InnerValLike)
 
 case class S2VertexProperty[V](element: S2Vertex,
                                columnMeta: ColumnMeta,
@@ -53,7 +51,7 @@ case class S2VertexProperty[V](element: S2Vertex,
     isRemoved = true
   }
 
-  override def id(): AnyRef = S2VertexPropertyId(columnMeta, v)
+  override def id(): AnyRef = S2VertexPropertyId(columnMeta, innerVal)
 
   @volatile var isRemoved = false
 

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/types/InnerValLike.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/InnerValLike.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/InnerValLike.scala
index c37728c..f653901 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/InnerValLike.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/InnerValLike.scala
@@ -40,12 +40,13 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
   val INT = "integer"
   val SHORT = "short"
   val BYTE = "byte"
-  val NUMERICS = Set(DOUBLE, FLOAT, LONG, INT, SHORT, BYTE)
+  val BIGDECIMAL = "bigDecimal"
+  val NUMERICS = Set(DOUBLE, FLOAT, LONG, INT, SHORT, BYTE, BIGDECIMAL)
   val BOOLEAN = "boolean"
 
   def isNumericType(dataType: String): Boolean = {
     dataType match {
-      case InnerVal.BYTE | InnerVal.SHORT | InnerVal.INT | InnerVal.LONG | InnerVal.FLOAT | InnerVal.DOUBLE => true
+      case BYTE | SHORT | INT | LONG | FLOAT | DOUBLE | BIGDECIMAL=> true
       case _ => false
     }
   }
@@ -60,6 +61,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
       case "short" | "int16" | "integer16" => SHORT
       case "byte" | "b" | "tinyint" | "int8" | "integer8" => BYTE
       case "boolean" | "bool" => BOOLEAN
+      case "bigdecimal" => BIGDECIMAL
       case _ => throw new RuntimeException(s"can`t convert $dataType into InnerDataType")
     }
   }
@@ -91,7 +93,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withLong(l: Long, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(l))
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(l), LONG, version)
 //      case VERSION1 => v1.InnerVal(Some(l), None, None)
       case _ => throw notSupportedEx(version)
     }
@@ -99,7 +101,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withInt(i: Int, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(i))
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(i), INT, version)
 //      case VERSION1 => v1.InnerVal(Some(i.toLong), None, None)
       case _ => throw notSupportedEx(version)
     }
@@ -107,7 +109,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withFloat(f: Float, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(f.toDouble))
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(f.toDouble), FLOAT, version)
 //      case VERSION1 => v1.InnerVal(Some(f.toLong), None, None)
       case _ => throw notSupportedEx(version)
     }
@@ -115,7 +117,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withDouble(d: Double, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(d))
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(BigDecimal(d), DOUBLE, version)
 //      case VERSION1 => v1.InnerVal(Some(d.toLong), None, None)
       case _ => throw notSupportedEx(version)
     }
@@ -123,7 +125,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withNumber(num: BigDecimal, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(num)
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(num, BIGDECIMAL, version)
 //      case VERSION1 => v1.InnerVal(Some(num.toLong), None, None)
       case _ => throw notSupportedEx(version)
     }
@@ -131,7 +133,7 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withBoolean(b: Boolean, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(b)
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(b, BOOLEAN, version)
 //      case VERSION1 => v1.InnerVal(None, None, Some(b))
       case _ => throw notSupportedEx(version)
     }
@@ -139,70 +141,28 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   def withBlob(blob: Array[Byte], version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(blob)
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(blob, BLOB, version)
       case _ => throw notSupportedEx(version)
     }
   }
 
   def withStr(s: String, version: String): InnerValLike = {
     version match {
-      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(s)
+      case VERSION2 | VERSION3 | VERSION4 => v2.InnerVal(s, STRING, version)
 //      case VERSION1 => v1.InnerVal(None, Some(s), None)
       case _ => throw notSupportedEx(version)
     }
   }
-
-//  def withInnerVal(innerVal: InnerValLike, version: String): InnerValLike = {
-//    val bytes = innerVal.bytes
-//    version match {
-//      case VERSION2 => v2.InnerVal.fromBytes(bytes, 0, bytes.length, version)._1
-//      case VERSION1 => v1.InnerVal.fromBytes(bytes, 0, bytes.length, version)._1
-//      case _ => throw notSupportedEx(version)
-//    }
-//  }
-
-  /** nasty implementation for backward compatability */
-//  def convertVersion(innerVal: InnerValLike, dataType: String, toVersion: String): InnerValLike = {
-//    val ret = toVersion match {
-//      case VERSION2 | VERSION3 | VERSION4 =>
-//        if (innerVal.isInstanceOf[v1.InnerVal]) {
-//          val obj = innerVal.asInstanceOf[v1.InnerVal]
-//          obj.valueType match {
-//            case "long" => InnerVal.withLong(obj.longV.get, toVersion)
-//            case "string" => InnerVal.withStr(obj.strV.get, toVersion)
-//            case "boolean" => InnerVal.withBoolean(obj.boolV.get, toVersion)
-//            case _ => throw new Exception(s"InnerVal should be [long/integeer/short/byte/string/boolean]")
-//          }
-//        } else {
-//          innerVal
-//        }
-////      case VERSION1 =>
-////        if (innerVal.isInstanceOf[v2.InnerVal]) {
-////          val obj = innerVal.asInstanceOf[v2.InnerVal]
-////          obj.value match {
-////            case str: String => InnerVal.withStr(str, toVersion)
-////            case b: Boolean => InnerVal.withBoolean(b, toVersion)
-////            case n: BigDecimal => InnerVal.withNumber(n, toVersion)
-////            case n: Long => InnerVal.withNumber(n, toVersion)
-////            case n: Double => InnerVal.withNumber(n, toVersion)
-////            case n: Int => InnerVal.withNumber(n, toVersion)
-////            case _ => throw notSupportedEx(s"v2 to v1: $obj -> $toVersion")
-////          }
-////        } else {
-////          innerVal
-////        }
-//      case _ => throw notSupportedEx(toVersion)
-//    }
-////    logger.debug(s"convertVersion: $innerVal, $dataType, $toVersion, $ret, ${innerVal.bytes.toList}, ${ret.bytes.toList}")
-//    ret
-//  }
-
 }
 
 trait InnerValLike extends HBaseSerializable {
 
   val value: Any
 
+  val dataType: String
+
+  val schemaVersion: String
+
   def compare(other: InnerValLike): Int
 
   def +(other: InnerValLike): InnerValLike

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
index 9d3ea72..31bdce6 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/VertexId.scala
@@ -69,7 +69,7 @@ class VertexId (val column: ServiceColumn, val innerId: InnerValLike) extends HB
   override def toString(): String = {
     //    column.id.get.toString() + "," + innerId.toString()
     val del = S2Vertex.VertexLabelDelimiter
-    s"${column.service.serviceName}${del}${column.columnName}${del}${innerId}"
+    s"${column.serviceId}${del}${column.columnName}${del}${innerId}"
   }
 
   override def hashCode(): Int = {
@@ -83,7 +83,7 @@ class VertexId (val column: ServiceColumn, val innerId: InnerValLike) extends HB
   }
   override def equals(obj: Any): Boolean = {
     val ret = obj match {
-      case other: VertexId => colId == other.colId && innerId.toIdString() == other.innerId.toIdString()
+      case other: VertexId => column.id.get == other.column.id.get && innerId.toIdString() == other.innerId.toIdString()
       case _ => false
     }
 //    logger.debug(s"VertexId.equals: $this, $obj => $ret")

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/types/v1/InnerVal.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/v1/InnerVal.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/v1/InnerVal.scala
index 361b9cf..60cb1cc 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/v1/InnerVal.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/v1/InnerVal.scala
@@ -176,6 +176,9 @@ case class InnerVal(longV: Option[Long], strV: Option[String], boolV: Option[Boo
     case (None, None, Some(b)) => b
     case _ => throw new Exception(s"InnerVal should be [long/integeer/short/byte/string/boolean]")
   }
+  val dataType = valueType
+
+  val schemaVersion = "v1"
   def valueType = (longV, strV, boolV) match {
     case (Some(l), None, None) => "long"
     case (None, Some(s), None) => "string"

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala b/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
index 9d9bdf2..95888d7 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala
@@ -26,7 +26,7 @@ import org.apache.s2graph.core.types.{HBaseDeserializableWithIsVertexId, HBaseSe
 object InnerVal extends HBaseDeserializableWithIsVertexId {
 
   import HBaseType._
-
+  import types.InnerVal._
   val order = Order.DESCENDING
 
   def fromBytes(bytes: Array[Byte],
@@ -43,21 +43,21 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
         case Order.DESCENDING => bytes(offset) == 0
         case _ => bytes(offset) == -1
       }
-      (InnerVal(boolean), 1)
+      (InnerVal(boolean, BOOLEAN, version), 1)
     }
     else {
       if (OrderedBytes.isNumeric(pbr)) {
         val numeric = OrderedBytes.decodeNumericAsBigDecimal(pbr)
-        if (isVertexId) (InnerVal(numeric.longValue()), pbr.getPosition - startPos)
-        else (InnerVal(BigDecimal(numeric)), pbr.getPosition - startPos)
+        if (isVertexId) (InnerVal(numeric.longValue(), LONG, version), pbr.getPosition - startPos)
+        else (InnerVal(BigDecimal(numeric), BIGDECIMAL, version), pbr.getPosition - startPos)
 //        (InnerVal(numeric.doubleValue()), pbr.getPosition - startPos)
 //        (InnerVal(BigDecimal(numeric)), pbr.getPosition - startPos)
       } else if (OrderedBytes.isText(pbr)) {
         val str = OrderedBytes.decodeString(pbr)
-        (InnerVal(str), pbr.getPosition - startPos)
+        (InnerVal(str, STRING, version), pbr.getPosition - startPos)
       } else if (OrderedBytes.isBlobVar(pbr)) {
         val blobVar = OrderedBytes.decodeBlobVar(pbr)
-        (InnerVal(blobVar), pbr.getPosition - startPos)
+        (InnerVal(blobVar, BLOB, version), pbr.getPosition - startPos)
       } else {
         throw new RuntimeException("!!")
       }
@@ -65,7 +65,9 @@ object InnerVal extends HBaseDeserializableWithIsVertexId {
   }
 }
 
-case class InnerVal(value: Any) extends HBaseSerializable with InnerValLike {
+case class InnerVal(value: Any,
+                    dataType: String,
+                    schemaVersion: String) extends HBaseSerializable with InnerValLike {
 
   import types.InnerVal._
 
@@ -76,9 +78,10 @@ case class InnerVal(value: Any) extends HBaseSerializable with InnerValLike {
         /* since OrderedBytes header start from 0x05, it is safe to use -1, 0
           * for decreasing order (true, false) */
         //        Bytes.toBytes(b)
+        //TODO: 0, 1 is also safe?
         order match {
-          case Order.DESCENDING => if (b) Array(0.toByte) else Array(-1.toByte)
-          case _ => if (!b) Array(0.toByte) else Array(-1.toByte)
+          case Order.DESCENDING => if (b) Array(0.toByte) else Array(1.toByte)
+          case _ => if (!b) Array(0.toByte) else Array((1.toByte))
         }
       case d: Double =>
         val num = BigDecimal(d)
@@ -105,8 +108,6 @@ case class InnerVal(value: Any) extends HBaseSerializable with InnerValLike {
         val pbr = numByteRange(num)
         val len = OrderedBytes.encodeNumeric(pbr, num.bigDecimal, order)
         pbr.getBytes().take(len)
-
-
       case b: BigDecimal =>
         val pbr = numByteRange(b)
         val len = OrderedBytes.encodeNumeric(pbr, b.bigDecimal, order)
@@ -155,7 +156,7 @@ case class InnerVal(value: Any) extends HBaseSerializable with InnerValLike {
       throw new RuntimeException(s"+ $this, $other")
 
     (value, other.value) match {
-      case (v1: BigDecimal, v2: BigDecimal) => new InnerVal(BigDecimal(v1.bigDecimal.add(v2.bigDecimal)))
+      case (v1: BigDecimal, v2: BigDecimal) => new InnerVal(BigDecimal(v1.bigDecimal.add(v2.bigDecimal)), dataType, schemaVersion)
       case _ => throw new RuntimeException("+ operation on inner val is for big decimal pair")
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/ee22c608/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
----------------------------------------------------------------------
diff --git a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
index e838447..dc24cb6 100644
--- a/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
+++ b/s2core/src/test/scala/org/apache/s2graph/core/tinkerpop/S2GraphProvider.scala
@@ -105,7 +105,8 @@ class S2GraphProvider extends AbstractGraphProvider {
       Prop("aKey", "-", "string"),
       Prop("stars", "0", "integer"),
       Prop("since", "0", "integer"),
-      Prop("myEdgeId", "0", "integer")
+      Prop("myEdgeId", "0", "integer"),
+      Prop("data", "-", "string")
     )
 
    // Change dataType for ColumnMeta('aKey') for PropertyFeatureSupportTest
@@ -138,7 +139,16 @@ class S2GraphProvider extends AbstractGraphProvider {
       ColumnMeta.findOrInsert(defaultServiceColumn.id.get, "aKey", dataType, useCache = false)
     }
 
-    if (testClass.getSimpleName == "DetachedEdgeTest") {
+    if (testClass.getSimpleName == "ReferenceEdgeTest") {
+      mnt.createLabel("knows", defaultService.serviceName, "person", "integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, knowsProp, "strong", None, None, options = Option("""{"skipReverse": false}"""))
+    } else if (testClass.getName.contains("SerializationTest") || testClass.getSimpleName == "IoPropertyTest") {
+      mnt.createLabel("knows", defaultService.serviceName, "person", "integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, knowsProp, "strong", None, None, options = Option("""{"skipReverse": false}"""))
+    } else if (testClass.getSimpleName.contains("CommunityGeneratorTest")) {
+      mnt.createLabel("knows", defaultService.serviceName, "person", "integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, knowsProp, "strong", None, None, options = Option("""{"skipReverse": true}"""))
+    } else if (testClass.getSimpleName == "DetachedEdgeTest" || testClass.getSimpleName.contains("GraphSONTest")) {
       mnt.createLabel("knows", defaultService.serviceName, "person", "integer", defaultService.serviceName, "person", "integer",
         true, defaultService.serviceName, Nil, knowsProp, "strong", None, None, options = Option("""{"skipReverse": false}"""))
     } else {
@@ -173,13 +183,18 @@ class S2GraphProvider extends AbstractGraphProvider {
       true, defaultService.serviceName, Nil, Seq(Prop("xxx", "-", "string")), "weak", None, None,
       options = Option("""{"skipReverse": true}"""))
 
-    val self = if (testClass.getSimpleName.contains("GraphTest")) {
+    val self = if (testClass.getSimpleName == "StarGraphTest") {
+      mnt.createLabel("self", defaultService.serviceName, "person", "integer",
+        defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil, Seq(Prop("acl", "-", "string")), "strong", None, None,
+        options = Option("""{"skipReverse": false}"""))
+    } else if (testClass.getSimpleName.contains("GraphTest")) {
       mnt.createLabel("self", defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType, defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType,
-        true, defaultService.serviceName, Nil, Nil, "strong", None, None,
+        true, defaultService.serviceName, Nil, Seq(Prop("acl", "-", "string")), "strong", None, None,
         options = Option("""{"skipReverse": true}"""))
     } else {
       mnt.createLabel("self", defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType, defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType,
-        true, defaultService.serviceName, Nil, Nil, "weak", None, None,
+        true, defaultService.serviceName, Nil, Seq(Prop("acl", "-", "string")), "weak", None, None,
         options = Option("""{"skipReverse": true}"""))
     }
 
@@ -188,16 +203,31 @@ class S2GraphProvider extends AbstractGraphProvider {
       "strong", None, None,
       options = Option("""{"skipReverse": false}"""))
 
-    val friend = mnt.createLabel("friend", defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType, defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType,
-      true, defaultService.serviceName, Nil,
-      Seq(
-        Prop("name", "-", "string"),
-        Prop("location", "-", "string"),
-        Prop("status", "-", "string")
-      ),
-      "strong", None, None,
-      options = Option("""{"skipReverse": false}""")
-    )
+    val friend = if (testClass.getSimpleName.contains("IoEdgeTest")) {
+      mnt.createLabel("friend", defaultService.serviceName, "person", "integer", defaultService.serviceName, "person", "integer",
+        true, defaultService.serviceName, Nil,
+        Seq(
+          Prop("name", "-", "string"),
+          Prop("location", "-", "string"),
+          Prop("status", "-", "string"),
+          Prop("weight", "0.0", "double"),
+          Prop("acl", "-", "string")
+        ), "strong", None, None,
+        options = Option("""{"skipReverse": false}"""))
+    } else {
+      mnt.createLabel("friend", defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType, defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType,
+        true, defaultService.serviceName, Nil,
+        Seq(
+          Prop("name", "-", "string"),
+          Prop("location", "-", "string"),
+          Prop("status", "-", "string"),
+          Prop("weight", "0.0", "double"),
+          Prop("acl", "-", "string")
+        ),
+        "strong", None, None,
+        options = Option("""{"skipReverse": false}""")
+      )
+    }
 
     val hate = mnt.createLabel("hate", defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType, defaultService.serviceName, defaultServiceColumn.columnName, defaultServiceColumn.columnType,
       true, defaultService.serviceName, Nil, Nil, "strong", None, None,