@@ -8468,6 +8468,7 @@ private FileSinkDesc createFileSinkDesc(String dest, TableDesc table_desc,
8468
8468
RowSchema fsRS, boolean canBeMerged, Table dest_tab, boolean isMmCtas,
8469
8469
Integer dest_type, QB qb, boolean isDirectInsert, AcidUtils.Operation acidOperation, String moveTaskId) throws SemanticException {
8470
8470
boolean isInsertOverwrite = false;
8471
+ boolean isLocal = false;
8471
8472
Context.Operation writeOperation = getWriteOperation(dest);
8472
8473
switch (dest_type) {
8473
8474
case QBMetaData.DEST_PARTITION:
@@ -8492,6 +8493,7 @@ private FileSinkDesc createFileSinkDesc(String dest, TableDesc table_desc,
8492
8493
8493
8494
break;
8494
8495
case QBMetaData.DEST_LOCAL_FILE:
8496
+ isLocal = true;
8495
8497
case QBMetaData.DEST_DFS_FILE:
8496
8498
//CTAS path or insert into file/directory
8497
8499
break;
@@ -8545,7 +8547,12 @@ private FileSinkDesc createFileSinkDesc(String dest, TableDesc table_desc,
8545
8547
fileSinkDesc.setStatsAggPrefix(fileSinkDesc.getDirName().toString());
8546
8548
if (!destTableIsMaterialization &&
8547
8549
HiveConf.getVar(conf, HIVE_STATS_DBCLASS).equalsIgnoreCase(StatDB.fs.name())) {
8548
- String statsTmpLoc = ctx.getTempDirForInterimJobPath(dest_path).toString();
8550
+ String statsTmpLoc;
8551
+ if (isLocal){
8552
+ statsTmpLoc = ctx.getMRTmpPath().toString();
8553
+ } else {
8554
+ statsTmpLoc = ctx.getTempDirForInterimJobPath(dest_path).toString();
8555
+ }
8549
8556
fileSinkDesc.setStatsTmpDir(statsTmpLoc);
8550
8557
LOG.debug("Set stats collection dir : " + statsTmpLoc);
8551
8558
}
0 commit comments