You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2015/08/25 18:42:00 UTC
[47/51] [partial] incubator-asterixdb-hyracks git commit: Change
folder structure for Java repackage
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
deleted file mode 100644
index 528ae4e..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IHyracksJobBuilder;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IPhysicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.PhysicalRequirements;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.TypePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypeEnvPointer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.PropagatingTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-
-public abstract class AbstractLogicalOperator implements ILogicalOperator {
-
- /*********************************************************************
- * UNPARTITIONED, the input data is not partitioned
- * PARTITIONED, the input data is partitioned, the operator is executed on
- * each partition and may receive input from other partitions (e.g. if it is
- * a join or an aggregate)
- * LOCAL, the input data is partitioned, the operator is executed on each
- * partition and only processes data from that partition
- */
-
- public static enum ExecutionMode {
- UNPARTITIONED,
- PARTITIONED,
- LOCAL
- }
-
- private AbstractLogicalOperator.ExecutionMode mode = AbstractLogicalOperator.ExecutionMode.UNPARTITIONED;
- protected IPhysicalOperator physicalOperator;
- private final Map<String, Object> annotations = new HashMap<String, Object>();
- private boolean bJobGenEnabled = true;
-
- final protected List<Mutable<ILogicalOperator>> inputs;
- // protected List<LogicalOperatorReference> outputs;
- protected List<LogicalVariable> schema;
-
- public AbstractLogicalOperator() {
- inputs = new ArrayList<Mutable<ILogicalOperator>>();
- // outputs = new ArrayList<LogicalOperatorReference>();
- }
-
- @Override
- public abstract LogicalOperatorTag getOperatorTag();
-
- public ExecutionMode getExecutionMode() {
- return mode;
- }
-
- public void setExecutionMode(ExecutionMode mode) {
- this.mode = mode;
- }
-
- @Override
- public List<LogicalVariable> getSchema() {
- return schema;
- }
-
- public void setPhysicalOperator(IPhysicalOperator physicalOp) {
- this.physicalOperator = physicalOp;
- }
-
- public IPhysicalOperator getPhysicalOperator() {
- return physicalOperator;
- }
-
- /**
- * @return for each child, one vector of required physical properties
- */
-
- @Override
- public final PhysicalRequirements getRequiredPhysicalPropertiesForChildren(
- IPhysicalPropertiesVector requiredProperties) {
- return physicalOperator.getRequiredPropertiesForChildren(this, requiredProperties);
- }
-
- /**
- * @return the physical properties that this operator delivers, based on
- * what its children deliver
- */
-
- @Override
- public final IPhysicalPropertiesVector getDeliveredPhysicalProperties() {
- return physicalOperator.getDeliveredProperties();
- }
-
- @Override
- public final void computeDeliveredPhysicalProperties(IOptimizationContext context) throws AlgebricksException {
- physicalOperator.computeDeliveredProperties(this, context);
- }
-
- @Override
- public final List<Mutable<ILogicalOperator>> getInputs() {
- return inputs;
- }
-
- // @Override
- // public final List<LogicalOperatorReference> getOutputs() {
- // return outputs;
- // }
-
- @Override
- public final boolean hasInputs() {
- return !inputs.isEmpty();
- }
-
- public boolean hasNestedPlans() {
- return false;
- }
-
- @Override
- public Map<String, Object> getAnnotations() {
- return annotations;
- }
-
- @Override
- public void removeAnnotation(String annotationName) {
- annotations.remove(annotationName);
- }
-
- @Override
- public final void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context,
- IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- if (bJobGenEnabled) {
- if (physicalOperator == null) {
- throw new AlgebricksException("Physical operator not set for operator: " + this);
- }
- physicalOperator.contributeRuntimeOperator(builder, context, this, propagatedSchema, inputSchemas,
- outerPlanSchema);
- }
- }
-
- public void disableJobGen() {
- bJobGenEnabled = false;
- }
-
- public boolean isJobGenEnabled() {
- return bJobGenEnabled;
- }
-
- @Override
- public IVariableTypeEnvironment computeInputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
- protected PropagatingTypeEnvironment createPropagatingAllInputsTypeEnvironment(ITypingContext ctx) {
- int n = inputs.size();
- ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n];
- for (int i = 0; i < n; i++) {
- envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
- }
- return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getNullableTypeComputer(),
- ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
- }
-
- @Override
- public boolean requiresVariableReferenceExpressions() {
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractOperatorWithNestedPlans.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractOperatorWithNestedPlans.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractOperatorWithNestedPlans.java
deleted file mode 100644
index 417c959..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractOperatorWithNestedPlans.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public abstract class AbstractOperatorWithNestedPlans extends AbstractLogicalOperator {
- protected final List<ILogicalPlan> nestedPlans;
-
- public AbstractOperatorWithNestedPlans() {
- nestedPlans = new ArrayList<ILogicalPlan>();
- }
-
- public AbstractOperatorWithNestedPlans(List<ILogicalPlan> nestedPlans) {
- this.nestedPlans = nestedPlans;
- }
-
- public List<ILogicalPlan> getNestedPlans() {
- return nestedPlans;
- }
-
- @Override
- public boolean hasNestedPlans() {
- return true;
- }
-
- public LinkedList<Mutable<ILogicalOperator>> allRootsInReverseOrder() {
- LinkedList<Mutable<ILogicalOperator>> allRoots = new LinkedList<Mutable<ILogicalOperator>>();
- for (ILogicalPlan p : nestedPlans) {
- for (Mutable<ILogicalOperator> r : p.getRoots()) {
- allRoots.addFirst(r);
- }
- }
- return allRoots;
- }
-
- //
- // @Override
- // public void computeConstraintsAndEquivClasses() {
- // for (ILogicalPlan p : nestedPlans) {
- // for (LogicalOperatorReference r : p.getRoots()) {
- // AbstractLogicalOperator op = (AbstractLogicalOperator) r.getOperator();
- // equivalenceClasses.putAll(op.getEquivalenceClasses());
- // functionalDependencies.addAll(op.getFDs());
- // }
- // }
- // }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(inputs.get(0).getValue().getSchema());
- for (ILogicalPlan p : nestedPlans) {
- for (Mutable<ILogicalOperator> r : p.getRoots()) {
- schema.addAll(r.getValue().getSchema());
- }
- }
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- public abstract void getUsedVariablesExceptNestedPlans(Collection<LogicalVariable> vars);
-
- public abstract void getProducedVariablesExceptNestedPlans(Collection<LogicalVariable> vars);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractScanOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractScanOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractScanOperator.java
deleted file mode 100644
index e18fbfb..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractScanOperator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-
-public abstract class AbstractScanOperator extends AbstractLogicalOperator {
- protected List<LogicalVariable> variables;
-
- public AbstractScanOperator(List<LogicalVariable> variables) {
- this.variables = variables;
- }
-
- public List<LogicalVariable> getVariables() {
- return variables;
- }
-
- public void setVariables(List<LogicalVariable> variables) {
- this.variables = variables;
- }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(inputs.get(0).getValue().getSchema());
- schema.addAll(variables);
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
-
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- if (sources.length > 0) {
- target.addAllVariables(sources[0]);
- }
- for (LogicalVariable v : variables) {
- target.addVariable(v);
- }
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractUnnestOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractUnnestOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractUnnestOperator.java
deleted file mode 100644
index fdc827f..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AbstractUnnestOperator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-
-public abstract class AbstractUnnestOperator extends AbstractScanOperator {
-
- protected final Mutable<ILogicalExpression> expression;
-
- public AbstractUnnestOperator(List<LogicalVariable> variables, Mutable<ILogicalExpression> expression) {
- super(variables);
- this.expression = expression;
- }
-
- public Mutable<ILogicalExpression> getExpressionRef() {
- return expression;
- }
-
- @Override
- public boolean isMap() {
- return true;
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- return visitor.transform(expression);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
deleted file mode 100644
index 371da4c..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AggregateOperator.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class AggregateOperator extends AbstractAssignOperator {
-
- // private ArrayList<AggregateFunctionCallExpression> expressions;
- // TODO type safe list of expressions
- private List<Mutable<ILogicalExpression>> mergeExpressions;
- private boolean global;
-
- public AggregateOperator(List<LogicalVariable> variables, List<Mutable<ILogicalExpression>> expressions) {
- super(variables, expressions);
- global = true;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.AGGREGATE;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitAggregateOperator(this, arg);
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
-
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- for (LogicalVariable v : variables) {
- target.addVariable(v);
- }
- }
- };
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(variables);
- }
-
- public void setMergeExpressions(List<Mutable<ILogicalExpression>> merges) {
- mergeExpressions = merges;
- }
-
- public List<Mutable<ILogicalExpression>> getMergeExpressions() {
- return mergeExpressions;
- }
-
- public void setGlobal(boolean global) {
- this.global = global;
- }
-
- public boolean isGlobal() {
- return global;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- IVariableTypeEnvironment env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
- ctx.getMetadataProvider());
- IVariableTypeEnvironment env2 = ctx.getOutputTypeEnvironment(inputs.get(0).getValue());
- int n = variables.size();
- for (int i = 0; i < n; i++) {
- Object t = ctx.getExpressionTypeComputer().getType(expressions.get(i).getValue(),
- ctx.getMetadataProvider(), env2);
- env.setVarType(variables.get(i), t);
- }
- return env;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AssignOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AssignOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AssignOperator.java
deleted file mode 100644
index 9a8c428..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/AssignOperator.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.List;
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.LocalOrderProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.PropagatingTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-/**
- * It corresponds to the Map operator in other algebras.
- *
- * @author Nicola
- */
-
-public class AssignOperator extends AbstractAssignOperator {
-
- private LocalOrderProperty explicitOrderingProperty;
-
- public AssignOperator(List<LogicalVariable> vars, List<Mutable<ILogicalExpression>> exprs) {
- super(vars, exprs);
- }
-
- public AssignOperator(LogicalVariable var, Mutable<ILogicalExpression> expr) {
- super();
- this.variables.add(var);
- this.expressions.add(expr);
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.ASSIGN;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitAssignOperator(this, arg);
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
-
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- target.addAllVariables(sources[0]);
- for (LogicalVariable v : variables) {
- target.addVariable(v);
- }
- }
- };
-
- }
-
- @Override
- public boolean isMap() {
- return true;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- PropagatingTypeEnvironment env = createPropagatingAllInputsTypeEnvironment(ctx);
- int n = variables.size();
- for (int i = 0; i < n; i++) {
- env.setVarType(
- variables.get(i),
- ctx.getExpressionTypeComputer().getType(expressions.get(i).getValue(), ctx.getMetadataProvider(),
- env));
- if (expressions.get(i).getValue().getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- LogicalVariable var = ((VariableReferenceExpression) expressions.get(i).getValue())
- .getVariableReference();
- for (List<LogicalVariable> list : env.getCorrelatedNullableVariableLists()) {
- if (list.contains(var)) {
- list.add(variables.get(i));
- }
- }
- }
- }
- return env;
- }
-
- @Override
- public boolean requiresVariableReferenceExpressions() {
- return false;
- }
-
- public LocalOrderProperty getExplicitOrderingProperty() {
- return explicitOrderingProperty;
- }
-
- public void setExplicitOrderingProperty(
- LocalOrderProperty explicitOrderingProperty) {
- this.explicitOrderingProperty = explicitOrderingProperty;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java
----------------------------------------------------------------------
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
deleted file mode 100644
index ff21478..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DataSourceScanOperator.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class DataSourceScanOperator extends AbstractDataSourceOperator {
- private List<LogicalVariable> projectVars;
-
- private boolean projectPushed = false;
-
- private List<Mutable<ILogicalExpression>> additionalFilteringExpressions;
- private List<LogicalVariable> minFilterVars;
- private List<LogicalVariable> maxFilterVars;
-
- public DataSourceScanOperator(List<LogicalVariable> variables, IDataSource<?> dataSource) {
- super(variables, dataSource);
- projectVars = new ArrayList<LogicalVariable>();
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.DATASOURCESCAN;
- }
-
- @Override
- public <R, S> R accept(ILogicalOperatorVisitor<R, S> visitor, S arg) throws AlgebricksException {
- return visitor.visitDataScanOperator(this, arg);
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- return false;
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- public void addProjectVariables(Collection<LogicalVariable> vars) {
- projectVars.addAll(vars);
- projectPushed = true;
- }
-
- public List<LogicalVariable> getProjectVariables() {
- return projectVars;
- }
-
- public boolean isProjectPushed() {
- return projectPushed;
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- if (sources.length > 0) {
- target.addAllVariables(sources[0]);
- }
- List<LogicalVariable> outputVariables = projectPushed ? projectVars : variables;
- for (LogicalVariable v : outputVariables) {
- target.addVariable(v);
- }
- }
- };
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- IVariableTypeEnvironment env = createPropagatingAllInputsTypeEnvironment(ctx);
- Object[] types = dataSource.getSchemaTypes();
- int i = 0;
- for (LogicalVariable v : variables) {
- env.setVarType(v, types[i]);
- ++i;
- }
- return env;
- }
-
- public List<LogicalVariable> getMinFilterVars() {
- return minFilterVars;
- }
-
- public void setMinFilterVars(List<LogicalVariable> minFilterVars) {
- this.minFilterVars = minFilterVars;
- }
-
- public List<LogicalVariable> getMaxFilterVars() {
- return maxFilterVars;
- }
-
- public void setMaxFilterVars(List<LogicalVariable> maxFilterVars) {
- this.maxFilterVars = maxFilterVars;
- }
-
- public void setAdditionalFilteringExpressions(List<Mutable<ILogicalExpression>> additionalFilteringExpressions) {
- this.additionalFilteringExpressions = additionalFilteringExpressions;
- }
-
- public List<Mutable<ILogicalExpression>> getAdditionalFilteringExpressions() {
- return additionalFilteringExpressions;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistinctOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistinctOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistinctOperator.java
deleted file mode 100644
index 3d8c4b6..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistinctOperator.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class DistinctOperator extends AbstractLogicalOperator {
- private final List<Mutable<ILogicalExpression>> expressions;
-
- public DistinctOperator(List<Mutable<ILogicalExpression>> expressions) {
- this.expressions = expressions;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.DISTINCT;
- }
-
- public List<Mutable<ILogicalExpression>> getExpressions() {
- return expressions;
- }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(this.getDistinctByVarList());
- List<LogicalVariable> inputSchema = inputs.get(0).getValue().getSchema();
- for (LogicalVariable var : inputSchema) {
- if (!schema.contains(var)) {
- schema.add(var);
- }
- }
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- /** make sure distinct key vars laid-out first */
- for (LogicalVariable keyVar : getDistinctByVarList()) {
- target.addVariable(keyVar);
- }
- /** add other source vars */
- for (IOperatorSchema srcSchema : sources) {
- for (LogicalVariable srcVar : srcSchema)
- if (target.findVariable(srcVar) < 0) {
- target.addVariable(srcVar);
- }
- }
- }
- };
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- boolean changed = false;
- for (Mutable<ILogicalExpression> e : expressions) {
- if (visitor.transform(e)) {
- changed = true;
- }
- }
- return changed;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitDistinctOperator(this, arg);
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- public List<LogicalVariable> getDistinctByVarList() {
- List<LogicalVariable> varList = new ArrayList<LogicalVariable>(expressions.size());
- for (Mutable<ILogicalExpression> eRef : expressions) {
- ILogicalExpression e = eRef.getValue();
- if (e.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- VariableReferenceExpression v = (VariableReferenceExpression) e;
- varList.add(v.getVariableReference());
- }
- }
- return varList;
- }
-
- public boolean isDistinctByVar(LogicalVariable var) {
- for (Mutable<ILogicalExpression> eRef : expressions) {
- ILogicalExpression e = eRef.getValue();
- if (e.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- VariableReferenceExpression v = (VariableReferenceExpression) e;
- if (v.getVariableReference() == var) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistributeResultOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistributeResultOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistributeResultOperator.java
deleted file mode 100644
index 3e28d73..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/DistributeResultOperator.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSink;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class DistributeResultOperator extends AbstractLogicalOperator {
- private List<Mutable<ILogicalExpression>> expressions;
- private IDataSink dataSink;
-
- public DistributeResultOperator(List<Mutable<ILogicalExpression>> expressions, IDataSink dataSink) {
- this.expressions = expressions;
- this.dataSink = dataSink;
- }
-
- public List<Mutable<ILogicalExpression>> getExpressions() {
- return expressions;
- }
-
- public IDataSink getDataSink() {
- return dataSink;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.DISTRIBUTE_RESULT;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitDistributeResultOperator(this, arg);
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- boolean modif = false;
- for (int i = 0; i < expressions.size(); i++) {
- boolean b = visitor.transform(expressions.get(i));
- if (b) {
- modif = true;
- }
- }
- return modif;
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return VariablePropagationPolicy.ALL;
- }
-
- @Override
- public boolean isMap() {
- return false; // actually depends on the physical op.
- }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(inputs.get(0).getValue().getSchema());
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/EmptyTupleSourceOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/EmptyTupleSourceOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/EmptyTupleSourceOperator.java
deleted file mode 100644
index 7d16ed1..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/EmptyTupleSourceOperator.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class EmptyTupleSourceOperator extends AbstractLogicalOperator {
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.EMPTYTUPLESOURCE;
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return VariablePropagationPolicy.NONE;
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) {
- // do nothing
- return false;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitEmptyTupleSourceOperator(this, arg);
- }
-
- @Override
- public void recomputeSchema() {
- schema = new ArrayList<LogicalVariable>();
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(final ITypingContext ctx) throws AlgebricksException {
- return new IVariableTypeEnvironment() {
-
- @Override
- public void setVarType(LogicalVariable var, Object type) {
- throw new IllegalStateException();
- }
-
- @Override
- public Object getVarType(LogicalVariable var) throws AlgebricksException {
- return null;
- }
-
- @Override
- public Object getType(ILogicalExpression expr) throws AlgebricksException {
- return ctx.getExpressionTypeComputer().getType(expr, ctx.getMetadataProvider(), this);
- }
-
- @Override
- public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariables,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- return null;
- }
-
- @Override
- public boolean substituteProducedVariable(LogicalVariable v1, LogicalVariable v2)
- throws AlgebricksException {
- return false;
- }
- };
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExchangeOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExchangeOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExchangeOperator.java
deleted file mode 100644
index a3c2650..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExchangeOperator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.util.OperatorPropertiesUtil;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class ExchangeOperator extends AbstractLogicalOperator {
-
- public ExchangeOperator() {
- super();
- setExecutionMode(AbstractLogicalOperator.ExecutionMode.PARTITIONED);
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitExchangeOperator(this, arg);
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) {
- // do nothing
- return false;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.EXCHANGE;
- }
-
- @Override
- public void recomputeSchema() throws AlgebricksException {
- AbstractLogicalOperator cld = (AbstractLogicalOperator) inputs.get(0).getValue();
- OperatorPropertiesUtil.computeSchemaRecIfNull(cld);
- List<LogicalVariable> inputSchema = inputs.get(0).getValue().getSchema();
- schema = new ArrayList<LogicalVariable>(inputSchema);
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return VariablePropagationPolicy.ALL;
- }
-
- @Override
- public boolean isMap() {
- return true;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExtensionOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExtensionOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExtensionOperator.java
deleted file mode 100644
index bdf6f1c..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExtensionOperator.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IPhysicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-/**
- * @author rico
- */
-public class ExtensionOperator extends AbstractLogicalOperator {
-
- private IOperatorExtension delegate;
-
- public ExtensionOperator(IOperatorExtension delegate) {
- super();
- if (delegate == null) {
- throw new IllegalArgumentException("delegate cannot be null!");
- }
- this.delegate = delegate;
- setExecutionMode(delegate.getExecutionMode());
- }
-
- @Override
- public void recomputeSchema() throws AlgebricksException {
- schema = new ArrayList<LogicalVariable>(inputs.get(0).getValue().getSchema());
- delegate.setSchema(schema);
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform transform) throws AlgebricksException {
- return delegate.acceptExpressionTransform(transform);
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitExtensionOperator(this, arg);
- }
-
- @Override
- public boolean isMap() {
- return this.delegate.isMap();
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return VariablePropagationPolicy.ALL;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return this.createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.EXTENSION_OPERATOR;
- }
-
- public IOperatorExtension getNewInstanceOfDelegateOperator() {
- return delegate.newInstance();
- }
-
- @Override
- public List<LogicalVariable> getSchema() {
- return this.schema;
- }
-
- @Override
- public ExecutionMode getExecutionMode() {
- return delegate.getExecutionMode();
- }
-
- @Override
- public void setExecutionMode(ExecutionMode mode) {
- delegate.setExecutionMode(mode);
- }
-
- @Override
- public IPhysicalOperator getPhysicalOperator() {
- return delegate.getPhysicalOperator();
- }
-
- @Override
- public IVariableTypeEnvironment computeInputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return this.createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
- @Override
- public String toString() {
- return delegate.toString();
- }
-
- public IOperatorExtension getDelegate() {
- return delegate;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java
----------------------------------------------------------------------
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
deleted file mode 100644
index 4737cfc..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/ExternalDataLookupOperator.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-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;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.NonPropagatingTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-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, IDataSource<?> dataSource) {
- super(variables, dataSource);
- this.expression = expression;
- this.variableTypes = variableTypes;
- this.propagateInput = propagateInput;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.EXTERNAL_LOOKUP;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- IVariableTypeEnvironment env = null;
- if (propagateInput) {
- env = createPropagatingAllInputsTypeEnvironment(ctx);
- } else {
- env = new NonPropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMetadataProvider());
- }
- env.setVarType(variables.get(0), variableTypes.get(0));
- return env;
- }
-
- public List<Object> getVariableTypes() {
- return variableTypes;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitExternalDataLookupOperator(this, arg);
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- public boolean isPropagateInput() {
- return propagateInput;
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- if (propagateInput) {
- ArrayList<LogicalVariable> usedVariables = new ArrayList<LogicalVariable>();
- VariableUtilities.getUsedVariables(ExternalDataLookupOperator.this, usedVariables);
- int numOfSources = sources.length;
- for (int i = 0; i < numOfSources; i++) {
- for (LogicalVariable v : sources[i]) {
- if (!usedVariables.contains(v)) {
- target.addVariable(v);
- }
- }
- }
- }
- target.addVariable(variables.get(0));
- }
- };
- }
-
- public Mutable<ILogicalExpression> getExpressionRef() {
- return expression;
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- return visitor.transform(expression);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
deleted file mode 100644
index a5b7074..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.TypePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypeEnvPointer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.OpRefTypeEnvPointer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.PropagatingTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class GroupByOperator extends AbstractOperatorWithNestedPlans {
- // If the LogicalVariable in a pair is null, it means that the GroupBy is
- // only grouping by the expression, without producing a new variable.
- private final List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> gByList;
- private final List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorList;
-
- // In decorList, if the variable (first member of the pair) is null, the
- // second member of the pair is variable reference which is propagated.
-
- public GroupByOperator() {
- super();
- gByList = new ArrayList<Pair<LogicalVariable, Mutable<ILogicalExpression>>>();
- decorList = new ArrayList<Pair<LogicalVariable, Mutable<ILogicalExpression>>>();
- }
-
- public GroupByOperator(List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByList,
- List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorList, List<ILogicalPlan> nestedPlans) {
- super(nestedPlans);
- this.decorList = decorList;
- this.gByList = groupByList;
- }
-
- public void addGbyExpression(LogicalVariable variable, ILogicalExpression expression) {
- this.gByList.add(new Pair<LogicalVariable, Mutable<ILogicalExpression>>(variable,
- new MutableObject<ILogicalExpression>(expression)));
- }
-
- public void addDecorExpression(LogicalVariable variable, ILogicalExpression expression) {
- this.decorList.add(new Pair<LogicalVariable, Mutable<ILogicalExpression>>(variable,
- new MutableObject<ILogicalExpression>(expression)));
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.GROUP;
- }
-
- public List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> getGroupByList() {
- return gByList;
- }
-
- public String gByListToString() {
- return veListToString(gByList);
- }
-
- public String decorListToString() {
- return veListToString(decorList);
- }
-
- public List<LogicalVariable> getGbyVarList() {
- List<LogicalVariable> varList = new ArrayList<LogicalVariable>(gByList.size());
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : gByList) {
- ILogicalExpression expr = ve.second.getValue();
- if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- VariableReferenceExpression v = (VariableReferenceExpression) expr;
- varList.add(v.getVariableReference());
- }
- }
- return varList;
- }
-
- public List<LogicalVariable> getProducedGbyVarList() {
- List<LogicalVariable> varList = new ArrayList<LogicalVariable>(gByList.size());
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : gByList) {
- varList.add(ve.first);
- }
- return varList;
- }
-
- public static String veListToString(List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> vePairList) {
- StringBuilder sb = new StringBuilder();
- sb.append("[");
- boolean fst = true;
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : vePairList) {
- if (fst) {
- fst = false;
- } else {
- sb.append("; ");
- }
- if (ve.first != null) {
- sb.append(ve.first + " := " + ve.second);
- } else {
- sb.append(ve.second.getValue());
- }
- }
- sb.append("]");
- return sb.toString();
- }
-
- @Override
- public void recomputeSchema() {
- super.recomputeSchema();
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : gByList) {
- schema.add(p.first);
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : decorList) {
- schema.add(getDecorVariable(p));
- }
- }
-
- @Override
- public void getProducedVariablesExceptNestedPlans(Collection<LogicalVariable> vars) {
- // super.getProducedVariables(vars);
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : gByList) {
- if (p.first != null) {
- vars.add(p.first);
- }
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : decorList) {
- if (p.first != null) {
- vars.add(p.first);
- }
- }
- }
-
- @Override
- public void getUsedVariablesExceptNestedPlans(Collection<LogicalVariable> vars) {
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> g : gByList) {
- g.second.getValue().getUsedVariables(vars);
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> g : decorList) {
- g.second.getValue().getUsedVariables(vars);
- }
- // super.getUsedVariables(vars);
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return new VariablePropagationPolicy() {
-
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : gByList) {
- ILogicalExpression expr = p.second.getValue();
- if (p.first != null) {
- target.addVariable(p.first);
- } else {
- if (expr.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
- throw new AlgebricksException("hash group-by expects variable references.");
- }
- VariableReferenceExpression v = (VariableReferenceExpression) expr;
- target.addVariable(v.getVariableReference());
- }
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : decorList) {
- ILogicalExpression expr = p.second.getValue();
- if (expr.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
- throw new AlgebricksException("pre-sorted group-by expects variable references.");
- }
- VariableReferenceExpression v = (VariableReferenceExpression) expr;
- LogicalVariable decor = v.getVariableReference();
- if (p.first != null) {
- target.addVariable(p.first);
- } else {
- target.addVariable(decor);
- }
- }
-
- }
- };
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- boolean b = false;
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : gByList) {
- if (visitor.transform(p.second)) {
- b = true;
- }
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : decorList) {
- if (visitor.transform(p.second)) {
- b = true;
- }
- }
- return b;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitGroupByOperator(this, arg);
- }
-
- public static LogicalVariable getDecorVariable(Pair<LogicalVariable, Mutable<ILogicalExpression>> p) {
- if (p.first != null) {
- return p.first;
- } else {
- VariableReferenceExpression e = (VariableReferenceExpression) p.second.getValue();
- return e.getVariableReference();
- }
- }
-
- public List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> getDecorList() {
- return decorList;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- int n = 0;
- for (ILogicalPlan p : nestedPlans) {
- n += p.getRoots().size();
- }
- ITypeEnvPointer[] envPointers = new ITypeEnvPointer[n];
- int i = 0;
- for (ILogicalPlan p : nestedPlans) {
- for (Mutable<ILogicalOperator> r : p.getRoots()) {
- envPointers[i] = new OpRefTypeEnvPointer(r, ctx);
- i++;
- }
- }
- IVariableTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
- ctx.getNullableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
- ILogicalOperator child = inputs.get(0).getValue();
- IVariableTypeEnvironment env2 = ctx.getOutputTypeEnvironment(child);
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : getGroupByList()) {
- ILogicalExpression expr = p.second.getValue();
- if (p.first != null) {
- env.setVarType(p.first, env2.getType(expr));
- if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- LogicalVariable v1 = ((VariableReferenceExpression) expr).getVariableReference();
- env.setVarType(v1, env2.getVarType(v1));
- }
- } else {
- VariableReferenceExpression vre = (VariableReferenceExpression) p.second.getValue();
- LogicalVariable v2 = vre.getVariableReference();
- env.setVarType(v2, env2.getVarType(v2));
- }
- }
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : getDecorList()) {
- ILogicalExpression expr = p.second.getValue();
- if (p.first != null) {
- env.setVarType(p.first, env2.getType(expr));
- } else {
- VariableReferenceExpression vre = (VariableReferenceExpression) p.second.getValue();
- LogicalVariable v2 = vre.getVariableReference();
- env.setVarType(v2, env2.getVarType(v2));
- }
- }
- return env;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorExtension.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorExtension.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorExtension.java
deleted file mode 100644
index 94b4252..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorExtension.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.Collection;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IPhysicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.ExecutionMode;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-
-/**
- * @author rico
- */
-public interface IOperatorExtension {
-
- void setExecutionMode(ExecutionMode mode);
-
- boolean isMap();
-
- public IOperatorExtension newInstance();
-
- boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform transform) throws AlgebricksException;
-
- void setSchema(List<LogicalVariable> schema);
-
- IPhysicalOperator getPhysicalOperator();
-
- void setPhysicalOperator(IPhysicalOperator physicalOperator);
-
- ExecutionMode getExecutionMode();
-
- public void getUsedVariables(Collection<LogicalVariable> usedVars);
-
- public void getProducedVariables(Collection<LogicalVariable> producedVars);
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorSchema.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorSchema.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorSchema.java
deleted file mode 100644
index 4e50f4f..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IOperatorSchema.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface IOperatorSchema extends Iterable<LogicalVariable> {
- public void addAllVariables(IOperatorSchema source);
-
- public void addAllNewVariables(IOperatorSchema source);
-
- public int addVariable(LogicalVariable var);
-
- public int findVariable(LogicalVariable var);
-
- public LogicalVariable getVariable(int index);
-
- public int getSize();
-
- public void clear();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
deleted file mode 100644
index c58215e..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/IndexInsertDeleteOperator.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSourceIndex;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteOperator.Kind;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.VariablePropagationPolicy;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionReferenceTransform;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class IndexInsertDeleteOperator extends AbstractLogicalOperator {
-
- private final IDataSourceIndex<?, ?> dataSourceIndex;
- private final List<Mutable<ILogicalExpression>> primaryKeyExprs;
- // In the bulk-load case on ngram or keyword index,
- // it contains [token, number of token] or [token].
- // Otherwise, it contains secondary key information.
- private final List<Mutable<ILogicalExpression>> secondaryKeyExprs;
- private final Mutable<ILogicalExpression> filterExpr;
- private final Kind operation;
- private final boolean bulkload;
- private List<Mutable<ILogicalExpression>> additionalFilteringExpressions;
-
- public IndexInsertDeleteOperator(IDataSourceIndex<?, ?> dataSourceIndex,
- List<Mutable<ILogicalExpression>> primaryKeyExprs, List<Mutable<ILogicalExpression>> secondaryKeyExprs,
- Mutable<ILogicalExpression> filterExpr, Kind operation, boolean bulkload) {
- this.dataSourceIndex = dataSourceIndex;
- this.primaryKeyExprs = primaryKeyExprs;
- this.secondaryKeyExprs = secondaryKeyExprs;
- this.filterExpr = filterExpr;
- this.operation = operation;
- this.bulkload = bulkload;
- }
-
- @Override
- public void recomputeSchema() throws AlgebricksException {
- schema = new ArrayList<LogicalVariable>();
- schema.addAll(inputs.get(0).getValue().getSchema());
- }
-
- @Override
- public boolean acceptExpressionTransform(ILogicalExpressionReferenceTransform visitor) throws AlgebricksException {
- boolean b = false;
- for (int i = 0; i < primaryKeyExprs.size(); i++) {
- if (visitor.transform(primaryKeyExprs.get(i))) {
- b = true;
- }
- }
- for (int i = 0; i < secondaryKeyExprs.size(); i++) {
- if (visitor.transform(secondaryKeyExprs.get(i))) {
- b = true;
- }
- }
- return b;
- }
-
- @Override
- public <R, T> R accept(ILogicalOperatorVisitor<R, T> visitor, T arg) throws AlgebricksException {
- return visitor.visitIndexInsertDeleteOperator(this, arg);
- }
-
- @Override
- public boolean isMap() {
- return false;
- }
-
- @Override
- public VariablePropagationPolicy getVariablePropagationPolicy() {
- return VariablePropagationPolicy.ALL;
- }
-
- @Override
- public LogicalOperatorTag getOperatorTag() {
- return LogicalOperatorTag.INDEX_INSERT_DELETE;
- }
-
- @Override
- public IVariableTypeEnvironment computeOutputTypeEnvironment(ITypingContext ctx) throws AlgebricksException {
- return createPropagatingAllInputsTypeEnvironment(ctx);
- }
-
- public List<Mutable<ILogicalExpression>> getPrimaryKeyExpressions() {
- return primaryKeyExprs;
- }
-
- public IDataSourceIndex<?, ?> getDataSourceIndex() {
- return dataSourceIndex;
- }
-
- public String getIndexName() {
- return dataSourceIndex.getId().toString();
- }
-
- public List<Mutable<ILogicalExpression>> getSecondaryKeyExpressions() {
- return secondaryKeyExprs;
- }
-
- public Mutable<ILogicalExpression> getFilterExpression() {
- return filterExpr;
- }
-
- public Kind getOperation() {
- return operation;
- }
-
- public boolean isBulkload() {
- return bulkload;
- }
-
- public void setAdditionalFilteringExpressions(List<Mutable<ILogicalExpression>> additionalFilteringExpressions) {
- this.additionalFilteringExpressions = additionalFilteringExpressions;
- }
-
- public List<Mutable<ILogicalExpression>> getAdditionalFilteringExpressions() {
- return additionalFilteringExpressions;
- }
-
-}