Fix Remove File Operator
The operator didn't get the correct path of the folder to be
deleted. After the fix, the operator gets the correct path
from the IO manager.
Change-Id: I5910409d79e9c1f8e7192a1050b2be0f823e912f
Reviewed-on: https://asterix-gerrit.ics.uci.edu/659
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/file/FileRemoveOperatorDescriptor.java b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/file/FileRemoveOperatorDescriptor.java
index 6e274d5..cf2008c 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/file/FileRemoveOperatorDescriptor.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/org/apache/hyracks/dataflow/std/file/FileRemoveOperatorDescriptor.java
@@ -23,13 +23,13 @@
import java.io.IOException;
import org.apache.commons.io.FileUtils;
-
import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.context.IHyracksTaskContext;
import org.apache.hyracks.api.dataflow.IOperatorNodePushable;
import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider;
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.job.IOperatorDescriptorRegistry;
import org.apache.hyracks.dataflow.std.base.AbstractOperatorNodePushable;
import org.apache.hyracks.dataflow.std.base.AbstractSingleActivityOperatorDescriptor;
@@ -49,6 +49,9 @@
public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
final FileSplit split = fileSplitProvider.getFileSplits()[partition];
+ final String path = split.getLocalFile().getFile().getPath();
+ final int deviceId = split.getIODeviceId();
+ final IIOManager ioManager = ctx.getIOManager();
return new AbstractOperatorNodePushable() {
@Override
@@ -58,7 +61,7 @@
@Override
public void initialize() throws HyracksDataException {
- File f = split.getLocalFile().getFile();
+ File f = ioManager.getAbsoluteFileRef(deviceId, path).getFile();
try {
FileUtils.deleteDirectory(f);
} catch (IOException e) {