|
@@ -3,6 +3,8 @@ package com.winhc.max.compute.graph.job.pagerank;
|
|
import com.aliyun.odps.graph.GraphLoader;
|
|
import com.aliyun.odps.graph.GraphLoader;
|
|
import com.aliyun.odps.graph.MutationContext;
|
|
import com.aliyun.odps.graph.MutationContext;
|
|
import com.aliyun.odps.io.*;
|
|
import com.aliyun.odps.io.*;
|
|
|
|
+import com.winhc.max.compute.graph.util.WritableRecordExtensions;
|
|
|
|
+import lombok.experimental.ExtensionMethod;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
|
|
@@ -10,14 +12,17 @@ import java.io.IOException;
|
|
* @author: XuJiakai
|
|
* @author: XuJiakai
|
|
* 2022/6/8 09:58
|
|
* 2022/6/8 09:58
|
|
*/
|
|
*/
|
|
|
|
+@ExtensionMethod({
|
|
|
|
+ WritableRecordExtensions.class
|
|
|
|
+})
|
|
public class CompanyRankVertexReader extends
|
|
public class CompanyRankVertexReader extends
|
|
GraphLoader<Text, CompanyRank, DoubleWritable, DoubleWritable> {
|
|
GraphLoader<Text, CompanyRank, DoubleWritable, DoubleWritable> {
|
|
@Override
|
|
@Override
|
|
public void load(LongWritable recordNum, WritableRecord record, MutationContext<Text, CompanyRank, DoubleWritable, DoubleWritable> context) throws IOException {
|
|
public void load(LongWritable recordNum, WritableRecord record, MutationContext<Text, CompanyRank, DoubleWritable, DoubleWritable> context) throws IOException {
|
|
CompanyRankVertex vertex = new CompanyRankVertex();
|
|
CompanyRankVertex vertex = new CompanyRankVertex();
|
|
|
|
|
|
- Text companyId = (Text) record.get("investment_company_id");
|
|
|
|
- Text company_name = (Text) record.get("investment_company_name");
|
|
|
|
|
|
+ Text companyId = record.getTextOrNull("investment_company_id");
|
|
|
|
+ Text company_name = record.getTextOrNull("investment_company_name");
|
|
// DoubleWritable initScore = ((DoubleWritable) record.get("investment_company_init_score"));
|
|
// DoubleWritable initScore = ((DoubleWritable) record.get("investment_company_init_score"));
|
|
DoubleWritable initScore = new DoubleWritable(1);
|
|
DoubleWritable initScore = new DoubleWritable(1);
|
|
vertex.setId(companyId);
|
|
vertex.setId(companyId);
|