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:41:55 UTC
[42/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/visitors/VariableUtilities.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java
deleted file mode 100644
index f3cf0a4..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/logical/visitors/VariableUtilities.java
+++ /dev/null
@@ -1,97 +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.visitors;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-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.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypingContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class VariableUtilities {
-
- public static void getUsedVariables(ILogicalOperator op, Collection<LogicalVariable> usedVariables)
- throws AlgebricksException {
- ILogicalOperatorVisitor<Void, Void> visitor = new UsedVariableVisitor(usedVariables);
- op.accept(visitor, null);
- }
-
- public static void getProducedVariables(ILogicalOperator op, Collection<LogicalVariable> producedVariables)
- throws AlgebricksException {
- ILogicalOperatorVisitor<Void, Void> visitor = new ProducedVariableVisitor(producedVariables);
- op.accept(visitor, null);
- }
-
- public static void getLiveVariables(ILogicalOperator op, Collection<LogicalVariable> schemaVariables)
- throws AlgebricksException {
- ILogicalOperatorVisitor<Void, Void> visitor = new SchemaVariableVisitor(schemaVariables);
- op.accept(visitor, null);
- }
-
- public static void getUsedVariablesInDescendantsAndSelf(ILogicalOperator op, Collection<LogicalVariable> vars)
- throws AlgebricksException {
- // DFS traversal
- VariableUtilities.getUsedVariables(op, vars);
- for (Mutable<ILogicalOperator> c : op.getInputs()) {
- getUsedVariablesInDescendantsAndSelf(c.getValue(), vars);
- }
- }
-
- public static void getProducedVariablesInDescendantsAndSelf(ILogicalOperator op, Collection<LogicalVariable> vars)
- throws AlgebricksException {
- // DFS traversal
- VariableUtilities.getProducedVariables(op, vars);
- for (Mutable<ILogicalOperator> c : op.getInputs()) {
- getProducedVariablesInDescendantsAndSelf(c.getValue(), vars);
- }
- }
-
- public static void substituteVariables(ILogicalOperator op, LogicalVariable v1, LogicalVariable v2,
- ITypingContext ctx) throws AlgebricksException {
- substituteVariables(op, v1, v2, true, ctx);
- }
-
- public static void substituteVariablesInDescendantsAndSelf(ILogicalOperator op, LogicalVariable v1,
- LogicalVariable v2, ITypingContext ctx) throws AlgebricksException {
- for (Mutable<ILogicalOperator> childOp : op.getInputs()) {
- substituteVariablesInDescendantsAndSelf(childOp.getValue(), v1, v2, ctx);
- }
- substituteVariables(op, v1, v2, true, ctx);
- }
-
- public static void substituteVariables(ILogicalOperator op, LogicalVariable v1, LogicalVariable v2,
- boolean goThroughNts, ITypingContext ctx) throws AlgebricksException {
- ILogicalOperatorVisitor<Void, Pair<LogicalVariable, LogicalVariable>> visitor = new SubstituteVariableVisitor(
- goThroughNts, ctx);
- op.accept(visitor, new Pair<LogicalVariable, LogicalVariable>(v1, v2));
- }
-
- public static <T> boolean varListEqualUnordered(List<T> var, List<T> varArg) {
- Set<T> varSet = new HashSet<T>();
- Set<T> varArgSet = new HashSet<T>();
- varSet.addAll(var);
- varArgSet.addAll(varArg);
- return varSet.equals(varArgSet);
- }
-
-}
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/physical/AbstractExchangePOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java
deleted file mode 100644
index 42d964d..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractExchangePOperator.java
+++ /dev/null
@@ -1,51 +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.physical;
-
-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.IHyracksJobBuilder;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IHyracksJobBuilder.TargetConstraint;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
-import edu.uci.ics.hyracks.api.job.IConnectorDescriptorRegistry;
-
-public abstract class AbstractExchangePOperator extends AbstractPhysicalOperator {
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- Pair<IConnectorDescriptor, TargetConstraint> connPair = createConnectorDescriptor(builder.getJobSpec(), op,
- opSchema, context);
- builder.contributeConnectorWithTargetConstraint(op, connPair.first, connPair.second);
- ILogicalOperator src = op.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, op, 0);
- }
-
- @Override
- public boolean isMicroOperator() {
- return false;
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- return false;
- }
-
- public abstract Pair<IConnectorDescriptor, TargetConstraint> createConnectorDescriptor(
- IConnectorDescriptorRegistry spec, ILogicalOperator op, IOperatorSchema opSchema, JobGenContext context)
- throws AlgebricksException;
-}
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/physical/AbstractHashJoinPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractHashJoinPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractHashJoinPOperator.java
deleted file mode 100644
index 764159d..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractHashJoinPOperator.java
+++ /dev/null
@@ -1,191 +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.physical;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.common.utils.ListSet;
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-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.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator.JoinKind;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.BroadcastPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-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.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty;
-
-public abstract class AbstractHashJoinPOperator extends AbstractJoinPOperator {
-
- protected List<LogicalVariable> keysLeftBranch;
- protected List<LogicalVariable> keysRightBranch;
-
- public AbstractHashJoinPOperator(JoinKind kind, JoinPartitioningType partitioningType,
- List<LogicalVariable> sideLeftOfEqualities, List<LogicalVariable> sideRightOfEqualities) {
- super(kind, partitioningType);
- this.keysLeftBranch = sideLeftOfEqualities;
- this.keysRightBranch = sideRightOfEqualities;
- }
-
- public List<LogicalVariable> getKeysLeftBranch() {
- return keysLeftBranch;
- }
-
- public List<LogicalVariable> getKeysRightBranch() {
- return keysRightBranch;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator iop, IOptimizationContext context)
- throws AlgebricksException {
- IPartitioningProperty pp;
- AbstractLogicalOperator op = (AbstractLogicalOperator) iop;
-
- if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.PARTITIONED) {
- AbstractLogicalOperator op0 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- IPhysicalPropertiesVector pv0 = op0.getPhysicalOperator().getDeliveredProperties();
- AbstractLogicalOperator op1 = (AbstractLogicalOperator) op.getInputs().get(1).getValue();
- IPhysicalPropertiesVector pv1 = op1.getPhysicalOperator().getDeliveredProperties();
-
- if (pv0 == null || pv1 == null) {
- pp = null;
- } else {
- pp = pv0.getPartitioningProperty();
- }
- } else {
- pp = IPartitioningProperty.UNPARTITIONED;
- }
- this.deliveredProperties = new StructuralPropertiesVector(pp, deliveredLocalProperties(iop, context));
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator iop,
- IPhysicalPropertiesVector reqdByParent) {
- StructuralPropertiesVector[] pv = new StructuralPropertiesVector[2];
- // In a cost-based optimizer, we would also try to propagate the
- // parent's partitioning requirements.
- AbstractLogicalOperator op = (AbstractLogicalOperator) iop;
-
- IPartitioningProperty pp1 = null;
- IPartitioningProperty pp2 = null;
- if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.PARTITIONED) {
- switch (partitioningType) {
- case PAIRWISE: {
- pp1 = new UnorderedPartitionedProperty(new ListSet<LogicalVariable>(keysLeftBranch), null);
- pp2 = new UnorderedPartitionedProperty(new ListSet<LogicalVariable>(keysRightBranch), null);
- break;
- }
- case BROADCAST: {
- pp2 = new BroadcastPartitioningProperty(null);
- break;
- }
- default: {
- throw new IllegalStateException();
- }
- }
- }
-
- pv[0] = new StructuralPropertiesVector(pp1, null);
- pv[1] = new StructuralPropertiesVector(pp2, null);
-
- IPartitioningRequirementsCoordinator prc;
- switch (kind) {
- case INNER: {
- prc = IPartitioningRequirementsCoordinator.EQCLASS_PARTITIONING_COORDINATOR;
- break;
- }
- case LEFT_OUTER: {
- prc = new IPartitioningRequirementsCoordinator() {
-
- @Override
- public Pair<Boolean, IPartitioningProperty> coordinateRequirements(
- IPartitioningProperty requirements, IPartitioningProperty firstDeliveredPartitioning,
- ILogicalOperator op, IOptimizationContext context) throws AlgebricksException {
- if (firstDeliveredPartitioning != null
- && firstDeliveredPartitioning.getPartitioningType() == requirements
- .getPartitioningType()) {
- switch (requirements.getPartitioningType()) {
- case UNORDERED_PARTITIONED: {
- UnorderedPartitionedProperty upp1 = (UnorderedPartitionedProperty) firstDeliveredPartitioning;
- Set<LogicalVariable> set1 = upp1.getColumnSet();
- UnorderedPartitionedProperty uppreq = (UnorderedPartitionedProperty) requirements;
- Set<LogicalVariable> modifuppreq = new ListSet<LogicalVariable>();
- Map<LogicalVariable, EquivalenceClass> eqmap = context.getEquivalenceClassMap(op);
- Set<LogicalVariable> covered = new ListSet<LogicalVariable>();
- for (LogicalVariable r : uppreq.getColumnSet()) {
- EquivalenceClass ecSnd = eqmap.get(r);
- boolean found = false;
- int j = 0;
- for (LogicalVariable rvar : keysRightBranch) {
- if (rvar == r || ecSnd != null && eqmap.get(rvar) == ecSnd) {
- found = true;
- break;
- }
- j++;
- }
- if (!found) {
- throw new IllegalStateException("Did not find a variable equivalent to "
- + r + " among " + keysRightBranch);
- }
- LogicalVariable v2 = keysLeftBranch.get(j);
- EquivalenceClass ecFst = eqmap.get(v2);
- for (LogicalVariable vset1 : set1) {
- if (vset1 == v2 || ecFst != null && eqmap.get(vset1) == ecFst) {
- covered.add(vset1);
- modifuppreq.add(r);
- break;
- }
- }
- }
- if (!covered.equals(set1)) {
- throw new AlgebricksException("Could not modify " + requirements
- + " to agree with partitioning property " + firstDeliveredPartitioning
- + " delivered by previous input operator.");
- }
- UnorderedPartitionedProperty upp2 = new UnorderedPartitionedProperty(modifuppreq,
- requirements.getNodeDomain());
- return new Pair<Boolean, IPartitioningProperty>(false, upp2);
- }
- case ORDERED_PARTITIONED: {
- throw new NotImplementedException();
- }
- }
- }
- return new Pair<Boolean, IPartitioningProperty>(true, requirements);
- }
- };
- break;
- }
- default: {
- throw new IllegalStateException();
- }
- }
-
- return new PhysicalRequirements(pv, prc);
- }
-
- protected abstract List<ILocalStructuralProperty> deliveredLocalProperties(ILogicalOperator op,
- IOptimizationContext context) throws AlgebricksException;
-}
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/physical/AbstractJoinPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractJoinPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractJoinPOperator.java
deleted file mode 100644
index fcc04ab..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractJoinPOperator.java
+++ /dev/null
@@ -1,54 +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.physical;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator.JoinKind;
-
-public abstract class AbstractJoinPOperator extends AbstractPhysicalOperator {
-
- public enum JoinPartitioningType {
- PAIRWISE, BROADCAST
- }
-
- protected final JoinKind kind;
- protected final JoinPartitioningType partitioningType;
-
- public AbstractJoinPOperator(JoinKind kind, JoinPartitioningType partitioningType) {
- this.kind = kind;
- this.partitioningType = partitioningType;
- }
-
- public JoinKind getKind() {
- return kind;
- }
-
- public JoinPartitioningType getPartitioningType() {
- return partitioningType;
- }
-
- @Override
- public Pair<int[], int[]> getInputOutputDependencyLabels(ILogicalOperator op) {
- int[] inputDependencyLabels = new int[] { 1, 0 };
- int[] outputDependencyLabels = new int[] { 1 };
- return new Pair<int[], int[]>(inputDependencyLabels, outputDependencyLabels);
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- 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/physical/AbstractPhysicalOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
deleted file mode 100644
index 66e7b98..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPhysicalOperator.java
+++ /dev/null
@@ -1,157 +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.physical;
-
-import java.util.Map;
-
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint;
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-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.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IPhysicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.ExecutionMode;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-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.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.PlanCompiler;
-import edu.uci.ics.hyracks.algebricks.runtime.base.AlgebricksPipeline;
-import edu.uci.ics.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.OperatorDescriptorId;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public abstract class AbstractPhysicalOperator implements IPhysicalOperator {
-
- protected IPhysicalPropertiesVector deliveredProperties;
- private boolean disableJobGenBelow = false;
- private Object hostQueryContext;
-
- @Override
- public final IPhysicalPropertiesVector getDeliveredProperties() {
- return deliveredProperties;
- }
-
- @Override
- public String toString() {
- return getOperatorTag().toString();
- }
-
- public void setHostQueryContext(Object context) {
- this.hostQueryContext = context;
- }
-
- public Object getHostQueryContext() {
- return hostQueryContext;
- }
-
- protected PhysicalRequirements emptyUnaryRequirements() {
- StructuralPropertiesVector[] req = new StructuralPropertiesVector[] { StructuralPropertiesVector.EMPTY_PROPERTIES_VECTOR };
- return new PhysicalRequirements(req, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- }
-
- protected PhysicalRequirements emptyUnaryRequirements(int numberOfChildren) {
- StructuralPropertiesVector[] req = new StructuralPropertiesVector[numberOfChildren];
- for (int i = 0; i < numberOfChildren; i++) {
- req[i] = StructuralPropertiesVector.EMPTY_PROPERTIES_VECTOR;
- }
- return new PhysicalRequirements(req, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- }
-
- @Override
- public void disableJobGenBelowMe() {
- this.disableJobGenBelow = true;
- }
-
- @Override
- public boolean isJobGenDisabledBelowMe() {
- return disableJobGenBelow;
- }
-
- /**
- * @return labels (0 or 1) for each input and output indicating the dependency between them.
- * The edges labeled as 1 must wait for the edges with label 0.
- */
- @Override
- public Pair<int[], int[]> getInputOutputDependencyLabels(ILogicalOperator op) {
- int[] inputDependencyLabels = new int[op.getInputs().size()]; // filled with 0's
- int[] outputDependencyLabels = new int[] { 0 };
- return new Pair<int[], int[]>(inputDependencyLabels, outputDependencyLabels);
- }
-
- protected void contributeOpDesc(IHyracksJobBuilder builder, AbstractLogicalOperator op, IOperatorDescriptor opDesc) {
- if (op.getExecutionMode() == ExecutionMode.UNPARTITIONED) {
- AlgebricksPartitionConstraint apc = new AlgebricksCountPartitionConstraint(1);
- builder.contributeAlgebricksPartitionConstraint(opDesc, apc);
- }
- builder.contributeHyracksOperator(op, opDesc);
- }
-
- protected AlgebricksPipeline[] compileSubplans(IOperatorSchema outerPlanSchema,
- AbstractOperatorWithNestedPlans npOp, IOperatorSchema opSchema, JobGenContext context)
- throws AlgebricksException {
- AlgebricksPipeline[] subplans = new AlgebricksPipeline[npOp.getNestedPlans().size()];
- PlanCompiler pc = new PlanCompiler(context);
- int i = 0;
- for (ILogicalPlan p : npOp.getNestedPlans()) {
- subplans[i++] = buildPipelineWithProjection(p, outerPlanSchema, npOp, opSchema, pc);
- }
- return subplans;
- }
-
- private AlgebricksPipeline buildPipelineWithProjection(ILogicalPlan p, IOperatorSchema outerPlanSchema,
- AbstractOperatorWithNestedPlans npOp, IOperatorSchema opSchema, PlanCompiler pc) throws AlgebricksException {
- if (p.getRoots().size() > 1) {
- throw new NotImplementedException("Nested plans with several roots are not supported.");
- }
- JobSpecification nestedJob = pc.compilePlan(p, outerPlanSchema, null);
- ILogicalOperator topOpInSubplan = p.getRoots().get(0).getValue();
- JobGenContext context = pc.getContext();
- IOperatorSchema topOpInSubplanScm = context.getSchema(topOpInSubplan);
- opSchema.addAllVariables(topOpInSubplanScm);
-
- Map<OperatorDescriptorId, IOperatorDescriptor> opMap = nestedJob.getOperatorMap();
- if (opMap.size() != 1) {
- throw new AlgebricksException(
- "Attempting to construct a nested plan with "
- + opMap.size()
- + " operator descriptors. Currently, nested plans can only consist in linear pipelines of Asterix micro operators.");
- }
-
- for (OperatorDescriptorId oid : opMap.keySet()) {
- IOperatorDescriptor opd = opMap.get(oid);
- if (!(opd instanceof AlgebricksMetaOperatorDescriptor)) {
- throw new AlgebricksException(
- "Can only generate Hyracks jobs for pipelinable Asterix nested plans, not for "
- + opd.getClass().getName());
- }
- AlgebricksMetaOperatorDescriptor amod = (AlgebricksMetaOperatorDescriptor) opd;
-
- return amod.getPipeline();
- // we suppose that the top operator in the subplan already does the
- // projection for us
- }
-
- throw new IllegalStateException();
- }
-}
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/physical/AbstractPreclusteredGroupByPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPreclusteredGroupByPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPreclusteredGroupByPOperator.java
deleted file mode 100644
index 41711cb..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPreclusteredGroupByPOperator.java
+++ /dev/null
@@ -1,265 +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.physical;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.ListSet;
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-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.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IPhysicalOperator;
-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.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator.ExecutionMode;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.FunctionalDependency;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty.PropertyType;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.LocalOrderProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.OrderColumn;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.PhysicalRequirements;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.PropertiesUtil;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty;
-
-public abstract class AbstractPreclusteredGroupByPOperator extends AbstractPhysicalOperator {
-
- protected List<LogicalVariable> columnList;
-
- public AbstractPreclusteredGroupByPOperator(List<LogicalVariable> columnList) {
- this.columnList = columnList;
- }
-
- @Override
- public String toString() {
- return getOperatorTag().toString() + columnList;
- }
-
- public List<LogicalVariable> getGbyColumns() {
- return columnList;
- }
-
- public void setGbyColumns(List<LogicalVariable> gByColumns) {
- this.columnList = gByColumns;
- }
-
- // Obs: We don't propagate properties corresponding to decors, since they
- // are func. dep. on the group-by variables.
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- List<ILocalStructuralProperty> propsLocal = new LinkedList<ILocalStructuralProperty>();
- GroupByOperator gby = (GroupByOperator) op;
- ILogicalOperator op2 = gby.getInputs().get(0).getValue();
- IPhysicalPropertiesVector childProp = op2.getDeliveredPhysicalProperties();
- IPartitioningProperty pp = childProp.getPartitioningProperty();
- List<ILocalStructuralProperty> childLocals = childProp.getLocalProperties();
- if (childLocals != null) {
- for (ILocalStructuralProperty lsp : childLocals) {
- boolean failed = false;
- switch (lsp.getPropertyType()) {
- case LOCAL_GROUPING_PROPERTY: {
- LocalGroupingProperty lgp = (LocalGroupingProperty) lsp;
- Set<LogicalVariable> colSet = new ListSet<LogicalVariable>();
- for (LogicalVariable v : lgp.getColumnSet()) {
- LogicalVariable v2 = getLhsGbyVar(gby, v);
- if (v2 != null) {
- colSet.add(v2);
- } else {
- failed = true;
- }
- }
- if (!failed) {
- propsLocal.add(new LocalGroupingProperty(colSet));
- }
- break;
- }
- case LOCAL_ORDER_PROPERTY: {
- LocalOrderProperty lop = (LocalOrderProperty) lsp;
- List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
- for (OrderColumn oc : lop.getOrderColumns()) {
- LogicalVariable v2 = getLhsGbyVar(gby, oc.getColumn());
- if (v2 != null) {
- orderColumns.add(new OrderColumn(v2, oc.getOrder()));
- } else {
- failed = true;
- }
- }
- if (!failed) {
- propsLocal.add(new LocalOrderProperty(orderColumns));
- }
- break;
- }
- default: {
- throw new IllegalStateException();
- }
- }
- if (failed) {
- break;
- }
- }
- }
- deliveredProperties = new StructuralPropertiesVector(pp, propsLocal);
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
- List<ILocalStructuralProperty> localProps = null;
-
- localProps = new ArrayList<ILocalStructuralProperty>(1);
- Set<LogicalVariable> gbvars = new ListSet<LogicalVariable>(columnList);
- LocalGroupingProperty groupProp = new LocalGroupingProperty(gbvars, new ArrayList<LogicalVariable>(columnList));
-
- GroupByOperator gby = (GroupByOperator) op;
- boolean goon = true;
- for (ILogicalPlan p : gby.getNestedPlans()) {
- // try to propagate secondary order requirements from nested
- // groupings
- for (Mutable<ILogicalOperator> r : p.getRoots()) {
- AbstractLogicalOperator op1 = (AbstractLogicalOperator) r.getValue();
- if (op1.getOperatorTag() == LogicalOperatorTag.AGGREGATE) {
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op1.getInputs().get(0).getValue();
- IPhysicalOperator pop2 = op2.getPhysicalOperator();
- if (pop2 instanceof AbstractPreclusteredGroupByPOperator) {
- List<LogicalVariable> sndOrder = ((AbstractPreclusteredGroupByPOperator) pop2).getGbyColumns();
- groupProp.getColumnSet().addAll(sndOrder);
- groupProp.getPreferredOrderEnforcer().addAll(sndOrder);
- goon = false;
- break;
- }
- }
- }
- if (!goon) {
- break;
- }
- }
-
- localProps.add(groupProp);
-
- if (reqdByParent != null) {
- // propagate parent requirements
- List<ILocalStructuralProperty> lpPar = reqdByParent.getLocalProperties();
- if (lpPar != null) {
- boolean allOk = true;
- List<ILocalStructuralProperty> props = new ArrayList<ILocalStructuralProperty>(lpPar.size());
- for (ILocalStructuralProperty prop : lpPar) {
- if (prop.getPropertyType() != PropertyType.LOCAL_ORDER_PROPERTY) {
- allOk = false;
- break;
- }
- LocalOrderProperty lop = (LocalOrderProperty) prop;
- List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
- List<OrderColumn> ords = lop.getOrderColumns();
- for (OrderColumn ord : ords) {
- Pair<LogicalVariable, Mutable<ILogicalExpression>> p = getGbyPairByRhsVar(gby, ord.getColumn());
- if (p == null) {
- p = getDecorPairByRhsVar(gby, ord.getColumn());
- if (p == null) {
- allOk = false;
- break;
- }
- }
- ILogicalExpression e = p.second.getValue();
- if (e.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
- throw new IllegalStateException(
- "Right hand side of group-by assignment should have been normalized to a variable reference.");
- }
- LogicalVariable v = ((VariableReferenceExpression) e).getVariableReference();
- orderColumns.add(new OrderColumn(v, ord.getOrder()));
- }
- props.add(new LocalOrderProperty(orderColumns));
- }
- List<FunctionalDependency> fdList = new ArrayList<FunctionalDependency>();
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> decorPair : gby.getDecorList()) {
- List<LogicalVariable> hd = gby.getGbyVarList();
- List<LogicalVariable> tl = new ArrayList<LogicalVariable>(1);
- tl.add(((VariableReferenceExpression) decorPair.second.getValue()).getVariableReference());
- fdList.add(new FunctionalDependency(hd, tl));
- }
- if (allOk
- && PropertiesUtil.matchLocalProperties(localProps, props,
- new HashMap<LogicalVariable, EquivalenceClass>(), fdList)) {
- localProps = props;
- }
- }
- }
-
- IPartitioningProperty pp = null;
- AbstractLogicalOperator aop = (AbstractLogicalOperator) op;
- if (aop.getExecutionMode() == ExecutionMode.PARTITIONED) {
- pp = new UnorderedPartitionedProperty(new ListSet<LogicalVariable>(columnList), null);
- }
- pv[0] = new StructuralPropertiesVector(pp, localProps);
- return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- }
-
- private static Pair<LogicalVariable, Mutable<ILogicalExpression>> getGbyPairByRhsVar(GroupByOperator gby,
- LogicalVariable var) {
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : gby.getGroupByList()) {
- if (ve.first == var) {
- return ve;
- }
- }
- return null;
- }
-
- private static Pair<LogicalVariable, Mutable<ILogicalExpression>> getDecorPairByRhsVar(GroupByOperator gby,
- LogicalVariable var) {
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : gby.getDecorList()) {
- if (ve.first == var) {
- return ve;
- }
- }
- return null;
- }
-
- private static LogicalVariable getLhsGbyVar(GroupByOperator gby, LogicalVariable var) {
- for (Pair<LogicalVariable, Mutable<ILogicalExpression>> ve : gby.getGroupByList()) {
- ILogicalExpression e = ve.second.getValue();
- if (e.getExpressionTag() != LogicalExpressionTag.VARIABLE) {
- throw new IllegalStateException(
- "Right hand side of group by assignment should have been normalized to a variable reference.");
- }
- LogicalVariable v = ((VariableReferenceExpression) e).getVariableReference();
- if (v == var) {
- return ve.first;
- }
- }
- return null;
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- 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/physical/AbstractPropagatePropertiesForUsedVariablesPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPropagatePropertiesForUsedVariablesPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPropagatePropertiesForUsedVariablesPOperator.java
deleted file mode 100644
index c77222b..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractPropagatePropertiesForUsedVariablesPOperator.java
+++ /dev/null
@@ -1,44 +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.physical;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
-
-public abstract class AbstractPropagatePropertiesForUsedVariablesPOperator extends AbstractPhysicalOperator {
-
- public void computeDeliveredPropertiesForUsedVariables(ILogicalOperator op, List<LogicalVariable> usedVariables) {
- ILogicalOperator op2 = op.getInputs().get(0).getValue();
- IPartitioningProperty pp = op2.getDeliveredPhysicalProperties().getPartitioningProperty();
- List<ILocalStructuralProperty> downPropsLocal = op2.getDeliveredPhysicalProperties().getLocalProperties();
- List<ILocalStructuralProperty> propsLocal = new ArrayList<ILocalStructuralProperty>();
- for (ILocalStructuralProperty lsp : downPropsLocal) {
- LinkedList<LogicalVariable> cols = new LinkedList<LogicalVariable>();
- lsp.getColumns(cols);
- ILocalStructuralProperty propagatedProp = lsp.retainVariables(usedVariables);
- if (propagatedProp != null) {
- propsLocal.add(propagatedProp);
- }
- }
- deliveredProperties = new StructuralPropertiesVector(pp, propsLocal);
- }
-}
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/physical/AbstractScanPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractScanPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractScanPOperator.java
deleted file mode 100644
index 299f519..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractScanPOperator.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.physical;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.PhysicalRequirements;
-
-public abstract class AbstractScanPOperator extends AbstractPhysicalOperator {
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- return emptyUnaryRequirements();
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- return false;
- }
-}
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/physical/AbstractStableSortPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractStableSortPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractStableSortPOperator.java
deleted file mode 100644
index 4b85c56..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AbstractStableSortPOperator.java
+++ /dev/null
@@ -1,123 +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.physical;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-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.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator.IOrder;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.LocalOrderProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.OrderColumn;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.PhysicalRequirements;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector;
-
-public abstract class AbstractStableSortPOperator extends AbstractPhysicalOperator {
-
- protected OrderColumn[] sortColumns;
- protected ILocalStructuralProperty orderProp;
-
- public AbstractStableSortPOperator() {
- }
-
- public OrderColumn[] getSortColumns() {
- return sortColumns;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- // if (orderProps == null) { // to do caching, we need some mechanism to
- // invalidate cache
- computeLocalProperties(op);
- // }
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- StructuralPropertiesVector childProp = (StructuralPropertiesVector) op2.getDeliveredPhysicalProperties();
- deliveredProperties = new StructuralPropertiesVector(childProp.getPartitioningProperty(),
- Collections.singletonList(orderProp));
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator iop,
- IPhysicalPropertiesVector reqdByParent) {
- AbstractLogicalOperator op = (AbstractLogicalOperator) iop;
- if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.PARTITIONED) {
- if (orderProp == null) {
- computeLocalProperties(op);
- }
- StructuralPropertiesVector[] r = new StructuralPropertiesVector[] { new StructuralPropertiesVector(
- IPartitioningProperty.UNPARTITIONED, Collections.singletonList(orderProp)) };
- return new PhysicalRequirements(r, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- } else {
- return emptyUnaryRequirements();
- }
- }
-
- public void computeLocalProperties(ILogicalOperator op) {
- OrderOperator ord = (OrderOperator) op;
- List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
- for (Pair<IOrder, Mutable<ILogicalExpression>> p : ord.getOrderExpressions()) {
- ILogicalExpression expr = p.second.getValue();
- if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
- VariableReferenceExpression varRef = (VariableReferenceExpression) expr;
- LogicalVariable var = varRef.getVariableReference();
- orderColumns.add(new OrderColumn(var, p.first.getKind()));
- } else {
- throw new IllegalStateException();
- }
- }
- sortColumns = orderColumns.toArray(new OrderColumn[orderColumns.size()]);
- orderProp = new LocalOrderProperty(orderColumns);
- }
-
- public ILocalStructuralProperty getOrderProperty() {
- return orderProp;
- }
-
- @Override
- public String toString() {
- if (orderProp == null) {
- return getOperatorTag().toString();
- } else {
- return getOperatorTag().toString() + " " + orderProp;
- }
- }
-
- @Override
- public Pair<int[], int[]> getInputOutputDependencyLabels(ILogicalOperator op) {
- int[] inputDependencyLabels = new int[] { 0 };
- int[] outputDependencyLabels = new int[] { 1 };
- return new Pair<int[], int[]>(inputDependencyLabels, outputDependencyLabels);
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- 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/physical/AggregatePOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AggregatePOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AggregatePOperator.java
deleted file mode 100644
index 8b1b447..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AggregatePOperator.java
+++ /dev/null
@@ -1,121 +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.physical;
-
-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.IHyracksJobBuilder;
-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.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-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.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenHelper;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.operators.aggreg.AggregateRuntimeFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
-
-public class AggregatePOperator extends AbstractPhysicalOperator {
-
- public AggregatePOperator() {
- }
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.AGGREGATE;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- AggregateOperator aggOp = (AggregateOperator) op;
- ILogicalOperator op2 = op.getInputs().get(0).getValue();
- if (aggOp.getExecutionMode() != AbstractLogicalOperator.ExecutionMode.UNPARTITIONED) {
- deliveredProperties = new StructuralPropertiesVector(op2.getDeliveredPhysicalProperties()
- .getPartitioningProperty(), new ArrayList<ILocalStructuralProperty>());
- } else {
- deliveredProperties = new StructuralPropertiesVector(IPartitioningProperty.UNPARTITIONED,
- new ArrayList<ILocalStructuralProperty>());
- }
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- AggregateOperator aggOp = (AggregateOperator) op;
- StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
- if (aggOp.isGlobal() && aggOp.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.UNPARTITIONED) {
- pv[0] = new StructuralPropertiesVector(IPartitioningProperty.UNPARTITIONED, null);
- return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- } else {
- return emptyUnaryRequirements();
- }
-
- }
-
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- AggregateOperator aggOp = (AggregateOperator) op;
- List<LogicalVariable> variables = aggOp.getVariables();
- List<Mutable<ILogicalExpression>> expressions = aggOp.getExpressions();
- int[] outColumns = new int[variables.size()];
- for (int i = 0; i < outColumns.length; i++) {
- outColumns[i] = opSchema.findVariable(variables.get(i));
- }
- IAggregateEvaluatorFactory[] aggFactories = new IAggregateEvaluatorFactory[expressions.size()];
- IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider();
- for (int i = 0; i < aggFactories.length; i++) {
- AggregateFunctionCallExpression aggFun = (AggregateFunctionCallExpression) expressions.get(i).getValue();
- aggFactories[i] = expressionRuntimeProvider.createAggregateFunctionFactory(aggFun,
- context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context);
- }
-
- AggregateRuntimeFactory runtime = new AggregateRuntimeFactory(aggFactories);
-
- // contribute one Asterix framewriter
- RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
- builder.contributeMicroOperator(aggOp, runtime, recDesc);
- // and contribute one edge from its child
- ILogicalOperator src = aggOp.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, aggOp, 0);
- }
-
- @Override
- public boolean isMicroOperator() {
- return true;
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- 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/physical/AssignPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AssignPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AssignPOperator.java
deleted file mode 100644
index 0a67ced..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/AssignPOperator.java
+++ /dev/null
@@ -1,123 +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.physical;
-
-import java.util.List;
-
-import org.apache.commons.lang3.mutable.Mutable;
-
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksCountPartitionConstraint;
-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.ILogicalExpression;
-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.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-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.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenHelper;
-import edu.uci.ics.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.operators.std.AssignRuntimeFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
-
-public class AssignPOperator extends AbstractPhysicalOperator {
-
- private boolean flushFramesRapidly;
- private int cardinalityConstraint = 0;
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.ASSIGN;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- AssignOperator assignOp = (AssignOperator) op;
- ILogicalOperator op2 = op.getInputs().get(0).getValue();
- deliveredProperties = op2.getDeliveredPhysicalProperties().clone();
- if (assignOp.getExplicitOrderingProperty() != null) {
- deliveredProperties.getLocalProperties().add(assignOp.getExplicitOrderingProperty());
- }
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- return emptyUnaryRequirements();
- }
-
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- AssignOperator assign = (AssignOperator) op;
- List<LogicalVariable> variables = assign.getVariables();
- List<Mutable<ILogicalExpression>> expressions = assign.getExpressions();
- int[] outColumns = new int[variables.size()];
- for (int i = 0; i < outColumns.length; i++) {
- outColumns[i] = opSchema.findVariable(variables.get(i));
- }
- IScalarEvaluatorFactory[] evalFactories = new IScalarEvaluatorFactory[expressions.size()];
- IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider();
- for (int i = 0; i < evalFactories.length; i++) {
- evalFactories[i] = expressionRuntimeProvider.createEvaluatorFactory(expressions.get(i).getValue(),
- context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context);
- }
-
- // TODO push projections into the operator
- int[] projectionList = JobGenHelper.projectAllVariables(opSchema);
-
- AssignRuntimeFactory runtime = new AssignRuntimeFactory(outColumns, evalFactories, projectionList,
- flushFramesRapidly);
-
- // contribute one Asterix framewriter
- RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
- if (cardinalityConstraint > 0) {
- AlgebricksCountPartitionConstraint countConstraint = new AlgebricksCountPartitionConstraint(
- cardinalityConstraint);
- builder.contributeMicroOperator(assign, runtime, recDesc, countConstraint);
- } else {
- builder.contributeMicroOperator(assign, runtime, recDesc);
- }
- // and contribute one edge from its child
- ILogicalOperator src = assign.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, assign, 0);
-
- }
-
- @Override
- public boolean isMicroOperator() {
- return true;
- }
-
- public void setRapidFrameFlush(boolean flushFramesRapidly) {
- this.flushFramesRapidly = flushFramesRapidly;
- }
-
- public void setCardinalityConstraint(int cardinality) {
- this.cardinalityConstraint = cardinality;
- }
-
-
- @Override
- public boolean expensiveThanMaterialization() {
- return false;
- }
-}
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/physical/BroadcastPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BroadcastPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BroadcastPOperator.java
deleted file mode 100644
index b210d56..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BroadcastPOperator.java
+++ /dev/null
@@ -1,70 +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.physical;
-
-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.IHyracksJobBuilder.TargetConstraint;
-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.PhysicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.BroadcastPartitioningProperty;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.INodeDomain;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningProperty;
-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.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.api.dataflow.IConnectorDescriptor;
-import edu.uci.ics.hyracks.api.job.IConnectorDescriptorRegistry;
-import edu.uci.ics.hyracks.dataflow.std.connectors.MToNReplicatingConnectorDescriptor;
-
-public class BroadcastPOperator extends AbstractExchangePOperator {
-
- private INodeDomain domain;
-
- public BroadcastPOperator(INodeDomain domain) {
- this.domain = domain;
- }
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.BROADCAST_EXCHANGE;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- IPartitioningProperty pp = new BroadcastPartitioningProperty(domain);
- this.deliveredProperties = new StructuralPropertiesVector(pp, op2.getDeliveredPhysicalProperties()
- .getLocalProperties());
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- return emptyUnaryRequirements();
- }
-
- @Override
- public Pair<IConnectorDescriptor, TargetConstraint> createConnectorDescriptor(IConnectorDescriptorRegistry spec,
- ILogicalOperator op, IOperatorSchema opSchema, JobGenContext context) throws AlgebricksException {
- IConnectorDescriptor conn = new MToNReplicatingConnectorDescriptor(spec);
- return new Pair<IConnectorDescriptor, TargetConstraint>(conn, null);
- }
-
-}
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/physical/BulkloadPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BulkloadPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BulkloadPOperator.java
deleted file mode 100644
index 23652f6..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/BulkloadPOperator.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.physical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
-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.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.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
-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.IMetadataProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteOperator.Kind;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.IPartitioningRequirementsCoordinator;
-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.StructuralPropertiesVector;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenHelper;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public class BulkloadPOperator extends AbstractPhysicalOperator {
-
- private final LogicalVariable payload;
- private final List<LogicalVariable> primaryKeys;
- private final List<LogicalVariable> additionalFilteringKeys;
- private final IDataSource<?> dataSource;
-
- public BulkloadPOperator(LogicalVariable payload, List<LogicalVariable> keys,
- List<LogicalVariable> additionalFilteringKeys, IDataSource<?> dataSource) {
- this.payload = payload;
- this.primaryKeys = keys;
- this.additionalFilteringKeys = additionalFilteringKeys;
- this.dataSource = dataSource;
- }
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.BULKLOAD;
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- List<LogicalVariable> scanVariables = new ArrayList<>();
- scanVariables.addAll(primaryKeys);
- scanVariables.add(new LogicalVariable(-1));
- IPhysicalPropertiesVector physicalProps = dataSource.getPropertiesProvider().computePropertiesVector(
- scanVariables);
- StructuralPropertiesVector spv = new StructuralPropertiesVector(physicalProps.getPartitioningProperty(),
- physicalProps.getLocalProperties());
- return new PhysicalRequirements(new IPhysicalPropertiesVector[] { spv },
- IPartitioningRequirementsCoordinator.NO_COORDINATION);
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context)
- throws AlgebricksException {
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- deliveredProperties = (StructuralPropertiesVector) op2.getDeliveredPhysicalProperties().clone();
- }
-
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- InsertDeleteOperator insertDeleteOp = (InsertDeleteOperator) op;
- assert insertDeleteOp.getOperation() == Kind.INSERT;
- assert insertDeleteOp.isBulkload();
-
- IMetadataProvider mp = context.getMetadataProvider();
- IVariableTypeEnvironment typeEnv = context.getTypeEnvironment(op);
- JobSpecification spec = builder.getJobSpec();
- RecordDescriptor inputDesc = JobGenHelper.mkRecordDescriptor(
- context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas[0], context);
- Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> runtimeAndConstraints = mp.getInsertRuntime(
- dataSource, propagatedSchema, typeEnv, primaryKeys, payload, additionalFilteringKeys,
- inputDesc, context, spec, true);
- builder.contributeHyracksOperator(insertDeleteOp, runtimeAndConstraints.first);
- builder.contributeAlgebricksPartitionConstraint(runtimeAndConstraints.first, runtimeAndConstraints.second);
- ILogicalOperator src = insertDeleteOp.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, insertDeleteOp, 0);
- }
-
- @Override
- public boolean isMicroOperator() {
- return false;
- }
-
- @Override
- public boolean expensiveThanMaterialization() {
- return false;
- }
-
-
-}
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/physical/DataSourceScanPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/DataSourceScanPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/DataSourceScanPOperator.java
deleted file mode 100644
index f1cb937..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/DataSourceScanPOperator.java
+++ /dev/null
@@ -1,94 +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.physical;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
-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.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.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
-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.IDataSourcePropertiesProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-
-@SuppressWarnings("rawtypes")
-public class DataSourceScanPOperator extends AbstractScanPOperator {
-
- private IDataSource<?> dataSource;
- private Object implConfig;
-
- public DataSourceScanPOperator(IDataSource<?> dataSource) {
- this.dataSource = dataSource;
- }
-
- public void setImplConfig(Object implConfig) {
- this.implConfig = implConfig;
- }
-
- public Object getImplConfig() {
- return implConfig;
- }
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.DATASOURCE_SCAN;
- }
-
- @Override
- public boolean isMicroOperator() {
- return false;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- // partitioning properties
- DataSourceScanOperator dssOp = (DataSourceScanOperator) op;
- IDataSourcePropertiesProvider dspp = dataSource.getPropertiesProvider();
- deliveredProperties = dspp.computePropertiesVector(dssOp.getVariables());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- DataSourceScanOperator scan = (DataSourceScanOperator) op;
- IMetadataProvider mp = context.getMetadataProvider();
- IVariableTypeEnvironment typeEnv = context.getTypeEnvironment(op);
- List<LogicalVariable> vars = scan.getVariables();
- List<LogicalVariable> projectVars = scan.getProjectVariables();
-
- Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> p = mp.getScannerRuntime(dataSource, vars,
- projectVars, scan.isProjectPushed(), scan.getMinFilterVars(), scan.getMaxFilterVars(), opSchema,
- typeEnv, context, builder.getJobSpec(), implConfig);
- builder.contributeHyracksOperator(scan, p.first);
- if (p.second != null) {
- builder.contributeAlgebricksPartitionConstraint(p.first, p.second);
- }
-
- ILogicalOperator srcExchange = scan.getInputs().get(0).getValue();
- builder.contributeGraphEdge(srcExchange, 0, scan, 0);
- }
-}