diff --git a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/Main.scala b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/Main.scala index ca52319..3d7aaa4 100644 --- a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/Main.scala +++ b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/Main.scala @@ -172,8 +172,7 @@ object Main { ShortestPathAlgo(spark, dataSet, spConfig, hasWeight) } case "degreestatic" => { - val encodeId = configs.algorithmConfig.map.get("algorithm.degreestatic.encodeId") - val config = if (encodeId.getOrElse("").equals("true")) DegreeStaticConfig(true) else DegreeStaticConfig() + val config = DegreeStaticConfig.getDegreeStaticConfig(configs) DegreeStaticAlgo(spark, dataSet, config) } case "kcore" => { diff --git a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/DegreeStaticAlgo.scala b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/DegreeStaticAlgo.scala index 99c4667..7721ecc 100644 --- a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/DegreeStaticAlgo.scala +++ b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/lib/DegreeStaticAlgo.scala @@ -48,8 +48,7 @@ object DegreeStaticAlgo { .createDataFrame(degreeResultRDD, schema) if (degreeConfig.encodeId) { - val resultDF = DecodeUtil.convertEncodeId2StringId(algoResult, encodeIdDf) - resultDF + DecodeUtil.convertAlgoId2StringId(algoResult, encodeIdDf) } else { algoResult } diff --git a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/utils/DecodeUtil.scala b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/utils/DecodeUtil.scala index 4f0f807..f540240 100644 --- a/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/utils/DecodeUtil.scala +++ b/nebula-algorithm/src/main/scala/com/vesoft/nebula/algorithm/utils/DecodeUtil.scala @@ -53,17 +53,6 @@ object DecodeUtil { (encodeDataframe, encodeId) } - def convertEncodeId2StringId(dataframe: DataFrame, encodeId: DataFrame): DataFrame = { - val resultDF = dataframe - .join(encodeId) - .where(col(ALGO_ID_COL) === col(ENCODE_ID_COL)) - .drop(ALGO_ID_COL) - .drop(ENCODE_ID_COL) - .withColumnRenamed(ORIGIN_ID_COL, ALGO_ID_COL) - resultDF.show() - resultDF - } - def convertAlgoId2StringId(dataframe: DataFrame, encodeId: DataFrame): DataFrame = { encodeId .join(dataframe)