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:51 UTC
[38/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/physical/UnnestPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/UnnestPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/UnnestPOperator.java
deleted file mode 100644
index d60d4f7..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/UnnestPOperator.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.physical;
-
-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.LogicalExpressionTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.PhysicalOperatorTag;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression.FunctionKind;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
-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.UnnestOperator;
-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.base.IUnnestingEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.operators.std.UnnestRuntimeFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.RecordDescriptor;
-
-public class UnnestPOperator extends AbstractScanPOperator {
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.UNNEST;
- }
-
- @Override
- public boolean isMicroOperator() {
- return true;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- deliveredProperties = op2.getDeliveredPhysicalProperties().clone();
- }
-
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- UnnestOperator unnest = (UnnestOperator) op;
-
- int outCol = opSchema.findVariable(unnest.getVariable());
- ILogicalExpression unnestExpr = unnest.getExpressionRef().getValue();
- IExpressionRuntimeProvider expressionRuntimeProvider = context.getExpressionRuntimeProvider();
- boolean exit = false;
- if (unnestExpr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
- exit = true;
- } else {
- AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) unnestExpr;
- if (fce.getKind() != FunctionKind.UNNEST) {
- exit = true;
- }
- }
- if (exit) {
- throw new AlgebricksException("Unnest expression " + unnestExpr + " is not an unnesting function call.");
- }
- UnnestingFunctionCallExpression agg = (UnnestingFunctionCallExpression) unnestExpr;
- IUnnestingEvaluatorFactory unnestingFactory = expressionRuntimeProvider.createUnnestingFunctionFactory(agg,
- context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context);
-
- // for position offset
- ILogicalExpression posOffsetExpr = unnest.getPositionOffsetExpr();
- IScalarEvaluatorFactory posOffsetExprEvalFactory = null;
- if (posOffsetExpr != null) {
- posOffsetExprEvalFactory = expressionRuntimeProvider.createEvaluatorFactory(posOffsetExpr,
- context.getTypeEnvironment(op.getInputs().get(0).getValue()), inputSchemas, context);
- }
-
- int[] projectionList = JobGenHelper.projectAllVariables(opSchema);
- UnnestRuntimeFactory unnestRuntime = new UnnestRuntimeFactory(outCol, unnestingFactory, projectionList,
- unnest.getPositionWriter(), posOffsetExprEvalFactory);
- RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
- builder.contributeMicroOperator(unnest, unnestRuntime, recDesc);
- ILogicalOperator src = unnest.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, unnest, 0);
- }
-}
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/WriteResultPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/WriteResultPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/WriteResultPOperator.java
deleted file mode 100644
index f399184..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/WriteResultPOperator.java
+++ /dev/null
@@ -1,111 +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.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.WriteResultOperator;
-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.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public class WriteResultPOperator extends AbstractPhysicalOperator {
-
- private LogicalVariable payload;
- private List<LogicalVariable> keys;
- private IDataSource<?> dataSource;
- private final List<LogicalVariable> additionalFilteringKeys;
-
- public WriteResultPOperator(IDataSource<?> dataSource, LogicalVariable payload, List<LogicalVariable> keys,
- List<LogicalVariable> additionalFilteringKeys) {
- this.dataSource = dataSource;
- this.payload = payload;
- this.keys = keys;
- this.additionalFilteringKeys = additionalFilteringKeys;
- }
-
- @Override
- public String toString() {
- return getOperatorTag().toString() + " " + payload + " " + keys;
- }
-
- @Override
- public PhysicalOperatorTag getOperatorTag() {
- return PhysicalOperatorTag.WRITE_RESULT;
- }
-
- @Override
- public boolean isMicroOperator() {
- return true;
- }
-
- @Override
- public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
- AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
- deliveredProperties = (StructuralPropertiesVector) op2.getDeliveredPhysicalProperties().clone();
- }
-
- @Override
- public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op,
- IPhysicalPropertiesVector reqdByParent) {
- List<LogicalVariable> scanVariables = new ArrayList<LogicalVariable>();
- scanVariables.addAll(keys);
- scanVariables.add(new LogicalVariable(-1));
- IPhysicalPropertiesVector r = dataSource.getPropertiesProvider().computePropertiesVector(scanVariables);
- IPhysicalPropertiesVector[] requirements = new IPhysicalPropertiesVector[1];
- requirements[0] = r;
- return new PhysicalRequirements(requirements, IPartitioningRequirementsCoordinator.NO_COORDINATION);
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
- IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
- throws AlgebricksException {
- WriteResultOperator writeResultOp = (WriteResultOperator) op;
- IMetadataProvider mp = context.getMetadataProvider();
-
- JobSpecification spec = builder.getJobSpec();
- Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> runtimeAndConstraints = mp.getWriteResultRuntime(
- dataSource, propagatedSchema, keys, payload, additionalFilteringKeys, context, spec);
-
- builder.contributeHyracksOperator(writeResultOp, runtimeAndConstraints.first);
- builder.contributeAlgebricksPartitionConstraint(runtimeAndConstraints.first, runtimeAndConstraints.second);
- ILogicalOperator src = writeResultOp.getInputs().get(0).getValue();
- builder.contributeGraphEdge(src, 0, writeResultOp, 0);
- }
-
- @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/plan/ALogicalPlanImpl.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/plan/ALogicalPlanImpl.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/plan/ALogicalPlanImpl.java
deleted file mode 100644
index 8048bf1..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/plan/ALogicalPlanImpl.java
+++ /dev/null
@@ -1,52 +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.plan;
-
-import java.util.ArrayList;
-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;
-
-/*
- * Author: Guangqiang Li
- * Created on Jul 9, 2009
- */
-public class ALogicalPlanImpl implements ILogicalPlan {
- private List<Mutable<ILogicalOperator>> roots;
-
- public ALogicalPlanImpl() {
- this.roots = new ArrayList<Mutable<ILogicalOperator>>();
- }
-
- public ALogicalPlanImpl(List<Mutable<ILogicalOperator>> roots) {
- this.roots = roots;
- }
-
- public ALogicalPlanImpl(Mutable<ILogicalOperator> root) {
- roots = new ArrayList<Mutable<ILogicalOperator>>(1);
- roots.add(root);
- }
-
- public List<Mutable<ILogicalOperator>> getRoots() {
- return roots;
- }
-
- public void setRoots(List<Mutable<ILogicalOperator>> roots) {
- this.roots = roots;
- }
-}
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/prettyprint/LogicalExpressionPrettyPrintVisitor.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalExpressionPrettyPrintVisitor.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalExpressionPrettyPrintVisitor.java
deleted file mode 100644
index 5f77352..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalExpressionPrettyPrintVisitor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 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.prettyprint;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.StatefulFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionVisitor;
-
-
-public class LogicalExpressionPrettyPrintVisitor implements ILogicalExpressionVisitor<String, Integer> {
-
- @Override
- public String visitConstantExpression(ConstantExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-
- @Override
- public String visitVariableReferenceExpression(
- VariableReferenceExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-
- @Override
- public String visitAggregateFunctionCallExpression(
- AggregateFunctionCallExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-
- @Override
- public String visitScalarFunctionCallExpression(
- ScalarFunctionCallExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-
- @Override
- public String visitStatefulFunctionCallExpression(
- StatefulFunctionCallExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-
- @Override
- public String visitUnnestingFunctionCallExpression(
- UnnestingFunctionCallExpression expr, Integer indent)
- throws AlgebricksException {
- return expr.toString();
- }
-}
-
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/prettyprint/LogicalOperatorPrettyPrintVisitor.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
deleted file mode 100644
index 2c924d5..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
+++ /dev/null
@@ -1,431 +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.prettyprint;
-
-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.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.common.utils.Triple;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractOperatorWithNestedPlans;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DataSourceScanOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DistinctOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.DistributeResultOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.EmptyTupleSourceOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ExchangeOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ExtensionOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ExternalDataLookupOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IndexInsertDeleteOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator;
-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.operators.logical.LeftOuterJoinOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.LimitOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.MaterializeOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.PartitioningSplitOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ProjectOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ReplicateOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.RunningAggregateOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.ScriptOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SelectOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SinkOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.SubplanOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.TokenizeOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnionAllOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestMapOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.WriteOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.WriteResultOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalExpressionVisitor;
-import edu.uci.ics.hyracks.algebricks.core.algebra.visitors.ILogicalOperatorVisitor;
-
-public class LogicalOperatorPrettyPrintVisitor implements ILogicalOperatorVisitor<String, Integer> {
-
- ILogicalExpressionVisitor<String, Integer> exprVisitor;
-
- public LogicalOperatorPrettyPrintVisitor() {
- exprVisitor = new LogicalExpressionPrettyPrintVisitor();
- }
-
- public LogicalOperatorPrettyPrintVisitor(ILogicalExpressionVisitor<String, Integer> exprVisitor) {
- this.exprVisitor = exprVisitor;
- }
-
- @Override
- public String visitAggregateOperator(AggregateOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("aggregate ").append(op.getVariables()).append(" <- ");
- pprintExprList(op.getExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitRunningAggregateOperator(RunningAggregateOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("running-aggregate ").append(op.getVariables()).append(" <- ");
- pprintExprList(op.getExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitEmptyTupleSourceOperator(EmptyTupleSourceOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("empty-tuple-source");
- return buffer.toString();
- }
-
- @Override
- public String visitGroupByOperator(GroupByOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("group by (");
- pprintVeList(buffer, op.getGroupByList(), indent);
- buffer.append(") decor (");
- pprintVeList(buffer, op.getDecorList(), indent);
- buffer.append(") {");
- printNestedPlans(op, indent, buffer);
- return buffer.toString();
- }
-
- @Override
- public String visitDistinctOperator(DistinctOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("distinct " + "(");
- pprintExprList(op.getExpressions(), buffer, indent);
- buffer.append(")");
- return buffer.toString();
- }
-
- @Override
- public String visitInnerJoinOperator(InnerJoinOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("join (").append(op.getCondition().getValue().accept(exprVisitor, indent))
- .append(")");
- return buffer.toString();
- }
-
- @Override
- public String visitLeftOuterJoinOperator(LeftOuterJoinOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("left outer join (")
- .append(op.getCondition().getValue().accept(exprVisitor, indent)).append(")");
- return buffer.toString();
- }
-
- @Override
- public String visitNestedTupleSourceOperator(NestedTupleSourceOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("nested tuple source");
- return buffer.toString();
- }
-
- @Override
- public String visitOrderOperator(OrderOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("order ");
- for (Pair<OrderOperator.IOrder, Mutable<ILogicalExpression>> p : op.getOrderExpressions()) {
- String fst;
- switch (p.first.getKind()) {
- case ASC: {
- fst = "ASC";
- break;
- }
- case DESC: {
- fst = "DESC";
- break;
- }
- default: {
- fst = p.first.getExpressionRef().toString();
- }
- }
- buffer.append("(" + fst + ", " + p.second.getValue().accept(exprVisitor, indent) + ") ");
- }
- return buffer.toString();
- }
-
- @Override
- public String visitAssignOperator(AssignOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("assign ").append(op.getVariables()).append(" <- ");
- pprintExprList(op.getExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitWriteOperator(WriteOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("write ");
- pprintExprList(op.getExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitDistributeResultOperator(DistributeResultOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("distribute result ");
- pprintExprList(op.getExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitWriteResultOperator(WriteResultOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("load ").append(op.getDataSource()).append(" from ")
- .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent)).append(" partitioned by ");
- pprintExprList(op.getKeyExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitSelectOperator(SelectOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("select (").append(op.getCondition().getValue().accept(exprVisitor, indent))
- .append(")");
- return buffer.toString();
- }
-
- @Override
- public String visitProjectOperator(ProjectOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("project " + "(" + op.getVariables() + ")");
- return buffer.toString();
- }
-
- @Override
- public String visitPartitioningSplitOperator(PartitioningSplitOperator op, Integer indent)
- throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("partitioning-split (");
- pprintExprList(op.getExpressions(), buffer, indent);
- buffer.append(")");
- return buffer.toString();
- }
-
- @Override
- public String visitSubplanOperator(SubplanOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("subplan {");
- printNestedPlans(op, indent, buffer);
- return buffer.toString();
- }
-
- @Override
- public String visitUnionOperator(UnionAllOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("union");
- for (Triple<LogicalVariable, LogicalVariable, LogicalVariable> v : op.getVariableMappings()) {
- buffer.append(" (" + v.first + ", " + v.second + ", " + v.third + ")");
- }
- return buffer.toString();
- }
-
- @Override
- public String visitUnnestOperator(UnnestOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("unnest " + op.getVariable());
- if (op.getPositionalVariable() != null) {
- buffer.append(" at " + op.getPositionalVariable());
- }
- buffer.append(" <- " + op.getExpressionRef().getValue().accept(exprVisitor, indent));
- return buffer.toString();
- }
-
- @Override
- public String visitUnnestMapOperator(UnnestMapOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append(
- "unnest-map " + op.getVariables() + " <- "
- + op.getExpressionRef().getValue().accept(exprVisitor, indent));
- return buffer.toString();
- }
-
- @Override
- public String visitDataScanOperator(DataSourceScanOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append(
- "data-scan " + op.getProjectVariables() + "<-" + op.getVariables() + " <- " + op.getDataSource());
- return buffer.toString();
- }
-
- @Override
- public String visitLimitOperator(LimitOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("limit " + op.getMaxObjects().getValue().accept(exprVisitor, indent));
- ILogicalExpression offset = op.getOffset().getValue();
- if (offset != null) {
- buffer.append(", " + offset.accept(exprVisitor, indent));
- }
- return buffer.toString();
- }
-
- @Override
- public String visitExchangeOperator(ExchangeOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("exchange ");
- return buffer.toString();
- }
-
- @Override
- public String visitScriptOperator(ScriptOperator op, Integer indent) {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append(
- "script (in: " + op.getInputVariables() + ") (out: " + op.getOutputVariables() + ")");
- return buffer.toString();
- }
-
- @Override
- public String visitReplicateOperator(ReplicateOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("replicate ");
- return buffer.toString();
- }
-
- @Override
- public String visitMaterializeOperator(MaterializeOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("materialize ");
- return buffer.toString();
- }
-
- @Override
- public String visitInsertDeleteOperator(InsertDeleteOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- String header = op.getOperation() == Kind.INSERT ? "insert into " : "delete from ";
- addIndent(buffer, indent).append(header).append(op.getDataSource()).append(" from ")
- .append(op.getPayloadExpression().getValue().accept(exprVisitor, indent)).append(" partitioned by ");
- pprintExprList(op.getPrimaryKeyExpressions(), buffer, indent);
- if (op.isBulkload()) {
- buffer.append(" [bulkload]");
- }
- return buffer.toString();
- }
-
- @Override
- public String visitIndexInsertDeleteOperator(IndexInsertDeleteOperator op, Integer indent)
- throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- String header = op.getOperation() == Kind.INSERT ? "insert into " : "delete from ";
- addIndent(buffer, indent).append(header).append(op.getIndexName()).append(" on ")
- .append(op.getDataSourceIndex().getDataSource()).append(" from ");
- pprintExprList(op.getSecondaryKeyExpressions(), buffer, indent);
- if (op.isBulkload()) {
- buffer.append(" [bulkload]");
- }
- return buffer.toString();
- }
-
- @Override
- public String visitTokenizeOperator(TokenizeOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("tokenize ").append(op.getTokenizeVars()).append(" <- ");
- pprintExprList(op.getSecondaryKeyExpressions(), buffer, indent);
- return buffer.toString();
- }
-
- @Override
- public String visitSinkOperator(SinkOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append("sink");
- return buffer.toString();
- }
-
- @Override
- public String visitExtensionOperator(ExtensionOperator op, Integer indent) throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append(op.toString());
- return buffer.toString();
- }
-
- protected static final StringBuilder addIndent(StringBuilder buffer, int level) {
- for (int i = 0; i < level; ++i) {
- buffer.append(' ');
- }
- return buffer;
- }
-
- protected void printNestedPlans(AbstractOperatorWithNestedPlans op, Integer indent, StringBuilder buffer)
- throws AlgebricksException {
- boolean first = true;
- if (op.getNestedPlans().isEmpty()) {
- buffer.append("}");
- } else {
- for (ILogicalPlan p : op.getNestedPlans()) {
- // PrettyPrintUtil.indent(buffer, level + 10).append("var " +
- // p.first + ":\n");
- buffer.append("\n");
- if (first) {
- first = false;
- } else {
- addIndent(buffer, indent).append(" {\n");
- }
- PlanPrettyPrinter.printPlan(p, buffer, this, indent + 10);
- addIndent(buffer, indent).append(" }");
- }
- }
- }
-
- protected void pprintExprList(List<Mutable<ILogicalExpression>> expressions, StringBuilder buffer, Integer indent)
- throws AlgebricksException {
- buffer.append("[");
- boolean first = true;
- for (Mutable<ILogicalExpression> exprRef : expressions) {
- if (first) {
- first = false;
- } else {
- buffer.append(", ");
- }
- buffer.append(exprRef.getValue().accept(exprVisitor, indent));
- }
- buffer.append("]");
- }
-
- protected void pprintVeList(StringBuilder sb, List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> vePairList,
- Integer indent) throws AlgebricksException {
- 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().accept(exprVisitor, indent));
- }
- }
- sb.append("]");
- }
-
- @Override
- public String visitExternalDataLookupOperator(ExternalDataLookupOperator op, Integer indent)
- throws AlgebricksException {
- StringBuilder buffer = new StringBuilder();
- addIndent(buffer, indent).append(
- "external-instant-lookup " + op.getVariables() + " <- " + op.getExpressionRef().getValue());
- return buffer.toString();
- }
-
-}
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/prettyprint/PlanPlotter.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java
deleted file mode 100644
index 85274de..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java
+++ /dev/null
@@ -1,139 +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.prettyprint;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Random;
-
-import org.apache.commons.io.FileUtils;
-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.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-
-public class PlanPlotter {
-
- static Random randomGenerator = new Random();
-
- public static void printLogicalPlan(ILogicalPlan plan) throws AlgebricksException {
- int indent = 5;
- StringBuilder out = new StringBuilder();
- int randomInt = 10000 + randomGenerator.nextInt(100);
- appendln(out, "digraph G {");
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt);
- }
- appendln(out, "\n}\n}");
- try {
- File file = File.createTempFile("logicalPlan", ".txt");
- FileUtils.writeStringToFile(file, out.toString());
- file.deleteOnExit();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void printOptimizedLogicalPlan(ILogicalPlan plan) throws AlgebricksException {
- int indent = 5;
- StringBuilder out = new StringBuilder();
- int randomInt = 10000 + randomGenerator.nextInt(100);
- appendln(out, "digraph G {");
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt);
- }
- appendln(out, "\n}\n}");
- try {
- File file = File.createTempFile("logicalOptimizedPlan", ".txt");
- FileUtils.writeStringToFile(file, out.toString());
- file.deleteOnExit();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /*
- * DFS traversal function. Calls iteratively all children, and for each calls itself recursively
- * Includes slim-maps only (no gathering of mappers to one)
- */
- public static void printVisualizationGraph(AbstractLogicalOperator op, int indent, StringBuilder out,
- String current_supernode_name, int randomInt) {
- if (!op.getInputs().isEmpty()) {
- //String stringToVisualize = op.toStringForVisualizationGraph();
- String stringToVisualize = op.getOperatorTag().name();
- int firstOccurenceOf_ = stringToVisualize.indexOf("_");
- String supernode_current = stringToVisualize.substring(firstOccurenceOf_ + 1, stringToVisualize.length());
- if (current_supernode_name.isEmpty()) {
- current_supernode_name = supernode_current;
- appendln(out, new String("subgraph cluster_" + supernode_current + " {"));
- pad(out, indent);
- appendln(out, new String("node [style=filled, color = lightgray];"));
- pad(out, indent);
- appendln(out, new String("color=blue;"));
- pad(out, indent);
- String op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- appendln(out, new String("label = \"" + supernode_current + "ID" + op_id + "\";"));
- pad(out, indent);
- }
-
- for (Mutable<ILogicalOperator> i : op.getInputs()) {
- String op_id = i.toString().substring(i.toString().indexOf("@") + 1, i.toString().length());
- String logOpStr = ((AbstractLogicalOperator) i.getValue()).getOperatorTag().name() + "ID" + op_id;
- firstOccurenceOf_ = logOpStr.indexOf("_");
- String supernode_child = logOpStr.substring(firstOccurenceOf_ + 1, logOpStr.length());
- if (!supernode_current.equals(supernode_child)) {
- appendln(out, new String("node [style=filled, color = lightgray];"));
- pad(out, indent);
- appendln(out, new String("color=blue"));
- pad(out, indent);
- appendln(out, new String("label = \"" + supernode_child + "\";"));
- pad(out, indent);
- }
-
- op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- appendln(out, stringToVisualize + "ID" + op_id + "[style = filled]");
- AbstractLogicalOperator child = (AbstractLogicalOperator) i.getValue();
-
- pad(out, indent);
- String op_id1 = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- append(out, op.getOperatorTag().name() + "ID" + op_id1 + " -> ");
- String opc_id = child.toString()
- .substring(child.toString().indexOf("@") + 1, child.toString().length());
- appendln(out, child.getOperatorTag().name() + "ID" + opc_id);
-
- printVisualizationGraph(child, indent, out, supernode_current, (randomGenerator.nextInt(100) + 10000));
-
- }
- }
-
- }
-
- private static void appendln(StringBuilder buf, String s) {
- buf.append(s);
- buf.append("\n");
- }
-
- private static void append(StringBuilder buf, String s) {
- buf.append(s);
- }
-
- private static void pad(StringBuilder buf, int indent) {
- for (int i = 0; i < indent; ++i) {
- buf.append(' ');
- }
- }
-}
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/prettyprint/PlanPrettyPrinter.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPrettyPrinter.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPrettyPrinter.java
deleted file mode 100644
index 33c106b..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/prettyprint/PlanPrettyPrinter.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.prettyprint;
-
-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.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.AbstractOperatorWithNestedPlans;
-
-public class PlanPrettyPrinter {
- public static void printPlan(ILogicalPlan plan, StringBuilder out, LogicalOperatorPrettyPrintVisitor pvisitor,
- int indent) throws AlgebricksException {
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printOperator((AbstractLogicalOperator) root.getValue(), out, pvisitor, indent);
- }
- }
-
- public static void printPhysicalOps(ILogicalPlan plan, StringBuilder out, int indent) {
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printPhysicalOperator((AbstractLogicalOperator) root.getValue(), indent, out);
- }
- }
-
- public static void printOperator(AbstractLogicalOperator op, StringBuilder out,
- LogicalOperatorPrettyPrintVisitor pvisitor, int indent) throws AlgebricksException {
- out.append(op.accept(pvisitor, indent));
- IPhysicalOperator pOp = op.getPhysicalOperator();
-
- if (pOp != null) {
- out.append("\n");
- pad(out, indent);
- appendln(out, "-- " + pOp.toString() + " |" + op.getExecutionMode() + "|");
- } else {
- appendln(out, " -- |" + op.getExecutionMode() + "|");
- }
-
- for (Mutable<ILogicalOperator> i : op.getInputs()) {
- printOperator((AbstractLogicalOperator) i.getValue(), out, pvisitor, indent + 2);
- }
-
- }
-
- public static void printPhysicalOperator(AbstractLogicalOperator op, int indent, StringBuilder out) {
- IPhysicalOperator pOp = op.getPhysicalOperator();
- pad(out, indent);
- appendln(out, "-- " + pOp.toString() + " |" + op.getExecutionMode() + "|");
- if (op.hasNestedPlans()) {
- AbstractOperatorWithNestedPlans opNest = (AbstractOperatorWithNestedPlans) op;
- for (ILogicalPlan p : opNest.getNestedPlans()) {
- pad(out, indent + 8);
- appendln(out, "{");
- printPhysicalOps(p, out, indent + 10);
- pad(out, indent + 8);
- appendln(out, "}");
- }
- }
-
- for (Mutable<ILogicalOperator> i : op.getInputs()) {
- printPhysicalOperator((AbstractLogicalOperator) i.getValue(), indent + 2, out);
- }
-
- }
-
- private static void appendln(StringBuilder buf, String s) {
- buf.append(s);
- buf.append("\n");
- }
-
- private static void pad(StringBuilder buf, int indent) {
- for (int i = 0; i < indent; ++i) {
- buf.append(' ');
- }
- }
-}
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/properties/AbstractGroupingProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/AbstractGroupingProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/AbstractGroupingProperty.java
deleted file mode 100644
index b757bbb..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/AbstractGroupingProperty.java
+++ /dev/null
@@ -1,86 +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.properties;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.ListSet;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public abstract class AbstractGroupingProperty {
- protected Set<LogicalVariable> columnSet;
-
- public AbstractGroupingProperty(Set<LogicalVariable> columnSet) {
- this.columnSet = columnSet;
- }
-
- public Set<LogicalVariable> getColumnSet() {
- return columnSet;
- }
-
- public final void normalizeGroupingColumns(Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds) {
- replaceGroupingColumnsByEqClasses(equivalenceClasses);
- applyFDsToGroupingColumns(fds);
- }
-
- private void replaceGroupingColumnsByEqClasses(Map<LogicalVariable, EquivalenceClass> equivalenceClasses) {
- if (equivalenceClasses == null || equivalenceClasses.isEmpty()) {
- return;
- }
- Set<LogicalVariable> norm = new ListSet<LogicalVariable>();
- for (LogicalVariable v : columnSet) {
- EquivalenceClass ec = equivalenceClasses.get(v);
- if (ec == null) {
- norm.add(v);
- } else {
- if (ec.representativeIsConst()) {
- // trivially satisfied, so the var. can be removed
- } else {
- norm.add(ec.getVariableRepresentative());
- }
- }
- }
- columnSet = norm;
- }
-
- private void applyFDsToGroupingColumns(List<FunctionalDependency> fds) {
- // the set of vars. is unordered
- // so we try all FDs on all variables (incomplete algo?)
- if (fds == null || fds.isEmpty()) {
- return;
- }
- Set<LogicalVariable> norm = new ListSet<LogicalVariable>();
- for (LogicalVariable v : columnSet) {
- boolean isImpliedByAnFD = false;
- for (FunctionalDependency fdep : fds) {
- if (columnSet.containsAll(fdep.getHead()) && fdep.getTail().contains(v)) {
- isImpliedByAnFD = true;
- norm.addAll(fdep.getHead());
- break;
- }
-
- }
- if (!isImpliedByAnFD) {
- norm.add(v);
- }
- }
- columnSet = norm;
- }
-
-}
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/properties/BroadcastPartitioningProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/BroadcastPartitioningProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/BroadcastPartitioningProperty.java
deleted file mode 100644
index 53aea68..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/BroadcastPartitioningProperty.java
+++ /dev/null
@@ -1,56 +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.properties;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public class BroadcastPartitioningProperty implements IPartitioningProperty {
-
- private INodeDomain domain;
-
- public BroadcastPartitioningProperty(INodeDomain domain) {
- this.domain = domain;
- }
-
- @Override
- public PartitioningType getPartitioningType() {
- return PartitioningType.BROADCAST;
- }
-
- @Override
- public void normalize(Map<LogicalVariable, EquivalenceClass> equivalenceClasses, List<FunctionalDependency> fds) {
- // do nothing
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- }
-
- @Override
- public INodeDomain getNodeDomain() {
- return domain;
- }
-
- @Override
- public void setNodeDomain(INodeDomain domain) {
- this.domain = domain;
- }
-
-}
\ 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/properties/DefaultNodeGroupDomain.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/DefaultNodeGroupDomain.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/DefaultNodeGroupDomain.java
deleted file mode 100644
index 226f02c..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/DefaultNodeGroupDomain.java
+++ /dev/null
@@ -1,39 +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.properties;
-
-public class DefaultNodeGroupDomain implements INodeDomain {
-
- private String groupName;
-
- public DefaultNodeGroupDomain(String groupName) {
- this.groupName = groupName;
- }
-
- @Override
- public boolean sameAs(INodeDomain domain) {
- return true;
- }
-
- @Override
- public String toString() {
- return "AsterixDomain(" + groupName + ")";
- }
-
- @Override
- public Integer cardinality() {
- return 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/properties/FileSplitDomain.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FileSplitDomain.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FileSplitDomain.java
deleted file mode 100644
index 5fbcdb9..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FileSplitDomain.java
+++ /dev/null
@@ -1,72 +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.properties;
-
-import edu.uci.ics.hyracks.dataflow.std.file.FileSplit;
-
-public class FileSplitDomain implements INodeDomain {
-
- private FileSplit[] splits;
-
- public FileSplitDomain(FileSplit[] splits) {
- this.splits = splits;
- }
-
- @Override
- public Integer cardinality() {
- return splits.length;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("FileSplitDomain[");
- boolean fst = true;
- for (FileSplit fs : splits) {
- if (fst) {
- fst = false;
- } else {
- sb.append(", ");
- }
- sb.append(fs.getNodeName() + ":" + fs.getLocalFile());
- }
- sb.append(']');
- return sb.toString();
- }
-
- @Override
- public boolean sameAs(INodeDomain domain) {
- if (!(domain instanceof FileSplitDomain)) {
- return false;
- }
- FileSplitDomain fsd = (FileSplitDomain) domain;
- if (fsd.splits.length != splits.length) {
- return false;
- }
- // conservative approach...
- for (int i = 0; i < splits.length; i++) {
- if (!ncEq(splits[i], fsd.splits[i])) {
- return false;
- }
- }
-
- return true;
- }
-
- private boolean ncEq(FileSplit fs1, FileSplit fs2) {
- return fs1.getNodeName().equals(fs2.getNodeName());
- }
-
-}
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/properties/FilteredVariablePropagationPolicy.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FilteredVariablePropagationPolicy.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FilteredVariablePropagationPolicy.java
deleted file mode 100644
index 822cdc3..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FilteredVariablePropagationPolicy.java
+++ /dev/null
@@ -1,37 +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.properties;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-
-public class FilteredVariablePropagationPolicy extends VariablePropagationPolicy {
-
- List<LogicalVariable> toPropagate;
-
- public FilteredVariablePropagationPolicy(List<LogicalVariable> varList) {
- toPropagate = varList;
- }
-
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) {
- for (LogicalVariable v : toPropagate) {
- 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/properties/FunctionalDependency.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FunctionalDependency.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FunctionalDependency.java
deleted file mode 100644
index 5bf4637..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/FunctionalDependency.java
+++ /dev/null
@@ -1,53 +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.properties;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public final class FunctionalDependency {
- private List<LogicalVariable> head;
- private List<LogicalVariable> tail;
-
- public FunctionalDependency(List<LogicalVariable> head, List<LogicalVariable> tail) {
- this.head = head;
- this.tail = tail;
- }
-
- public List<LogicalVariable> getHead() {
- return head;
- }
-
- public List<LogicalVariable> getTail() {
- return tail;
- }
-
- @Override
- public String toString() {
- return head + "->" + tail;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof FunctionalDependency)) {
- return false;
- } else {
- FunctionalDependency fd = (FunctionalDependency) obj;
- return fd.getHead().equals(this.head) && fd.getTail().equals(this.tail);
- }
- }
-
-}
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/properties/ILocalStructuralProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILocalStructuralProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILocalStructuralProperty.java
deleted file mode 100644
index c32fd67..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILocalStructuralProperty.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.properties;
-
-import java.util.Collection;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface ILocalStructuralProperty extends IStructuralProperty {
- public enum PropertyType {
- LOCAL_GROUPING_PROPERTY,
- LOCAL_ORDER_PROPERTY
- }
-
- public void getVariables(Collection<LogicalVariable> variables);
-
- public PropertyType getPropertyType();
-
- /**
- * Returns the retained property regarding to a collection of variables,
- * e.g., some variables used in the property may not exist in the input
- * collection and hence the data property changes.
- *
- * @param vars
- * , an input collection of variables
- * @return the retained data property.
- */
- public ILocalStructuralProperty retainVariables(Collection<LogicalVariable> vars);
-
- /**
- * Returns the additional data property within each group, which is dictated by the group keys.
- *
- * @param vars
- * , group keys.
- * @return the additional data property within each group.
- */
- public ILocalStructuralProperty regardToGroup(Collection<LogicalVariable> groupKeys);
-}
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/properties/ILogicalPropertiesVector.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILogicalPropertiesVector.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILogicalPropertiesVector.java
deleted file mode 100644
index 175f041..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ILogicalPropertiesVector.java
+++ /dev/null
@@ -1,21 +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.properties;
-
-public interface ILogicalPropertiesVector {
- public Integer getNumberOfTuples();
-
- public Integer getMaxOutputFrames();
-}
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/properties/INodeDomain.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/INodeDomain.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/INodeDomain.java
deleted file mode 100644
index 17e97ec..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/INodeDomain.java
+++ /dev/null
@@ -1,22 +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.properties;
-
-public interface INodeDomain {
- public boolean sameAs(INodeDomain domain);
-
- /** @return the number of nodes in that domain or null if unknown */
- public Integer cardinality();
-}
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/properties/IPartitioningProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningProperty.java
deleted file mode 100644
index bb8cfe2..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningProperty.java
+++ /dev/null
@@ -1,81 +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.properties;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface IPartitioningProperty extends IStructuralProperty {
- public enum PartitioningType {
- UNPARTITIONED, RANDOM, BROADCAST, UNORDERED_PARTITIONED, ORDERED_PARTITIONED
- }
-
- static final INodeDomain DOMAIN_FOR_UNPARTITIONED_DATA = new INodeDomain() {
- @Override
- public boolean sameAs(INodeDomain domain) {
- return domain == this;
- }
-
- @Override
- public Integer cardinality() {
- return null;
- }
- };
-
- public static final IPartitioningProperty UNPARTITIONED = new IPartitioningProperty() {
-
- @Override
- public PartitioningType getPartitioningType() {
- return PartitioningType.UNPARTITIONED;
- }
-
- @Override
- public void normalize(Map<LogicalVariable, EquivalenceClass> equivalenceClasses, List<FunctionalDependency> fds) {
- // do nothing
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- }
-
- @Override
- public INodeDomain getNodeDomain() {
- return DOMAIN_FOR_UNPARTITIONED_DATA;
- }
-
- @Override
- public String toString() {
- return getPartitioningType().toString();
- }
-
- @Override
- public void setNodeDomain(INodeDomain domain) {
- throw new IllegalStateException();
- }
- };
-
- public abstract PartitioningType getPartitioningType();
-
- public abstract void normalize(Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds);
-
- public abstract INodeDomain getNodeDomain();
-
- public abstract void setNodeDomain(INodeDomain domain);
-}
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/properties/IPartitioningRequirementsCoordinator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningRequirementsCoordinator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningRequirementsCoordinator.java
deleted file mode 100644
index cd9eb96..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPartitioningRequirementsCoordinator.java
+++ /dev/null
@@ -1,98 +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.properties;
-
-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;
-
-/**
- * Implements constraints in between requirements for the children of the same
- * operator.
- */
-
-public interface IPartitioningRequirementsCoordinator {
-
- public static IPartitioningRequirementsCoordinator NO_COORDINATION = new IPartitioningRequirementsCoordinator() {
-
- @Override
- public Pair<Boolean, IPartitioningProperty> coordinateRequirements(IPartitioningProperty requirements,
- IPartitioningProperty firstDeliveredPartitioning, ILogicalOperator op, IOptimizationContext context) {
- return new Pair<Boolean, IPartitioningProperty>(true, requirements);
- }
- };
-
- public static IPartitioningRequirementsCoordinator EQCLASS_PARTITIONING_COORDINATOR = new IPartitioningRequirementsCoordinator() {
-
- @Override
- public Pair<Boolean, IPartitioningProperty> coordinateRequirements(IPartitioningProperty rqdpp,
- IPartitioningProperty firstDeliveredPartitioning, ILogicalOperator op, IOptimizationContext context)
- throws AlgebricksException {
- if (firstDeliveredPartitioning != null
- && firstDeliveredPartitioning.getPartitioningType() == rqdpp.getPartitioningType()) {
- switch (rqdpp.getPartitioningType()) {
- case UNORDERED_PARTITIONED: {
- UnorderedPartitionedProperty upp1 = (UnorderedPartitionedProperty) firstDeliveredPartitioning;
- Set<LogicalVariable> set1 = upp1.getColumnSet();
- UnorderedPartitionedProperty uppreq = (UnorderedPartitionedProperty) rqdpp;
- Set<LogicalVariable> modifuppreq = new ListSet<LogicalVariable>();
- Map<LogicalVariable, EquivalenceClass> eqmap = context.getEquivalenceClassMap(op);
- Set<LogicalVariable> covered = new ListSet<LogicalVariable>();
-
- // coordinate from an existing partition property
- // (firstDeliveredPartitioning)
- for (LogicalVariable v : set1) {
- EquivalenceClass ecFirst = eqmap.get(v);
- for (LogicalVariable r : uppreq.getColumnSet()) {
- EquivalenceClass ec = eqmap.get(r);
- if (ecFirst == ec) {
- covered.add(v);
- modifuppreq.add(r);
- break;
- }
- }
- }
-
- if (!covered.equals(set1)) {
- throw new AlgebricksException("Could not modify " + rqdpp
- + " to agree with partitioning property " + firstDeliveredPartitioning
- + " delivered by previous input operator.");
- }
- UnorderedPartitionedProperty upp2 = new UnorderedPartitionedProperty(modifuppreq,
- rqdpp.getNodeDomain());
- return new Pair<Boolean, IPartitioningProperty>(false, upp2);
- }
- case ORDERED_PARTITIONED: {
- throw new NotImplementedException();
- }
- }
- }
- return new Pair<Boolean, IPartitioningProperty>(true, rqdpp);
- }
-
- };
-
- public Pair<Boolean, IPartitioningProperty> coordinateRequirements(IPartitioningProperty requirements,
- IPartitioningProperty firstDeliveredPartitioning, 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/properties/IPhysicalPropertiesVector.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPhysicalPropertiesVector.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPhysicalPropertiesVector.java
deleted file mode 100644
index 45bf1ec..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPhysicalPropertiesVector.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.properties;
-
-import java.util.List;
-import java.util.Map;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface IPhysicalPropertiesVector {
-
- public IPartitioningProperty getPartitioningProperty();
-
- public List<ILocalStructuralProperty> getLocalProperties();
-
- /**
- *
- * @param reqd
- * vector of required properties
- * @param equivalenceClasses
- * @param fds
- * @return a vector of properties from pvector that are not delivered by the
- * current vector or null if none
- */
- public IPhysicalPropertiesVector getUnsatisfiedPropertiesFrom(IPhysicalPropertiesVector reqd,
- boolean mayExpandProperties, Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds);
-
- public IPhysicalPropertiesVector clone();
-
-}
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/properties/IPropertiesComputer.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPropertiesComputer.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPropertiesComputer.java
deleted file mode 100644
index 716b459..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IPropertiesComputer.java
+++ /dev/null
@@ -1,23 +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.properties;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-
-public interface IPropertiesComputer {
-
- // can return null
- public IPartitioningProperty computePartitioningProperty(ILogicalExpression expr);
-}
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/properties/IStructuralProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IStructuralProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IStructuralProperty.java
deleted file mode 100644
index bf8aaa5..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/IStructuralProperty.java
+++ /dev/null
@@ -1,23 +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.properties;
-
-import java.util.Collection;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface IStructuralProperty {
- public void getColumns(Collection<LogicalVariable> columns);
-}