File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
sql/core/src/main/scala/org/apache/spark/sql/json Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,10 @@ private[sql] class DefaultSource
6767 case SaveMode .Append =>
6868 sys.error(s " Append mode is not supported by ${this .getClass.getCanonicalName}" )
6969 case SaveMode .Overwrite => {
70- try {
71- fs.delete(filesystemPath, true )
72- } catch {
73- case e : IOException =>
74- throw new IOException (
75- s " Unable to clear output directory ${filesystemPath.toString} prior "
76- + s " to CREATE a JSON table AS SELECT: \n ${e.toString}" )
70+ if (! fs.delete(filesystemPath, true )) {
71+ sys.error(
72+ s " Unable to clear output directory ${filesystemPath.toString} prior "
73+ + s " to CREATE a JSON table AS SELECT " )
7774 }
7875 true
7976 }
@@ -117,13 +114,10 @@ private[sql] case class JSONRelation(
117114 val fs = filesystemPath.getFileSystem(sqlContext.sparkContext.hadoopConfiguration)
118115
119116 if (overwrite) {
120- try {
121- fs.delete(filesystemPath, true )
122- } catch {
123- case e : IOException =>
124- throw new IOException (
125- s " Unable to clear output directory ${filesystemPath.toString} prior "
126- + s " to INSERT OVERWRITE a JSON table: \n ${e.toString}" )
117+ if (! fs.delete(filesystemPath, true )) {
118+ sys.error(
119+ s " Unable to clear output directory ${filesystemPath.toString} prior "
120+ + s " to CREATE a JSON table AS SELECT " )
127121 }
128122 // Write the data.
129123 data.toJSON.saveAsTextFile(path)
You can’t perform that action at this time.
0 commit comments