Github user brkyvz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17416#discussion_r108507118
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala ---
    @@ -829,33 +830,56 @@ private[spark] object SparkSubmitUtils {
       var printStream = SparkSubmit.printStream
     
       /**
    -   * Represents a Maven Coordinate
    +   * Represents a Maven Coordinate. Refer to 
https://maven.apache.org/pom.html#Maven_Coordinates
    +   * for more information. Standard ordering for a full coordinate is
    +   * `groupId:artifactId:packaging:classifier:version` although packaging 
and classifier
    +   * are optional.
    +   *
        * @param groupId the groupId of the coordinate
        * @param artifactId the artifactId of the coordinate
    +   * @param packaging Maven packaging type (e.g. jar), if any
    +   * @param classifier Maven classifier, if any
        * @param version the version of the coordinate
        */
    -  private[deploy] case class MavenCoordinate(groupId: String, artifactId: 
String, version: String) {
    -    override def toString: String = s"$groupId:$artifactId:$version"
    +  private[deploy] case class MavenCoordinate(
    +      groupId: String,
    +      artifactId: String,
    +      packaging: Option[String],
    +      classifier: Option[String],
    +      version: String) {
    +
    +    def this(groupId: String, artifactId: String, version: String) =
    +      this(groupId, artifactId, None, None, version)
    +
    +    override def toString: String = {
    +      (Seq(groupId, artifactId) ++ packaging ++ classifier ++ 
Seq(version)).mkString(":")
    +    }
       }
     
     /**
      * Extracts maven coordinates from a comma-delimited string. Coordinates 
should be provided
    - * in the format `groupId:artifactId:version` or 
`groupId/artifactId:version`.
    - * @param coordinates Comma-delimited string of maven coordinates
    + * in the format `groupId:artifactId:version`, 
`groupId:artifactId:packaging:version`, or
    + * `groupId:artifactId:packaging:classifier:version`. '/' can be used as a 
separator instead
    + * of ':'.
    + *
    + * @param coordinates Comma-delimited string of Maven coordinates
      * @return Sequence of Maven coordinates
      */
       def extractMavenCoordinates(coordinates: String): Seq[MavenCoordinate] = 
{
    -    coordinates.split(",").map { p =>
    -      val splits = p.replace("/", ":").split(":")
    -      require(splits.length == 3, s"Provided Maven Coordinates must be in 
the form " +
    -        s"'groupId:artifactId:version'. The coordinate provided is: $p")
    -      require(splits(0) != null && splits(0).trim.nonEmpty, s"The groupId 
cannot be null or " +
    -        s"be whitespace. The groupId provided is: ${splits(0)}")
    -      require(splits(1) != null && splits(1).trim.nonEmpty, s"The 
artifactId cannot be null or " +
    -        s"be whitespace. The artifactId provided is: ${splits(1)}")
    -      require(splits(2) != null && splits(2).trim.nonEmpty, s"The version 
cannot be null or " +
    -        s"be whitespace. The version provided is: ${splits(2)}")
    -      new MavenCoordinate(splits(0), splits(1), splits(2))
    +    coordinates.split(",").map { coordinate =>
    +      val splits = coordinate.split("[:/]")
    +      require(splits.forall(split => split != null && split.trim.nonEmpty),
    +        s"All elements of coordinate must be non-null and not whitespace; 
got $coordinate")
    +      splits match {
    +        case Array(groupId, artifactId, version) =>
    +          new MavenCoordinate(groupId, artifactId, version)
    +        case Array(groupId, artifactId, packaging, version) =>
    +          new MavenCoordinate(groupId, artifactId, Some(packaging), None, 
version)
    --- End diff --
    
    can a classifier be given without the packaging?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to