2

I am preparing graph in Java API and stuck in below conversion as Edge<String> but encoder is giving Edgeclass with Raw parameter

Dataset<Row> edges = spark.read()
                .option("header", "true")
                .option("inferSchema", "true")
                .csv("src/main/resources/edges.csv");
        Encoder<Edge> encoderEdges = Encoders.bean(Edge.class);
        JavaRDD<Edge> edgesRDD = edges.as(encoderEdges).toJavaRDD();
        ClassTag<String> stringTag = scala.reflect.ClassTag$.MODULE$.apply(String.class); 
        ClassTag<Double> doubleTag = scala.reflect.ClassTag$.MODULE$.apply(Double.class); 

        Graph<Double, String> graph = Graph.apply(verticesRDD.rdd(), 
                edgesRDD.rdd(), Double.class, 
                StorageLevel.MEMORY_ONLY(),
                StorageLevel.MEMORY_ONLY(), 
                doubleTag, stringTag); 

How I can convert in required format, error is

The method apply(RDD>, RDD>, VD, StorageLevel, StorageLevel, ClassTag, ClassTag) in the type Graph is not applicable for the arguments (RDD>, RDD, String, StorageLevel, StorageLevel, ClassTag, ClassTag)

Rahul Sharma
  • 5,614
  • 10
  • 57
  • 91
  • Try using graphframes https://graphframes.github.io/. Another useful thread [here](https://stackoverflow.com/questions/39158954/how-to-create-a-simple-spark-graphframe-using-java). – Rahul Sharma Oct 02 '17 at 15:45

0 Answers0