This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.slf4j.{Logger, LoggerFactory} | |
import org.apache.hadoop.fs.{FileSystem, Path} | |
import org.apache.parquet.hadoop.rewrite.{RewriteOptions, ParquetRewriter} | |
import org.apache.spark.sql.{DataFrame, SaveMode, SparkSession} | |
import org.apache.spark.sql.functions.{col, element_at, expr, monotonically_increasing_id} | |
import java.net.URI | |
import scala.collection.JavaConverters._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You need Maven installed to run it. | |
lazy val mavenDependencyTree = taskKey[Unit]("Prints a Maven dependency tree") | |
mavenDependencyTree := { | |
val scalaReleaseSuffix = "_" + scalaVersion.value.split('.').take(2).mkString(".") | |
val pomXml = | |
<project> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>groupId</groupId> | |
<artifactId>artifactId</artifactId> | |
<version>1.0</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val lines = (scala.xml.XML.load("pom.xml") \\ "dependencies") \ "dependency" map { dependency => | |
val groupId = (dependency \ "groupId").text | |
val artifactId = (dependency \ "artifactId").text | |
val version = (dependency \ "version").text | |
val scope = (dependency \ "scope").text match { | |
case "" => "" | |
case x => s""" % "$x"""" | |
} | |
s"""libraryDependencies += "$groupId" % "$artifactId" % "$version"$scope""" |