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/08/07 07:35:10 UTC

[1/2] incubator-s2graph git commit: add "UTF-8" encoding on String.getBytes method.

Repository: incubator-s2graph
Updated Branches:
  refs/heads/master 1213c26e0 -> 339be374f


add "UTF-8" encoding on String.getBytes method.


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

Branch: refs/heads/master
Commit: a19437fe79fc9c129fcca410c31efc51c54d6cca
Parents: 1213c26
Author: DO YUNG YOON <st...@apache.org>
Authored: Mon Aug 7 16:21:46 2017 +0900
Committer: DO YUNG YOON <st...@apache.org>
Committed: Mon Aug 7 16:21:46 2017 +0900

----------------------------------------------------------------------
 .../org/apache/s2graph/loader/subscriber/TransferToHFile.scala   | 2 +-
 .../main/scala/org/apache/s2graph/core/storage/SKeyValue.scala   | 3 ++-
 .../scala/org/apache/s2graph/core/storage/Serializable.scala     | 4 ++--
 .../storage/serde/indexedge/tall/IndexEdgeSerializable.scala     | 2 +-
 .../storage/serde/indexedge/wide/IndexEdgeSerializable.scala     | 2 +-
 .../serde/snapshotedge/tall/SnapshotEdgeSerializable.scala       | 2 +-
 .../serde/snapshotedge/wide/SnapshotEdgeSerializable.scala       | 2 +-
 .../main/scala/org/apache/s2graph/core/types/v2/InnerVal.scala   | 2 +-
 .../s2graph/rest/play/controllers/ApplicationController.scala    | 2 +-
 9 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
----------------------------------------------------------------------
diff --git a/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala b/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
index dce085e..07fc908 100644
--- a/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
+++ b/loader/src/main/scala/org/apache/s2graph/loader/subscriber/TransferToHFile.scala
@@ -194,7 +194,7 @@ object TransferToHFile extends SparkApp {
     }
     val familyOptions = new FamilyHFileWriteOptions(Algorithm.LZ4.getName.toUpperCase,
       BloomType.ROW.name().toUpperCase, 32768, DataBlockEncoding.FAST_DIFF.name().toUpperCase)
-    val familyOptionsMap = Map("e".getBytes() -> familyOptions, "v".getBytes() -> familyOptions)
+    val familyOptionsMap = Map("e".getBytes("UTF-8") -> familyOptions, "v".getBytes("UTF-8") -> familyOptions)
 
     hbaseSc.bulkLoad(merged, TableName.valueOf(tableName), flatMap, tmpPath, familyOptionsMap)
   }

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
index 403ceeb..bde7f3a 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/SKeyValue.scala
@@ -19,12 +19,13 @@
 
 package org.apache.s2graph.core.storage
 
