Andrew Or created SPARK-9232:
--------------------------------

             Summary: Duplicate code in JSONRelation
                 Key: SPARK-9232
                 URL: https://issues.apache.org/jira/browse/SPARK-9232
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 1.4.0
            Reporter: Andrew Or
            Assignee: Andrew Or
            Priority: Minor


The following block appears identically in two places:

{code}
var success: Boolean = false
try {
  success = fs.delete(filesystemPath, true)
} catch {
  case e: IOException =>
    throw new IOException(
      s"Unable to clear output directory ${filesystemPath.toString} prior"
        + s" to writing to JSON table:\n${e.toString}")
}
if (!success) {
  throw new IOException(
    s"Unable to clear output directory ${filesystemPath.toString} prior"
      + s" to writing to JSON table.")
  }
}
{code}

https://github.com/apache/spark/blob/e5d2c37c68ac00a57c2542e62d1c5b4ca267c89e/sql/core/src/main/scala/org/apache/spark/sql/json/JSONRelation.scala#L72

https://github.com/apache/spark/blob/e5d2c37c68ac00a57c2542e62d1c5b4ca267c89e/sql/core/src/main/scala/org/apache/spark/sql/json/JSONRelation.scala#L131



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to