aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
diff options
context:
space:
mode:
authorJacques Nadeau <jacques@apache.org>2015-04-18 16:40:02 -0700
committerJacques Nadeau <jacques@apache.org>2015-05-02 19:33:54 -0700
commit88bb05194b023467d590ac747ec5fa14d04249f5 (patch)
tree5be7744f49f6b22f501bc681d965c780d88b69e3 /exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
parent636177df12c593368676d42bc17b65d684c8d000 (diff)
DRILL-2826: Simplify and centralize Operator Cleanup
- Remove cleanup method from RecordBatch interface - Make OperatorContext creation and closing the management of FragmentContext - Make OperatorContext an abstract class and the impl only available to FragmentContext - Make RecordBatch closing the responsibility of the RootExec - Make all closes be suppresing closes to maximize memory release in failure - Add new CloseableRecordBatch interface used by RootExec - Make RootExec AutoCloseable - Update RecordBatchCreator to return CloseableRecordBatches so that RootExec can maintain list - Generate list of operators through change in ImplCreator
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
index f1271b117..b4efe70a4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/easy/EasyFormatPlugin.java
@@ -36,6 +36,7 @@ import org.apache.drill.exec.physical.base.AbstractWriter;
import org.apache.drill.exec.physical.base.PhysicalOperator;
import org.apache.drill.exec.physical.impl.ScanBatch;
import org.apache.drill.exec.physical.impl.WriterRecordBatch;
+import org.apache.drill.exec.record.CloseableRecordBatch;
import org.apache.drill.exec.record.RecordBatch;
import org.apache.drill.exec.server.DrillbitContext;
import org.apache.drill.exec.store.AbstractRecordReader;
@@ -43,11 +44,10 @@ import org.apache.drill.exec.store.RecordReader;
import org.apache.drill.exec.store.RecordWriter;
import org.apache.drill.exec.store.StoragePluginOptimizerRule;
import org.apache.drill.exec.store.dfs.BasicFormatMatcher;
+import org.apache.drill.exec.store.dfs.DrillFileSystem;
import org.apache.drill.exec.store.dfs.FileSelection;
import org.apache.drill.exec.store.dfs.FormatMatcher;
import org.apache.drill.exec.store.dfs.FormatPlugin;
-import org.apache.drill.exec.store.dfs.DrillFileSystem;
-import org.apache.drill.exec.util.ImpersonationUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.compress.CompressionCodecFactory;
@@ -119,7 +119,7 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
public abstract RecordReader getRecordReader(FragmentContext context, DrillFileSystem dfs, FileWork fileWork,
List<SchemaPath> columns) throws ExecutionSetupException;
- RecordBatch getReaderBatch(FragmentContext context, EasySubScan scan) throws ExecutionSetupException {
+ CloseableRecordBatch getReaderBatch(FragmentContext context, EasySubScan scan) throws ExecutionSetupException {
String partitionDesignator = context.getOptions()
.getOption(ExecConstants.FILESYSTEM_PARTITION_COLUMN_LABEL).string_val;
List<SchemaPath> columns = scan.getColumns();
@@ -153,9 +153,11 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
}
int numParts = 0;
- OperatorContext oContext = new OperatorContext(scan, context,
- false /* ScanBatch is not subject to fragment memory limit */);
- DrillFileSystem dfs;
+ OperatorContext oContext = context.newOperatorContext(scan, false /*
+ * ScanBatch is not subject to fragment memory
+ * limit
+ */);
+ final DrillFileSystem dfs;
try {
dfs = new DrillFileSystem(fsConf, oContext.getStats());
} catch (IOException e) {
@@ -190,7 +192,7 @@ public abstract class EasyFormatPlugin<T extends FormatPluginConfig> implements
public abstract RecordWriter getRecordWriter(FragmentContext context, EasyWriter writer) throws IOException;
- public RecordBatch getWriterBatch(FragmentContext context, RecordBatch incoming, EasyWriter writer)
+ public CloseableRecordBatch getWriterBatch(FragmentContext context, RecordBatch incoming, EasyWriter writer)
throws ExecutionSetupException {
try {
return new WriterRecordBatch(writer, incoming, context, getRecordWriter(context, writer));