Skip to content

Commit

Permalink
chore: remove unused import (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiaocs7 authored Oct 7, 2023
1 parent d66ffe4 commit de5f2bb
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 130 deletions.
3 changes: 3 additions & 0 deletions spark/.scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules = [
RemoveUnused
]
23 changes: 23 additions & 0 deletions spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,29 @@
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.8.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<args>
<arg>-Ywarn-unused</arg>
</args>
<compilerPlugins>
<compilerPlugin>
<groupId>org.scalameta</groupId>
<artifactId>semanticdb-scalac_2.12.10</artifactId>
<version>4.3.24</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
</plugin>
<plugin>
Expand All @@ -225,6 +243,11 @@
</scala>
</configuration>
</plugin>
<plugin>
<groupId>io.github.evis</groupId>
<artifactId>scalafix-maven-plugin_2.13</artifactId>
<version>0.1.8_0.11.0</version>
</plugin>
</plugins>
</build>
<packaging>jar</packaging>
Expand Down
3 changes: 1 addition & 2 deletions spark/src/main/scala/com/alibaba/graphar/EdgeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.alibaba.graphar

import java.io.{File, FileInputStream}
import org.apache.hadoop.fs.{Path, FileSystem}
import org.apache.hadoop.fs.Path
import org.apache.spark.sql.{SparkSession}
import org.yaml.snakeyaml.{Yaml, DumperOptions}
import org.yaml.snakeyaml.constructor.Constructor
Expand Down
3 changes: 1 addition & 2 deletions spark/src/main/scala/com/alibaba/graphar/GraphInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.alibaba.graphar

import java.io.{File, FileInputStream}
import org.apache.hadoop.fs.{Path, FileSystem}
import org.apache.hadoop.fs.Path
import org.apache.spark.sql.{SparkSession}
import org.yaml.snakeyaml.{Yaml, DumperOptions}
import org.yaml.snakeyaml.constructor.Constructor
Expand Down
3 changes: 1 addition & 2 deletions spark/src/main/scala/com/alibaba/graphar/VertexInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.alibaba.graphar

import java.io.{File, FileInputStream}
import org.apache.hadoop.fs.{Path, FileSystem}
import org.apache.hadoop.fs.Path
import org.apache.spark.sql.{SparkSession}
import org.yaml.snakeyaml.{Yaml, DumperOptions}
import org.yaml.snakeyaml.constructor.Constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ import com.alibaba.graphar.GeneralParams
import org.json4s._
import org.json4s.jackson.JsonMethods._

import org.apache.spark.internal.io.FileCommitProtocol
import org.apache.spark.sql.execution.datasources.SQLHadoopMapReduceCommitProtocol
import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
import org.apache.hadoop.mapreduce._
import org.apache.spark.internal.Logging

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.execution.datasources.csv.CSVFileFormat
import org.apache.spark.sql.execution.datasources.orc.OrcFileFormat
import org.apache.spark.sql.execution.datasources.parquet.ParquetFileFormat
import org.apache.spark.sql.execution.datasources.v2._
import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.util.CaseInsensitiveStringMap
import org.apache.spark.sql.sources.DataSourceRegister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import org.apache.hadoop.mapreduce.Job
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat
import org.apache.hadoop.mapreduce.{Job, TaskAttemptContext}
import org.apache.hadoop.mapreduce.Job

import org.apache.spark.sql.execution.datasources.{
OutputWriter,
OutputWriterFactory
}
import org.apache.spark.sql.execution.datasources.OutputWriterFactory
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.util.{CaseInsensitiveMap, DateTimeUtils}
Expand All @@ -49,7 +46,6 @@ import org.apache.spark.sql.execution.datasources.{
import org.apache.spark.sql.execution.metric.SQLMetric
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{DataType, StructType}
import org.apache.spark.sql.util.SchemaUtils
import org.apache.spark.util.SerializableConfiguration
import org.apache.spark.sql.execution.datasources.v2.FileBatchWrite
import org.apache.spark.sql.catalyst.expressions.AttributeReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import org.apache.spark.sql.execution.datasources.{
import org.apache.spark.sql.execution.datasources.csv.CsvOutputWriter
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{DataType, StructType}
import org.apache.spark.sql.sources.Filter
import org.apache.spark.sql.connector.write.SupportsOverwrite

import com.alibaba.graphar.datasources.GarWriteBuilder

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@

package com.alibaba.graphar.example

import com.alibaba.graphar.datasources._
import com.alibaba.graphar.reader.{VertexReader, EdgeReader}
import com.alibaba.graphar.graph.GraphReader
import com.alibaba.graphar.{GeneralParams, GraphInfo}
import com.alibaba.graphar.util.Utils

import java.io.{File, FileInputStream}
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
import scala.beans.BeanProperty
import org.apache.spark.sql.{DataFrame, SaveMode, SparkSession}
import org.apache.hadoop.fs.{Path, FileSystem}

object GraphAr2Neo4j {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

package com.alibaba.graphar.example

import com.alibaba.graphar.datasources._
import com.alibaba.graphar.graph.GraphWriter

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.SparkSession

object Neo4j2GraphAr {

Expand Down
11 changes: 1 addition & 10 deletions spark/src/main/scala/com/alibaba/graphar/graph/GraphReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,10 @@

package com.alibaba.graphar.graph

import com.alibaba.graphar.{
GeneralParams,
AdjListType,
GraphInfo,
VertexInfo,
EdgeInfo
}
import com.alibaba.graphar.{GraphInfo, VertexInfo, EdgeInfo}
import com.alibaba.graphar.reader.{VertexReader, EdgeReader}
import com.alibaba.graphar.util.IndexGenerator

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._

/**
* The helper object for reading graph through the definitions of graph info.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@

package com.alibaba.graphar.graph

import com.alibaba.graphar.{
GeneralParams,
AdjListType,
GraphInfo,
VertexInfo,
EdgeInfo
}
import com.alibaba.graphar.{AdjListType, GraphInfo, VertexInfo, EdgeInfo}
import com.alibaba.graphar.reader.{VertexReader, EdgeReader}
import com.alibaba.graphar.writer.{VertexWriter, EdgeWriter}

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.SparkSession

/**
* The helper object for transforming graphs through the definitions of their
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@

package com.alibaba.graphar.graph

import com.alibaba.graphar.{
AdjListType,
GraphInfo,
VertexInfo,
EdgeInfo,
GeneralParams
}
import com.alibaba.graphar.{AdjListType, GraphInfo, GeneralParams}
import com.alibaba.graphar.writer.{VertexWriter, EdgeWriter}
import com.alibaba.graphar.util.IndexGenerator
import com.alibaba.graphar.util.Utils

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, Path}
import java.io.{BufferedWriter, OutputStreamWriter}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,11 @@
package com.alibaba.graphar.reader

import com.alibaba.graphar.util.{IndexGenerator, DataFrameConcat}
import com.alibaba.graphar.{
GeneralParams,
EdgeInfo,
FileType,
AdjListType,
PropertyGroup
}
import com.alibaba.graphar.datasources._
import com.alibaba.graphar.{EdgeInfo, FileType, AdjListType, PropertyGroup}
import com.alibaba.graphar.util.FileSystem

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._

/**
* Reader for edge chunks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
package com.alibaba.graphar.reader

import com.alibaba.graphar.util.{IndexGenerator, DataFrameConcat}
import com.alibaba.graphar.{GeneralParams, VertexInfo, FileType, PropertyGroup}
import com.alibaba.graphar.datasources._
import com.alibaba.graphar.{VertexInfo, PropertyGroup}
import com.alibaba.graphar.util.FileSystem

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.Row

/**
* Reader for vertex chunks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@

package com.alibaba.graphar.util

import com.alibaba.graphar.GeneralParams

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.Row
import org.apache.spark.rdd.RDD

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.alibaba.graphar.util
import org.json4s._
import org.json4s.jackson.Serialization.write

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.DataFrame
import org.apache.hadoop.fs.Path
import org.apache.hadoop.conf.Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ package com.alibaba.graphar.util

import com.alibaba.graphar.GeneralParams

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.Row
import org.apache.spark.rdd.RDD

import scala.collection.SortedMap
import scala.collection.mutable.ArrayBuffer

/**
* IndexGenerator is an object to help generating the indices for vertex/edge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.alibaba.graphar.util

import org.apache.spark.sql.types._
import org.apache.spark.Partitioner

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

package com.alibaba.graphar.writer

import com.alibaba.graphar.util.{
FileSystem,
ChunkPartitioner,
EdgeChunkPartitioner
}
import com.alibaba.graphar.util.{FileSystem, EdgeChunkPartitioner}
import com.alibaba.graphar.{
GeneralParams,
EdgeInfo,
Expand All @@ -38,8 +34,6 @@ import org.apache.spark.sql.types.{
StructType,
StructField
}
import org.apache.spark.util.Utils
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.functions._

import scala.collection.SortedMap
Expand All @@ -54,7 +48,6 @@ object EdgeWriter {
adjListType: AdjListType.Value,
vertexNumOfPrimaryVertexLabel: Long
): (DataFrame, Seq[DataFrame], Array[Long], Map[Long, Int]) = {
import spark.implicits._
val edgeSchema = edgeDf.schema
val colName = if (
adjListType == AdjListType.ordered_by_source || adjListType == AdjListType.unordered_by_source
Expand Down
15 changes: 2 additions & 13 deletions spark/src/main/scala/com/alibaba/graphar/writer/VertexWriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,14 @@

package com.alibaba.graphar.writer

import com.alibaba.graphar.util.{FileSystem, ChunkPartitioner, IndexGenerator}
import com.alibaba.graphar.{
GeneralParams,
VertexInfo,
FileType,
AdjListType,
PropertyGroup
}
import com.alibaba.graphar.util.{FileSystem, ChunkPartitioner}
import com.alibaba.graphar.{GeneralParams, VertexInfo, PropertyGroup}

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types._
import org.apache.spark.sql.functions._
import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.Row
import org.apache.spark.rdd.RDD
import org.apache.spark.HashPartitioner
import org.apache.spark.sql.types.{LongType, StructField}

import scala.collection.SortedMap
import scala.collection.mutable.ArrayBuffer

/** Helper object for VertexWriter class. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ package com.alibaba.graphar

import com.alibaba.graphar.reader.{VertexReader, EdgeReader}

import java.io.{File, FileInputStream}
import scala.beans.BeanProperty
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.SparkSession
import org.apache.spark.graphx._
import org.apache.spark.rdd.RDD
import org.scalatest.funsuite.AnyFunSuite

class ComputeExampleSuite extends AnyFunSuite {
Expand Down
4 changes: 0 additions & 4 deletions spark/src/test/scala/com/alibaba/graphar/TestGraphInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

package com.alibaba.graphar

import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.Constructor
import scala.beans.BeanProperty
import org.scalatest.funsuite.AnyFunSuite
import org.apache.hadoop.fs.{Path, FileSystem}
import org.apache.spark.sql.SparkSession

class GraphInfoSuite extends AnyFunSuite {
Expand Down
Loading

0 comments on commit de5f2bb

Please sign in to comment.