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

cherry pick fix data structure for nebula datasource #33

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ case class NebulaReadConfigEntry(address: String = "",
space: String = "",
labels: List[String] = List(),
weightCols: List[String] = List()) {
assert(weightCols.isEmpty || labels.size == weightCols.size,
"weightCols must be empty or has the same amount values with labels")
override def toString: String = {
s"NebulaReadConfigEntry: " +
s"{address: $address, space: $space, labels: ${labels.mkString(",")}, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class NebulaReader(spark: SparkSession, configs: Configs, partitionNum: String)
.withReturnCols(returnCols.toList)
.withPartitionNum(partition)
.build()
if (dataset == null) {
dataset = spark.read.nebula(config, nebulaReadEdgeConfig).loadEdgesToDF()
} else {
dataset = dataset.union(spark.read.nebula(config, nebulaReadEdgeConfig).loadEdgesToDF())
var df = spark.read.nebula(config, nebulaReadEdgeConfig).loadEdgesToDF()
if (weights.nonEmpty) {
df = df.select("_srcId", "_dstId", weights(i))
}
dataset = if (dataset == null) df else dataset.union(df)
}
dataset
}
Expand Down