Added abstract class for internal\external dataset scans.
Change-Id: I9c222ab5403a897aa3c8e6b48b6b4ad01891afbb
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/153
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Steven Jacobs <sjaco002@ucr.edu>
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractDataSourceOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractDataSourceOperator.java
new file mode 100644
index 0000000..a265dcc
--- /dev/null
+++ b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractDataSourceOperator.java
@@ -0,0 +1,20 @@
+package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
+
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
+import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractScanOperator;
+
+import java.util.List;
+
+public abstract class AbstractDataSourceOperator extends AbstractScanOperator {
+ protected IDataSource<?> dataSource;
+
+ public AbstractDataSourceOperator(List<LogicalVariable> variables, IDataSource<?> dataSource) {
+ super(variables);
+ this.dataSource = dataSource;
+ }
+
+ public IDataSource<?> getDataSource() {
+ return dataSource;
+ }
+}
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java
index ba51f04..ff21478 100644
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java
+++ b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java
@@ -31,9 +31,7 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-public class DataSourceScanOperator extends AbstractScanOperator {
- private IDataSource<?> dataSource;
-
+public class DataSourceScanOperator extends AbstractDataSourceOperator {
private List<LogicalVariable> projectVars;
private boolean projectPushed = false;
@@ -43,8 +41,7 @@
private List<LogicalVariable> maxFilterVars;
public DataSourceScanOperator(List<LogicalVariable> variables, IDataSource<?> dataSource) {
- super(variables);
- this.dataSource = dataSource;
+ super(variables, dataSource);
projectVars = new ArrayList<LogicalVariable>();
}
@@ -53,10 +50,6 @@
return LogicalOperatorTag.DATASOURCESCAN;
}
- public IDataSource<?> getDataSource() {
- return dataSource;
- }
-
@Override
public <R, S> R accept(ILogicalOperatorVisitor<R, S> visitor, S arg) throws AlgebricksException {
return visitor.visitDataScanOperator(this, arg);
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java
index e18c461..4737cfc 100644
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java
+++ b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.List;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
import org.apache.commons.lang3.mutable.Mutable;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -31,15 +32,15 @@
import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-public class ExternalDataLookupOperator extends AbstractScanOperator {
+public class ExternalDataLookupOperator extends AbstractDataSourceOperator {
private final List<Object> variableTypes;
protected final Mutable<ILogicalExpression> expression;
private final boolean propagateInput;
public ExternalDataLookupOperator(List<LogicalVariable> variables, Mutable<ILogicalExpression> expression,
- List<Object> variableTypes, boolean propagateInput) {
- super(variables);
+ List<Object> variableTypes, boolean propagateInput, IDataSource<?> dataSource) {
+ super(variables, dataSource);
this.expression = expression;
this.variableTypes = variableTypes;
this.propagateInput = propagateInput;
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/OperatorDeepCopyVisitor.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/OperatorDeepCopyVisitor.java
index ebb195f..e62dbf8 100644
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/OperatorDeepCopyVisitor.java
+++ b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/OperatorDeepCopyVisitor.java
@@ -358,7 +358,7 @@
ArrayList<LogicalVariable> newInputList = new ArrayList<LogicalVariable>();
newInputList.addAll(op.getVariables());
return new ExternalDataLookupOperator(newInputList, deepCopyExpressionRef(op.getExpressionRef()),
- new ArrayList<Object>(op.getVariableTypes()), op.isPropagateInput());
+ new ArrayList<Object>(op.getVariableTypes()), op.isPropagateInput(), op.getDataSource());
}
@Override