@@ -55,14 +55,14 @@ case class WriteToDirectory(
55
55
val jobConfSer = new SerializableJobConf (jobConf)
56
56
val targetPath = new Path (path)
57
57
58
- val (tmpPath, destPath) = if (isLocal) {
58
+ val writeToPath = if (isLocal) {
59
59
val localFileSystem = FileSystem .getLocal(jobConf)
60
60
val localPath = localFileSystem.makeQualified(targetPath)
61
61
// remove old dir
62
62
if (localFileSystem.exists(localPath)) {
63
63
localFileSystem.delete(localPath, true )
64
64
}
65
- (context.getExternalTmpPath( localPath), localPath)
65
+ localPath
66
66
} else {
67
67
val qualifiedPath = FileUtils .makeQualified(targetPath, hiveContext.hiveconf)
68
68
val dfs = qualifiedPath.getFileSystem(jobConf)
@@ -71,10 +71,10 @@ case class WriteToDirectory(
71
71
} else {
72
72
dfs.mkdirs(qualifiedPath.getParent)
73
73
}
74
- (context.getExternalTmpPath( qualifiedPath), qualifiedPath)
74
+ qualifiedPath
75
75
}
76
76
77
- val fileSinkConf = new FileSinkDesc (tmpPath .toString, desc, false )
77
+ val fileSinkConf = new FileSinkDesc (writeToPath .toString, desc, false )
78
78
val isCompressed = hiveContext.hiveconf.getBoolean(
79
79
ConfVars .COMPRESSRESULT .varname, ConfVars .COMPRESSRESULT .defaultBoolVal)
80
80
@@ -100,15 +100,6 @@ case class WriteToDirectory(
100
100
jobConfSer,
101
101
writerContainer)
102
102
103
- val fs = tmpPath.getFileSystem(jobConf)
104
-
105
- // move tmp file to dest dir
106
- if (isLocal) {
107
- fs.moveToLocalFile(tmpPath, destPath)
108
- } else if (! fs.rename(tmpPath, destPath)) {
109
- throw new IOException (" Unable to write data to " + destPath)
110
- }
111
-
112
103
Seq .empty[Row ]
113
104
}
114
105
0 commit comments