You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@s2graph.apache.org by "Daewon Jeong (JIRA)" <ji...@apache.org> on 2018/05/23 05:12:00 UTC

[jira] [Created] (S2GRAPH-215) Implement a Storage Backend for JDBC driver, such as H2, MySql using the Mutator and Fetcher interfaces.

Daewon Jeong created S2GRAPH-215:
------------------------------------

             Summary: Implement a Storage Backend for JDBC driver, such as H2, MySql using the Mutator and Fetcher interfaces.
                 Key: S2GRAPH-215
                 URL: https://issues.apache.org/jira/browse/S2GRAPH-215
             Project: S2Graph
          Issue Type: Improvement
          Components: s2core
            Reporter: Daewon Jeong


h2. Implement a Storage Backend for JDBC driver, such as H2, MySql using the Mutator and Fetcher interfaces.

S2GRAPH-213  The issue has been completed.

I will try to implement Fetcher and Mutator for JDBC by using the abstract mutation/query function completed in the above issue(S2GRAPH-213).

Direction of implementation
 - Data sorting and transactions take advantage of the functionality provided by the RDBMS.

h2. DDL (table, index)

Assume that the 's2graph' service, the 'user' column, and the 'friends' label are created using the s2graph management function as shown in the example below.

The label friends has an 'idx_age_score' that uses the age, score properties and (age, score) fields.
{noformat}
    val serviceName = "s2graph"
    val columnName = "user"
    val labelName = "friends"

    val service = management.createService(serviceName, "localhost", "s2graph_htable", -1, None).get
    val serviceColumn =
      management.createServiceColumn(serviceName, columnName, "string", Nil)

    val label = management.createLabel(
      labelName,
      service.serviceName,
      serviceColumn.columnName,
      serviceColumn.columnType,
      service.serviceName,
      serviceColumn.columnName,
      serviceColumn.columnType,
      service.serviceName,
      Seq(
        Index("idx_age_score", Seq("age", "score"))
      ),
      Seq(
        Prop(name = "score", defaultValue = "0.0", dataType = "double"),
        Prop(name = "age", defaultValue = "0", dataType = "int")
      ),
      isDirected = true,
      consistencyLevel = "strong",
      hTableName = None,
      hTableTTL = None,
      schemaVersion = "v3",
      compressionAlgorithm = "gz",
      options = options,
      initFetcherWithOptions = true
    ).get
{noformat}
In this case, H2 database (mysql mode) for label friends creates the following table.
 Implement a query / mutation that fits the table schema.
{noformat}
  CREATE TABLE `_EDGE_STORE_friends`(
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `_timestamp` TIMESTAMP NOT NULL default CURRENT_TIMESTAMP,
    `_from` varchar(256) NOT NULL,
    `_to` varchar(256) NOT NULL,
    PRIMARY KEY (`id`),
    `age` int(32),
    `score` double,
    KEY `idx_age_score` (`age`, `score`),
    UNIQUE KEY `_from` (`_from`,`_to`),
    UNIQUE KEY `_to` (`_to`,`_from`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)