Java中的Spark Graphx

时间:2017-10-02 11:19:30

标签: java apache-spark spark-graphx

我正在使用Java API编写图表,并将其作为Edge<String>保留在转换下方,但编码器正在为Edge类提供Raw参数

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); 

如何以所需格式转换,错误是

  

该方法适用(RDD&gt;,RDD&gt;,VD,   StorageLevel,StorageLevel,ClassTag,ClassTag)中的类型   图不适用于参数(RDD&gt;,   RDD,String,StorageLevel,StorageLevel,ClassTag,   ClassTag)

0 个答案:

没有答案