Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nebula VertexID是String 类型时loadVerticesToGraphx 报错,类型转换失败。 #42

Closed
chijunqing opened this issue Mar 29, 2022 · 2 comments

Comments

@chijunqing
Copy link

chijunqing commented Mar 29, 2022

问题描述
nebula 点集合VertexID类型是String, 在调用loadVerticesToGraphx 时候 报错 Long类型转换报错。

下面是修改后可以正常运行:type VertexID = String

package object connector {

type Address = (String, Int)
type NebulaType = Int
type Prop = List[Any]
type PropertyNames = List[String]
type PropertyValues = List[Any]

// 是否可以将VertextID 值改为 String 。 Long转String 没问题, 但String 未必能成功转换成Long
//type VertexID = Long
type VertexID = String
type VertexIDSlice = String
type NebulaGraphxVertex = (VertexID, PropertyValues)
type NebulaGraphxEdge = org.apache.spark.graphx.Edge[(EdgeRank, Prop)]
type EdgeRank = Long

@QingZ11
Copy link

QingZ11 commented Apr 2, 2022

可以补充下你的 nebula 和 spark connector 的版本号吗?

@Nicole00
Copy link
Contributor

Graphx的VertexRDD是只允许vertexId为Long类型,且connector内部做String id 映射为Long id不太合适,应为需要将对应的映射结果也返回给用户,因为使用者还需要映射信息对 数据处理后的结果 进行映射回原来的String id。 所以当id是字符型时,可以直接读取DataFrame数据,然后进行转换。
转换方式可以参考 https://github.com/vesoft-inc/nebula-algorithm/blob/4c56fe53133a2d23d44c290420b2ed9a91dba6c4/example/src/main/scala/com/vesoft/nebula/algorithm/PageRankExample.scala#L62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants