-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from uber/jg_172_c3
Implemented a new record reader to extract JanusGraph data from Cassandra Fixes #172
- Loading branch information
Showing
13 changed files
with
558 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
janusgraph-dist/src/assembly/static/conf/hadoop-graph/read-cassandra-3.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Hadoop Graph Configuration | ||
# | ||
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph | ||
gremlin.hadoop.graphInputFormat=org.janusgraph.hadoop.formats.cassandra.Cassandra3InputFormat | ||
gremlin.hadoop.graphOutputFormat=org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat | ||
|
||
gremlin.hadoop.jarsInDistributedCache=true | ||
gremlin.hadoop.inputLocation=none | ||
gremlin.hadoop.outputLocation=output | ||
|
||
# | ||
# JanusGraph Cassandra InputFormat configuration | ||
# | ||
janusgraphmr.ioformat.conf.storage.backend=cassandra | ||
janusgraphmr.ioformat.conf.storage.hostname=localhost | ||
janusgraphmr.ioformat.conf.storage.port=9160 | ||
janusgraphmr.ioformat.conf.storage.cassandra.keyspace=janusgraph | ||
|
||
# | ||
# Apache Cassandra InputFormat configuration | ||
# | ||
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner | ||
|
||
# | ||
# SparkGraphComputer Configuration | ||
# | ||
spark.master=local[4] | ||
spark.serializer=org.apache.spark.serializer.KryoSerializer |
38 changes: 38 additions & 0 deletions
38
...re/src/main/java/org/janusgraph/hadoop/formats/cassandra/Cassandra3BinaryInputFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2017 JanusGraph Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.janusgraph.hadoop.formats.cassandra; | ||
|
||
import org.apache.hadoop.mapreduce.InputSplit; | ||
import org.apache.hadoop.mapreduce.RecordReader; | ||
import org.apache.hadoop.mapreduce.TaskAttemptContext; | ||
import org.janusgraph.diskstorage.Entry; | ||
import org.janusgraph.diskstorage.StaticBuffer; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Wraps a ColumnFamilyInputFormat and converts CFIF's binary types to JanusGraph's binary types. | ||
*/ | ||
public class Cassandra3BinaryInputFormat extends CassandraBinaryInputFormat { | ||
|
||
@Override | ||
public RecordReader<StaticBuffer, Iterable<Entry>> createRecordReader(final InputSplit inputSplit, final TaskAttemptContext taskAttemptContext) | ||
throws IOException, InterruptedException { | ||
janusgraphRecordReader = new CqlBridgeRecordReader(); // See issue 172 | ||
return janusgraphRecordReader; | ||
} | ||
|
||
} | ||
|
27 changes: 27 additions & 0 deletions
27
...oop-core/src/main/java/org/janusgraph/hadoop/formats/cassandra/Cassandra3InputFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2017 JanusGraph Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package org.janusgraph.hadoop.formats.cassandra; | ||
|
||
import org.janusgraph.diskstorage.configuration.ConfigOption; | ||
import org.janusgraph.hadoop.formats.util.GiraphInputFormat; | ||
|
||
import static org.janusgraph.diskstorage.cassandra.AbstractCassandraStoreManager.*; | ||
|
||
public class Cassandra3InputFormat extends GiraphInputFormat { | ||
|
||
public Cassandra3InputFormat() { | ||
super(new Cassandra3BinaryInputFormat()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.