+import java.nio.charset.StandardCharsets
 import org.apache.hadoop.hbase.util.Bytes
 import org.hbase.async.KeyValue
 
 
 object SKeyValue {
-  val EdgeCf = "e".getBytes()
+  val EdgeCf = "e".getBytes("UTF-8")
   val Put = 1
   val Delete = 2
   val Increment = 3

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
index bd5e3d3..6de0b30 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/Serializable.scala
@@ -20,8 +20,8 @@
 package org.apache.s2graph.core.storage
 
 object Serializable {
-  val vertexCf = "v".getBytes()
-  val edgeCf = "e".getBytes()
+  val vertexCf = "v".getBytes("UTF-8")
+  val edgeCf = "e".getBytes("UTF-8")
 }
 
 trait Serializable[E] extends StorageSerializable[E]

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
index 2d49c11..632eefa 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/tall/IndexEdgeSerializable.scala
@@ -30,7 +30,7 @@ class IndexEdgeSerializable(indexEdge: IndexEdge, longToBytes: Long => Array[Byt
    import StorageSerializable._
 
    override def ts = indexEdge.version
-   override def table = indexEdge.label.hbaseTableName.getBytes()
+   override def table = indexEdge.label.hbaseTableName.getBytes("UTF-8")
 
    def idxPropsMap = indexEdge.orders.toMap
    def idxPropsBytes = propsToBytes(indexEdge.orders)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
index f85159b..434db02 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/indexedge/wide/IndexEdgeSerializable.scala
@@ -30,7 +30,7 @@ class IndexEdgeSerializable(indexEdge: IndexEdge, longToBytes: Long => Array[Byt
    import StorageSerializable._
 
    override def ts = indexEdge.version
-   override def table = indexEdge.label.hbaseTableName.getBytes()
+   override def table = indexEdge.label.hbaseTableName.getBytes("UTF-8")
 
    def idxPropsMap = indexEdge.orders.toMap
    def idxPropsBytes = propsToBytes(indexEdge.orders)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
index e71760d..76fb74d 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/tall/SnapshotEdgeSerializable.scala
@@ -30,7 +30,7 @@ class SnapshotEdgeSerializable(snapshotEdge: SnapshotEdge) extends Serializable[
   import StorageSerializable._
 
   override def ts = snapshotEdge.version
-  override def table = snapshotEdge.label.hbaseTableName.getBytes()
+  override def table = snapshotEdge.label.hbaseTableName.getBytes("UTF-8")
 
   def statusCodeWithOp(statusCode: Byte, op: Byte): Array[Byte] = {
     val byte = (((statusCode << 4) | op).toByte)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
----------------------------------------------------------------------
diff --git a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
index ee2645a..d2544e0 100644
--- a/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
+++ b/s2core/src/main/scala/org/apache/s2graph/core/storage/serde/snapshotedge/wide/SnapshotEdgeSerializable.scala
@@ -35,7 +35,7 @@ class SnapshotEdgeSerializable(snapshotEdge: SnapshotEdge) extends Serializable[
   import StorageSerializable._
 
   override def ts = snapshotEdge.version
-  override def table = snapshotEdge.label.hbaseTableName.getBytes()
+  override def table = snapshotEdge.label.hbaseTableName.getBytes("UTF-8")
 
   def statusCodeWithOp(statusCode: Byte, op: Byte): Array[Byte] = {
     val byte = (((statusCode << 4) | op).toByte)

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/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..e206a83 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
@@ -112,7 +112,7 @@ case class InnerVal(value: Any) extends HBaseSerializable with InnerValLike {
         val len = OrderedBytes.encodeNumeric(pbr, b.bigDecimal, order)
         pbr.getBytes().take(len)
       case s: String =>
-        val pbr = new SimplePositionedMutableByteRange(s.getBytes.length + 3)
+        val pbr = new SimplePositionedMutableByteRange(s.getBytes("UTF-8").length + 3)
         val len = OrderedBytes.encodeString(pbr, s, order)
         pbr.getBytes().take(len)
       case blob: Array[Byte] =>

http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/a19437fe/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
----------------------------------------------------------------------
diff --git a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
index b32c16a..b997356 100644
--- a/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
+++ b/s2rest_play/app/org/apache/s2graph/rest/play/controllers/ApplicationController.scala
@@ -86,7 +86,7 @@ object ApplicationController extends Controller {
     } else {
       Result(
         header = ResponseHeader(OK),
-        body = HttpEntity.Strict(ByteString(json.toString.getBytes()), Some(applicationJsonHeader))
+        body = HttpEntity.Strict(ByteString(json.toString.getBytes("UTF-8")), Some(applicationJsonHeader))
       ).as(applicationJsonHeader).withHeaders((CONNECTION -> "close") +: headers: _*)
     }
 


[2/2] incubator-s2graph git commit: [S2GRAPH-158]: Bug fix on String type InnerVal encoding to use UTF-8 charsetName.

Posted by st...@apache.org.
[S2GRAPH-158]: Bug fix on String type InnerVal encoding to use UTF-8 charsetName.

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

Pull Request:
    Closes #117

Author
    DO YUNG YOON <st...@apache.org>


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

Branch: refs/heads/master
Commit: 339be374f6b0dc970e4827bbfbceeb34ecc81dee
Parents: a19437f
Author: DO YUNG YOON <st...@apache.org>
Authored: Mon Aug 7 16:34:36 2017 +0900
Committer: DO YUNG YOON <st...@apache.org>
Committed: Mon Aug 7 16:34:36 2017 +0900

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/339be374/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ae6d096..1e16637 100644
--- a/CHANGES
+++ b/CHANGES
@@ -139,6 +139,8 @@ Release 0.1.0 - unreleased
     S2GRAPH-138: Fixed logging in Play! development mode
                  (Contributed by Jong Wook Kim<jo...@nyu.edu>, committed by DOYUNG YOON)
 
+    S2GRAPH-158: Bug fix on String type InnerVal encoding to use UTF-8 charsetName (Committed by DOYUNG YOON).
+
   TASKS
 
     S2GRAPH-2: Update document and quick start environment to have recent set-up command changes.