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:50 UTC
[37/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/properties/LocalGroupingProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalGroupingProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalGroupingProperty.java
deleted file mode 100644
index c267364..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalGroupingProperty.java
+++ /dev/null
@@ -1,103 +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.Set;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.ListSet;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public class LocalGroupingProperty extends AbstractGroupingProperty implements ILocalStructuralProperty {
-
- // preferredOrderEnforcer, if not null, is guaranteed to enforce grouping on
- // columnSet
- private List<LogicalVariable> preferredOrderEnforcer;
-
- public LocalGroupingProperty(Set<LogicalVariable> columnSet) {
- super(columnSet);
- }
-
- public LocalGroupingProperty(Set<LogicalVariable> columnSet, List<LogicalVariable> preferredOrderEnforcer) {
- this(columnSet);
- this.preferredOrderEnforcer = preferredOrderEnforcer;
- }
-
- @Override
- public PropertyType getPropertyType() {
- return PropertyType.LOCAL_GROUPING_PROPERTY;
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- columns.addAll(columnSet);
- }
-
- @Override
- public String toString() {
- return columnSet.toString();
- }
-
- @Override
- public void getVariables(Collection<LogicalVariable> variables) {
- variables.addAll(columnSet);
- }
-
- public List<LogicalVariable> getPreferredOrderEnforcer() {
- return preferredOrderEnforcer;
- }
-
- @Override
- public ILocalStructuralProperty retainVariables(Collection<LogicalVariable> vars) {
- Set<LogicalVariable> newVars = new ListSet<LogicalVariable>();
- newVars.addAll(vars);
- newVars.retainAll(columnSet);
- if (columnSet.equals(newVars)) {
- return new LocalGroupingProperty(columnSet, preferredOrderEnforcer);
- }
- // Column set for the retained grouping property
- Set<LogicalVariable> newColumns = new ListSet<LogicalVariable>();
- // Matches the prefix of the original column set.
- for (LogicalVariable v : columnSet) {
- if (newVars.contains(v)) {
- newColumns.add(v);
- } else {
- break;
- }
- }
- if (newColumns.size() > 0) {
- return new LocalGroupingProperty(newColumns, preferredOrderEnforcer.subList(0, newColumns.size()));
- } else {
- return null;
- }
- }
-
- @Override
- public ILocalStructuralProperty regardToGroup(Collection<LogicalVariable> groupKeys) {
- Set<LogicalVariable> newColumns = new ListSet<LogicalVariable>();
- for (LogicalVariable v : columnSet) {
- if (!groupKeys.contains(v)) {
- newColumns.add(v);
- }
- }
- if (newColumns.size() > 0) {
- return new LocalGroupingProperty(newColumns, preferredOrderEnforcer.subList(groupKeys.size(),
- newColumns.size()));
- } else {
- 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/LocalOrderProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalOrderProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalOrderProperty.java
deleted file mode 100644
index 6d568f4..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LocalOrderProperty.java
+++ /dev/null
@@ -1,210 +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.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-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;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator.IOrder.OrderKind;
-
-public final class LocalOrderProperty implements ILocalStructuralProperty {
-
- private List<OrderColumn> orderColumns;
-
- public LocalOrderProperty(List<OrderColumn> orderColumn) {
- this.orderColumns = orderColumn;
- }
-
- public List<OrderColumn> getOrderColumns() {
- return orderColumns;
- }
-
- public void setOrderColumns(List<OrderColumn> orderColumn) {
- this.orderColumns = orderColumn;
- }
-
- public List<LogicalVariable> getColumns() {
- List<LogicalVariable> orderVars = new ArrayList<LogicalVariable>();
- for (OrderColumn oc : orderColumns) {
- orderVars.add(oc.getColumn());
- }
- return orderVars;
- }
-
- public List<OrderKind> getOrders() {
- List<OrderKind> orderKinds = new ArrayList<OrderKind>();
- for (OrderColumn oc : orderColumns) {
- orderKinds.add(oc.getOrder());
- }
- return orderKinds;
- }
-
- @Override
- public PropertyType getPropertyType() {
- return PropertyType.LOCAL_ORDER_PROPERTY;
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- columns.addAll(getColumns());
- }
-
- @Override
- public String toString() {
- return orderColumns.toString();
- }
-
- @Override
- public void getVariables(Collection<LogicalVariable> variables) {
- variables.addAll(getColumns());
- }
-
- @Override
- public boolean equals(Object object) {
- LocalOrderProperty lop = (LocalOrderProperty) object;
- return orderColumns.equals(lop.orderColumns);
- }
-
- /**
- * Whether current property implies the required property
- *
- * @param required
- * , a required property
- * @return true if the current property satisfies the required property; otherwise false.
- */
- public final boolean implies(ILocalStructuralProperty required) {
- if (required.getPropertyType() != PropertyType.LOCAL_ORDER_PROPERTY) {
- return false;
- }
- LocalOrderProperty requiredOrderProperty = (LocalOrderProperty) required;
- Iterator<OrderColumn> requiredColumnIterator = requiredOrderProperty.getOrderColumns().iterator();
- Iterator<OrderColumn> currentColumnIterator = orderColumns.iterator();
-
- // Returns true if requiredColumnIterator is a prefix of currentColumnIterator.
- return isPrefixOf(requiredColumnIterator, currentColumnIterator);
- }
-
- private <T> boolean isPrefixOf(Iterator<T> requiredColumnIterator, Iterator<T> currentColumnIterator) {
- while (requiredColumnIterator.hasNext()) {
- T oc = requiredColumnIterator.next();
- if (!currentColumnIterator.hasNext()) {
- return false;
- }
- if (!oc.equals(currentColumnIterator.next())) {
- return false;
- }
- }
- return true;
- }
-
- public final void normalizeOrderingColumns(Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds) {
- replaceOrderingColumnsByEqClasses(equivalenceClasses);
- applyFDsToOrderingColumns(fds);
- }
-
- private void replaceOrderingColumnsByEqClasses(Map<LogicalVariable, EquivalenceClass> equivalenceClasses) {
- if (equivalenceClasses == null || equivalenceClasses.isEmpty()) {
- return;
- }
- List<OrderColumn> norm = new ArrayList<OrderColumn>();
- for (OrderColumn oc : orderColumns) {
- LogicalVariable v = oc.getColumn();
- EquivalenceClass ec = equivalenceClasses.get(v);
- if (ec == null) {
- norm.add(new OrderColumn(v, oc.getOrder()));
- } else {
- if (ec.representativeIsConst()) {
- // trivially satisfied, so the var. can be removed
- } else {
- norm.add(new OrderColumn(ec.getVariableRepresentative(), oc.getOrder()));
- }
- }
- }
- orderColumns = norm;
- }
-
- private void applyFDsToOrderingColumns(List<FunctionalDependency> fds) {
- if (fds == null || fds.isEmpty()) {
- return;
- }
- Set<LogicalVariable> norm = new ListSet<LogicalVariable>();
- List<LogicalVariable> columns = getColumns();
- for (LogicalVariable v : columns) {
- boolean isImpliedByAnFD = false;
- for (FunctionalDependency fdep : fds) {
- if (columns.containsAll(fdep.getHead()) && fdep.getTail().contains(v)) {
- isImpliedByAnFD = true;
- norm.addAll(fdep.getHead());
- break;
- }
-
- }
- if (!isImpliedByAnFD) {
- norm.add(v);
- }
- }
- Set<OrderColumn> impliedColumns = new ListSet<OrderColumn>();
- for (OrderColumn oc : orderColumns) {
- if (!norm.contains(oc.getColumn())) {
- impliedColumns.add(oc);
- }
- }
- orderColumns.removeAll(impliedColumns);
- }
-
- @Override
- public ILocalStructuralProperty retainVariables(Collection<LogicalVariable> vars) {
- List<LogicalVariable> columns = getColumns();
- List<LogicalVariable> newVars = new ArrayList<LogicalVariable>();
- newVars.addAll(vars);
- newVars.retainAll(columns);
- List<OrderColumn> newColumns = new ArrayList<OrderColumn>();
- for (OrderColumn oc : orderColumns) {
- if (newVars.contains(oc.getColumn())) {
- newColumns.add(oc);
- } else {
- break;
- }
- }
- if (newColumns.size() > 0) {
- return new LocalOrderProperty(newColumns);
- } else {
- return null;
- }
- }
-
- @Override
- public ILocalStructuralProperty regardToGroup(Collection<LogicalVariable> groupKeys) {
- List<OrderColumn> newColumns = new ArrayList<OrderColumn>();
- for (OrderColumn oc : orderColumns) {
- if (!groupKeys.contains(oc.getColumn())) {
- newColumns.add(oc);
- }
- }
- if (newColumns.size() > 0) {
- return new LocalOrderProperty(newColumns);
- } else {
- 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/LogicalPropertiesVectorImpl.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LogicalPropertiesVectorImpl.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LogicalPropertiesVectorImpl.java
deleted file mode 100644
index 848c86e..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/LogicalPropertiesVectorImpl.java
+++ /dev/null
@@ -1,43 +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 LogicalPropertiesVectorImpl implements ILogicalPropertiesVector {
-
- private Integer numTuples, maxOutputFrames;
-
- @Override
- public String toString() {
- return "LogicalPropertiesVector [ num.tuples: " + numTuples + ", maxOutputFrames: " + maxOutputFrames + " ]";
- }
-
- @Override
- public Integer getNumberOfTuples() {
- return numTuples;
- }
-
- public void setNumberOfTuples(Integer numTuples) {
- this.numTuples = numTuples;
- }
-
- @Override
- public Integer getMaxOutputFrames() {
- return maxOutputFrames;
- }
-
- public void setMaxOutputFrames(Integer maxOutputFrames) {
- this.maxOutputFrames = maxOutputFrames;
- }
-}
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/OrderColumn.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderColumn.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderColumn.java
deleted file mode 100644
index a0e76d1..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderColumn.java
+++ /dev/null
@@ -1,60 +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.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.OrderOperator.IOrder.OrderKind;
-
-public final class OrderColumn {
-
- private LogicalVariable column;
- private OrderKind order;
-
- public OrderColumn(LogicalVariable column, OrderKind order) {
- this.column = column;
- this.order = order;
- }
-
- public LogicalVariable getColumn() {
- return column;
- }
-
- public OrderKind getOrder() {
- return order;
- }
-
- public void setColumn(LogicalVariable column) {
- this.column = column;
- }
-
- public void setOrder(OrderKind order) {
- this.order = order;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof OrderColumn)) {
- return false;
- } else {
- OrderColumn oc = (OrderColumn) obj;
- return column.equals(oc.getColumn()) && order == oc.getOrder();
- }
- }
-
- @Override
- public String toString() {
- return column.toString() + "(" + order + ")";
- }
-}
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/OrderedPartitionedProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderedPartitionedProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderedPartitionedProperty.java
deleted file mode 100644
index 6f88933..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/OrderedPartitionedProperty.java
+++ /dev/null
@@ -1,80 +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.ArrayList;
-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 OrderedPartitionedProperty implements IPartitioningProperty {
-
- private ArrayList<OrderColumn> orderColumns;
- private INodeDomain domain;
-
- public OrderedPartitionedProperty(ArrayList<OrderColumn> orderColumns, INodeDomain domain) {
- this.domain = domain;
- this.orderColumns = orderColumns;
- }
-
- public ArrayList<OrderColumn> getOrderColumns() {
- return orderColumns;
- }
-
- public ArrayList<LogicalVariable> getColumns() {
- ArrayList<LogicalVariable> cols = new ArrayList<LogicalVariable>(orderColumns.size());
- for (OrderColumn oc : orderColumns) {
- cols.add(oc.getColumn());
- }
- return cols;
- }
-
- @Override
- public PartitioningType getPartitioningType() {
- return PartitioningType.ORDERED_PARTITIONED;
- }
-
- @Override
- public String toString() {
- return getPartitioningType().toString() + orderColumns;
- }
-
- @Override
- public void normalize(Map<LogicalVariable, EquivalenceClass> equivalenceClasses, List<FunctionalDependency> fds) {
- orderColumns = PropertiesUtil.replaceOrderColumnsByEqClasses(orderColumns, equivalenceClasses);
- orderColumns = PropertiesUtil.applyFDsToOrderColumns(orderColumns, fds);
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- for (OrderColumn oc : orderColumns) {
- columns.add(oc.getColumn());
- }
- }
-
- @Override
- public INodeDomain getNodeDomain() {
- return domain;
- }
-
- @Override
- public void setNodeDomain(INodeDomain domain) {
- this.domain = 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/PhysicalRequirements.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PhysicalRequirements.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PhysicalRequirements.java
deleted file mode 100644
index ce0907f..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PhysicalRequirements.java
+++ /dev/null
@@ -1,34 +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 PhysicalRequirements {
- private final IPhysicalPropertiesVector[] requiredProperties;
- private final IPartitioningRequirementsCoordinator partitioningCoordinator;
-
- public PhysicalRequirements(IPhysicalPropertiesVector[] requiredProperties,
- IPartitioningRequirementsCoordinator partitioningCoordinator) {
- this.requiredProperties = requiredProperties;
- this.partitioningCoordinator = partitioningCoordinator;
- }
-
- public IPhysicalPropertiesVector[] getRequiredProperties() {
- return requiredProperties;
- }
-
- public IPartitioningRequirementsCoordinator getPartitioningCoordinator() {
- return partitioningCoordinator;
- }
-}
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/PropertiesUtil.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PropertiesUtil.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PropertiesUtil.java
deleted file mode 100644
index b651e59..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/PropertiesUtil.java
+++ /dev/null
@@ -1,320 +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.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-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;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty.PropertyType;
-
-public class PropertiesUtil {
-
- public Set<LogicalVariable> closureUnderFDs(Collection<LogicalVariable> vars, List<FunctionalDependency> fdList) {
- Set<LogicalVariable> k = new ListSet<LogicalVariable>(vars);
- boolean change;
- do {
- change = false;
- for (FunctionalDependency fd : fdList) {
- List<LogicalVariable> h = fd.getHead();
- if (k.containsAll(h)) {
- List<LogicalVariable> t = fd.getTail();
- for (LogicalVariable v : t) {
- if (!(k.contains(v))) {
- k.add(v);
- change = true;
- }
- }
- }
- }
- } while (change);
- return k;
- }
-
- public static boolean matchLocalProperties(List<ILocalStructuralProperty> reqd,
- List<ILocalStructuralProperty> dlvd, Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds) {
- if (reqd == null) {
- return true;
- }
- if (dlvd == null) {
- return false;
- }
- normalizeLocals(reqd, equivalenceClasses, fds);
- normalizeLocals(dlvd, equivalenceClasses, fds);
-
- ListIterator<ILocalStructuralProperty> dlvdIter = dlvd.listIterator();
-
- Set<LogicalVariable> rqdCols = new ListSet<LogicalVariable>();
- Set<LogicalVariable> dlvdCols = new ListSet<LogicalVariable>();
- for (ILocalStructuralProperty r : reqd) {
- if (r.getPropertyType() == PropertyType.LOCAL_GROUPING_PROPERTY) {
- rqdCols.clear();
- r.getVariables(rqdCols);
- }
- boolean implied = false;
- while (!implied && dlvdIter.hasNext()) {
- ILocalStructuralProperty d = dlvdIter.next();
- switch (r.getPropertyType()) {
- case LOCAL_ORDER_PROPERTY: {
- if (d.getPropertyType() != PropertyType.LOCAL_ORDER_PROPERTY) {
- return false;
- }
- LocalOrderProperty lop = (LocalOrderProperty) d;
- if (lop.implies(r)) {
- implied = true;
- } else {
- return false;
- }
- break;
- }
- case LOCAL_GROUPING_PROPERTY: {
- dlvdCols.clear();
- d.getColumns(dlvdCols);
- if (d.getPropertyType() == PropertyType.LOCAL_ORDER_PROPERTY) {
- implied = isPrefixOf(rqdCols.iterator(), dlvdCols.iterator());
- } else {
- implied = rqdCols.equals(dlvdCols) || isPrefixOf(rqdCols.iterator(), dlvdCols.iterator());
- }
- break;
- }
- default: {
- throw new IllegalStateException();
- }
- }
- }
- if (!implied) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean matchPartitioningProps(IPartitioningProperty reqd, IPartitioningProperty dlvd,
- boolean mayExpandProperties) {
- INodeDomain dom1 = reqd.getNodeDomain();
- INodeDomain dom2 = dlvd.getNodeDomain();
- if (dom1 != null && dom2 != null && !dom1.sameAs(dom2)) {
- return false;
- }
-
- switch (reqd.getPartitioningType()) {
- case RANDOM: {
- // anything matches RANDOM
- return true;
- }
- case UNORDERED_PARTITIONED: {
- switch (dlvd.getPartitioningType()) {
- case UNORDERED_PARTITIONED: {
- UnorderedPartitionedProperty ur = (UnorderedPartitionedProperty) reqd;
- UnorderedPartitionedProperty ud = (UnorderedPartitionedProperty) dlvd;
- if (mayExpandProperties) {
- return isPrefixOf(ud.getColumnSet().iterator(), ur.getColumnSet().iterator());
- } else {
- return ur.getColumnSet().equals(ud.getColumnSet());
- }
- }
- case ORDERED_PARTITIONED: {
- UnorderedPartitionedProperty ur = (UnorderedPartitionedProperty) reqd;
- OrderedPartitionedProperty od = (OrderedPartitionedProperty) dlvd;
- if (mayExpandProperties) {
- List<LogicalVariable> dlvdSortColumns = orderColumnsToVariables(od.getOrderColumns());
- return isPrefixOf(dlvdSortColumns.iterator(), ur.getColumnSet().iterator());
- } else {
- return ur.getColumnSet().containsAll(od.getOrderColumns())
- && od.getOrderColumns().containsAll(ur.getColumnSet());
- }
- }
- default: {
- return false;
- }
- }
- }
- case ORDERED_PARTITIONED: {
- switch (dlvd.getPartitioningType()) {
- case ORDERED_PARTITIONED: {
- OrderedPartitionedProperty or = (OrderedPartitionedProperty) reqd;
- OrderedPartitionedProperty od = (OrderedPartitionedProperty) dlvd;
- if (mayExpandProperties) {
- return isPrefixOf(od.getOrderColumns().iterator(), or.getOrderColumns().iterator());
- } else {
- return od.getOrderColumns().equals(or.getOrderColumns());
- }
- }
- default: {
- return false;
- }
- }
- }
- default: {
- return (dlvd.getPartitioningType() == reqd.getPartitioningType());
- }
- }
- }
-
- /**
- * Converts a list of OrderColumns to a list of LogicalVariables.
- *
- * @param orderColumns
- * , a list of OrderColumns
- * @return the list of LogicalVariables
- */
- private static List<LogicalVariable> orderColumnsToVariables(List<OrderColumn> orderColumns) {
- List<LogicalVariable> columns = new ArrayList<LogicalVariable>();
- for (OrderColumn oc : orderColumns) {
- columns.add(oc.getColumn());
- }
- return columns;
- }
-
- /**
- * @param pref
- * @param target
- * @return true iff pref is a prefix of target
- */
- private static <T> boolean isPrefixOf(Iterator<T> pref, Iterator<T> target) {
- while (pref.hasNext()) {
- T v = pref.next();
- if (!target.hasNext()) {
- return false;
- }
- if (!v.equals(target.next())) {
- return false;
- }
- }
- return true;
- }
-
- public static ArrayList<OrderColumn> applyFDsToOrderColumns(ArrayList<OrderColumn> orderColumns,
- List<FunctionalDependency> fds) {
- // the set of vars. is ordered
- // so we try the variables in order from last to first
- if (fds == null || fds.isEmpty()) {
- return orderColumns;
- }
-
- int deleted = 0;
- for (int i = orderColumns.size() - 1; i >= 0; i--) {
- for (FunctionalDependency fdep : fds) {
- if (impliedByPrefix(orderColumns, i, fdep)) {
- orderColumns.set(i, null);
- deleted++;
- break;
- }
- }
- }
- ArrayList<OrderColumn> norm = new ArrayList<OrderColumn>(orderColumns.size() - deleted);
- for (OrderColumn oc : orderColumns) {
- if (oc != null) {
- norm.add(oc);
- }
- }
- return norm;
- }
-
- public static ArrayList<OrderColumn> replaceOrderColumnsByEqClasses(ArrayList<OrderColumn> orderColumns,
- Map<LogicalVariable, EquivalenceClass> equivalenceClasses) {
- if (equivalenceClasses == null || equivalenceClasses.isEmpty()) {
- return orderColumns;
- }
- ArrayList<OrderColumn> norm = new ArrayList<OrderColumn>();
- for (OrderColumn v : orderColumns) {
- EquivalenceClass ec = equivalenceClasses.get(v.getColumn());
- if (ec == null) {
- norm.add(v);
- } else {
- if (ec.representativeIsConst()) {
- // trivially satisfied, so the var. can be removed
- } else {
- norm.add(new OrderColumn(ec.getVariableRepresentative(), v.getOrder()));
- }
- }
- }
- return norm;
- }
-
- private static boolean impliedByPrefix(ArrayList<OrderColumn> vars, int i, FunctionalDependency fdep) {
- if (!fdep.getTail().contains(vars.get(i).getColumn())) {
- return false;
- }
- boolean fdSat = true;
- for (LogicalVariable pv : fdep.getHead()) {
- boolean isInPrefix = false;
- for (int j = 0; j < i; j++) {
- if (vars.get(j).getColumn().equals(pv)) {
- isInPrefix = true;
- break;
- }
- }
- if (!isInPrefix) {
- fdSat = false;
- break;
- }
- }
- return fdSat;
- }
-
- private static void normalizeLocals(List<ILocalStructuralProperty> props,
- Map<LogicalVariable, EquivalenceClass> equivalenceClasses, List<FunctionalDependency> fds) {
- ListIterator<ILocalStructuralProperty> propIter = props.listIterator();
- int pos = -1;
- while (propIter.hasNext()) {
- ILocalStructuralProperty p = propIter.next();
- if (p.getPropertyType() == PropertyType.LOCAL_GROUPING_PROPERTY) {
- ((LocalGroupingProperty) p).normalizeGroupingColumns(equivalenceClasses, fds);
- pos++;
- } else {
- ((LocalOrderProperty) p).normalizeOrderingColumns(equivalenceClasses, fds);
- pos++;
- }
- }
-
- if (pos < 1) {
- return;
- }
-
- while (propIter.hasPrevious()) {
- ILocalStructuralProperty p = propIter.previous();
- ListIterator<ILocalStructuralProperty> secondIter = props.listIterator(pos);
- pos--;
- Set<LogicalVariable> cols = new ListSet<LogicalVariable>();
- while (secondIter.hasPrevious()) {
- secondIter.previous().getColumns(cols);
- }
- secondIter = null;
- for (FunctionalDependency fdep : fds) {
- LinkedList<LogicalVariable> columnsOfP = new LinkedList<LogicalVariable>();
- p.getColumns(columnsOfP);
- if (impliedByPrefix(columnsOfP, cols, fdep)) {
- propIter.remove();
- break;
- }
- }
- }
- }
-
- private static boolean impliedByPrefix(List<LogicalVariable> colsOfProp, Set<LogicalVariable> colsOfPrefix,
- FunctionalDependency fdep) {
- return fdep.getTail().containsAll(colsOfProp) && colsOfPrefix.containsAll(fdep.getHead());
- }
-}
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/RandomPartitioningProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/RandomPartitioningProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/RandomPartitioningProperty.java
deleted file mode 100644
index 06008a6..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/RandomPartitioningProperty.java
+++ /dev/null
@@ -1,61 +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 RandomPartitioningProperty implements IPartitioningProperty {
-
- private INodeDomain domain;
-
- public RandomPartitioningProperty(INodeDomain domain) {
- this.domain = domain;
- }
-
- @Override
- public PartitioningType getPartitioningType() {
- return PartitioningType.RANDOM;
- }
-
- @Override
- public String toString() {
- return getPartitioningType() + " domain:" + domain;
- }
-
- @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/ResultSetDomain.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ResultSetDomain.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ResultSetDomain.java
deleted file mode 100644
index 688523b..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/ResultSetDomain.java
+++ /dev/null
@@ -1,27 +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 ResultSetDomain implements INodeDomain {
- @Override
- public boolean sameAs(INodeDomain domain) {
- return true;
- }
-
- @Override
- public Integer cardinality() {
- return 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/properties/StructuralPropertiesVector.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/StructuralPropertiesVector.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/StructuralPropertiesVector.java
deleted file mode 100644
index 7290319..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/StructuralPropertiesVector.java
+++ /dev/null
@@ -1,101 +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.ArrayList;
-import java.util.LinkedList;
-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 StructuralPropertiesVector implements IPhysicalPropertiesVector {
- private List<ILocalStructuralProperty> propsLocal;
- private IPartitioningProperty propPartitioning;
-
- public static final StructuralPropertiesVector EMPTY_PROPERTIES_VECTOR = new StructuralPropertiesVector(null,
- new ArrayList<ILocalStructuralProperty>());
-
- public StructuralPropertiesVector(IPartitioningProperty propPartitioning, List<ILocalStructuralProperty> propsLocal) {
- this.propPartitioning = propPartitioning;
- this.propsLocal = propsLocal;
- }
-
- @Override
- public String toString() {
- return "propsLocal=" + propsLocal + "\tpropPartioning=" + propPartitioning;
- }
-
- @Override
- public IPartitioningProperty getPartitioningProperty() {
- return propPartitioning;
- }
-
- @Override
- public List<ILocalStructuralProperty> getLocalProperties() {
- return propsLocal;
- }
-
- @Override
- public IPhysicalPropertiesVector clone() {
- List<ILocalStructuralProperty> propsCopy = new LinkedList<ILocalStructuralProperty>();
- if (propsLocal != null) {
- propsCopy.addAll(propsLocal);
- }
- return new StructuralPropertiesVector(propPartitioning, propsCopy);
- }
-
- /**
- *
- * @param reqd
- * vector of required properties
- * @return a vector of properties from pvector that are not delivered by the
- * current vector or null if none
- */
- @Override
- public IPhysicalPropertiesVector getUnsatisfiedPropertiesFrom(IPhysicalPropertiesVector reqd,
- boolean mayExpandProperties, Map<LogicalVariable, EquivalenceClass> equivalenceClasses,
- List<FunctionalDependency> fds) {
- List<ILocalStructuralProperty> plist = reqd.getLocalProperties();
- List<ILocalStructuralProperty> diffLocals = null;
- if (plist != null && !plist.isEmpty()) {
- if (!PropertiesUtil.matchLocalProperties(plist, propsLocal, equivalenceClasses, fds)) {
- diffLocals = plist;
- }
- }
-
- IPartitioningProperty diffPart = null;
- IPartitioningProperty reqdPart = reqd.getPartitioningProperty();
- if (reqdPart != null) {
- if (mayExpandProperties) {
- reqdPart.normalize(equivalenceClasses, fds);
- } else {
- reqdPart.normalize(equivalenceClasses, null);
- }
- propPartitioning.normalize(equivalenceClasses, fds);
- if (!PropertiesUtil.matchPartitioningProps(reqdPart, propPartitioning, mayExpandProperties)) {
- diffPart = reqdPart;
- }
- }
-
- if (diffLocals == null && diffPart == null) {
- return null;
- } else {
- return new StructuralPropertiesVector(diffPart, diffLocals);
- }
- }
-
-}
\ 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/TypePropagationPolicy.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/TypePropagationPolicy.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/TypePropagationPolicy.java
deleted file mode 100644
index e27edc5..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/TypePropagationPolicy.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.properties;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.typing.ITypeEnvPointer;
-
-public abstract class TypePropagationPolicy {
- public static final TypePropagationPolicy ALL = new TypePropagationPolicy() {
-
- @Override
- public Object getVarType(LogicalVariable var, INullableTypeComputer ntc,
- List<LogicalVariable> nonNullVariableList, List<List<LogicalVariable>> correlatedNullableVariableLists,
- ITypeEnvPointer... typeEnvs) throws AlgebricksException {
- for (ITypeEnvPointer p : typeEnvs) {
- IVariableTypeEnvironment env = p.getTypeEnv();
- if (env == null) {
- throw new AlgebricksException("Null environment for pointer " + p + " in getVarType for var=" + var);
- }
- Object t = env.getVarType(var, nonNullVariableList, correlatedNullableVariableLists);
- if (t != null) {
- if (ntc != null && ntc.canBeNull(t)) {
- for (List<LogicalVariable> list : correlatedNullableVariableLists) {
- if (list.contains(var)) {
- for (LogicalVariable v : list) {
- if (nonNullVariableList.contains(v)) {
- return ntc.getNonOptionalType(t);
- }
- }
- }
- }
- }
- return t;
- }
- }
- return null;
- }
- };
-
- public static final TypePropagationPolicy LEFT_OUTER = new TypePropagationPolicy() {
-
- @Override
- public Object getVarType(LogicalVariable var, INullableTypeComputer ntc,
- List<LogicalVariable> nonNullVariableList, List<List<LogicalVariable>> correlatedNullableVariableLists,
- ITypeEnvPointer... typeEnvs) throws AlgebricksException {
- int n = typeEnvs.length;
- for (int i = 0; i < n; i++) {
- Object t = typeEnvs[i].getTypeEnv().getVarType(var, nonNullVariableList,
- correlatedNullableVariableLists);
- if (t != null) {
- if (i == 0) { // inner branch
- return t;
- } else { // outer branch
- boolean nonNullVarIsProduced = false;
- for (LogicalVariable v : nonNullVariableList) {
- if (v == var) {
- nonNullVarIsProduced = true;
- break;
- }
- if (typeEnvs[i].getTypeEnv().getVarType(v) != null) {
- nonNullVarIsProduced = true;
- break;
- }
- }
- if (nonNullVarIsProduced) {
- return t;
- } else {
- return ntc.makeNullableType(t);
- }
- }
- }
- }
- return null;
- }
- };
-
- public abstract Object getVarType(LogicalVariable var, INullableTypeComputer ntc,
- List<LogicalVariable> nonNullVariableList, List<List<LogicalVariable>> correlatedNullableVariableLists,
- ITypeEnvPointer... typeEnvs) 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/UnorderedPartitionedProperty.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnorderedPartitionedProperty.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnorderedPartitionedProperty.java
deleted file mode 100644
index 3e79192..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnorderedPartitionedProperty.java
+++ /dev/null
@@ -1,64 +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 java.util.Set;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.EquivalenceClass;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public final class UnorderedPartitionedProperty extends AbstractGroupingProperty implements IPartitioningProperty {
-
- private INodeDomain domain;
-
- public UnorderedPartitionedProperty(Set<LogicalVariable> partitioningVariables, INodeDomain domain) {
- super(partitioningVariables);
- this.domain = domain;
- }
-
- @Override
- public PartitioningType getPartitioningType() {
- return PartitioningType.UNORDERED_PARTITIONED;
- }
-
- @Override
- public void normalize(Map<LogicalVariable, EquivalenceClass> equivalenceClasses, List<FunctionalDependency> fds) {
- normalizeGroupingColumns(equivalenceClasses, fds);
- }
-
- @Override
- public String toString() {
- return getPartitioningType().toString() + columnSet;
- }
-
- @Override
- public void getColumns(Collection<LogicalVariable> columns) {
- columns.addAll(columnSet);
- }
-
- @Override
- public INodeDomain getNodeDomain() {
- return domain;
- }
-
- @Override
- public void setNodeDomain(INodeDomain domain) {
- this.domain = 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/UnpartitionedPropertyComputer.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnpartitionedPropertyComputer.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnpartitionedPropertyComputer.java
deleted file mode 100644
index 7a47c1e..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/UnpartitionedPropertyComputer.java
+++ /dev/null
@@ -1,31 +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 class UnpartitionedPropertyComputer implements IPropertiesComputer {
-
- public static final UnpartitionedPropertyComputer INSTANCE = new UnpartitionedPropertyComputer();
-
- private UnpartitionedPropertyComputer() {
- }
-
- @Override
- public IPartitioningProperty computePartitioningProperty(ILogicalExpression expr) {
- return IPartitioningProperty.UNPARTITIONED;
- }
-
-}
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/VariablePropagationPolicy.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/VariablePropagationPolicy.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/VariablePropagationPolicy.java
deleted file mode 100644
index 5ac3a93..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/properties/VariablePropagationPolicy.java
+++ /dev/null
@@ -1,78 +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.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
-
-public abstract class VariablePropagationPolicy {
- public static final VariablePropagationPolicy ALL = new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) {
- int n = sources.length;
- for (int i = 0; i < n; i++) {
- target.addAllNewVariables(sources[i]);
- }
- }
- };
-
- public static final VariablePropagationPolicy NONE = new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) {
- // do nothing
- }
- };
-
- /**
- * Adds, from each source, only variables that do not already appear in the
- * target.
- *
- *
- */
- public static final VariablePropagationPolicy ADDNEWVARIABLES = new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources) {
- for (IOperatorSchema s : sources) {
- for (LogicalVariable v : s) {
- if (target.findVariable(v) < 0) {
- target.addVariable(v);
- }
- }
- }
- }
- };
-
- public abstract void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException;
-
- public static VariablePropagationPolicy concat(final VariablePropagationPolicy... policies) {
- return new VariablePropagationPolicy() {
- @Override
- public void propagateVariables(IOperatorSchema target, IOperatorSchema... sources)
- throws AlgebricksException {
- if (policies.length != sources.length) {
- throw new IllegalArgumentException();
- }
- for (int i = 0; i < policies.length; ++i) {
- VariablePropagationPolicy p = policies[i];
- IOperatorSchema s = sources[i];
- p.propagateVariables(target, s);
- }
- }
- };
- }
-
-}
\ 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/scripting/IScriptDescription.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/IScriptDescription.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/IScriptDescription.java
deleted file mode 100644
index f3724a5..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/IScriptDescription.java
+++ /dev/null
@@ -1,30 +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.scripting;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-
-public interface IScriptDescription {
- public enum ScriptKind {
- STRING_STREAMING
- }
-
- public ScriptKind getKind();
-
- public List<Pair<LogicalVariable, Object>> getVarTypePairs();
-}
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/scripting/StringStreamingScriptDescription.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/StringStreamingScriptDescription.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/StringStreamingScriptDescription.java
deleted file mode 100644
index f030faf..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/scripting/StringStreamingScriptDescription.java
+++ /dev/null
@@ -1,66 +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.scripting;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
-import edu.uci.ics.hyracks.dataflow.std.file.ITupleParserFactory;
-
-public class StringStreamingScriptDescription implements IScriptDescription {
-
- private final String command;
- private final IPrinterFactory[] printerFactories;
- private final char fieldDelimiter;
- private final ITupleParserFactory parserFactory;
- private final List<Pair<LogicalVariable, Object>> varTypePairs;
-
- public StringStreamingScriptDescription(String command, IPrinterFactory[] printerFactories, char fieldDelimiter,
- ITupleParserFactory parserFactory, List<Pair<LogicalVariable, Object>> varTypePairs) {
- this.command = command;
- this.printerFactories = printerFactories;
- this.fieldDelimiter = fieldDelimiter;
- this.parserFactory = parserFactory;
- this.varTypePairs = varTypePairs;
- }
-
- @Override
- public ScriptKind getKind() {
- return ScriptKind.STRING_STREAMING;
- }
-
- public String getCommand() {
- return command;
- }
-
- public IPrinterFactory[] getPrinterFactories() {
- return printerFactories;
- }
-
- public char getFieldDelimiter() {
- return fieldDelimiter;
- }
-
- public ITupleParserFactory getParserFactory() {
- return parserFactory;
- }
-
- @Override
- public List<Pair<LogicalVariable, Object>> getVarTypePairs() {
- return varTypePairs;
- }
-}
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/typing/AbstractTypeEnvironment.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/AbstractTypeEnvironment.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/AbstractTypeEnvironment.java
deleted file mode 100644
index 9833c17..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/AbstractTypeEnvironment.java
+++ /dev/null
@@ -1,59 +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.typing;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public abstract class AbstractTypeEnvironment implements IVariableTypeEnvironment {
-
- protected final Map<LogicalVariable, Object> varTypeMap = new HashMap<LogicalVariable, Object>();
- protected final IExpressionTypeComputer expressionTypeComputer;
- protected final IMetadataProvider<?, ?> metadataProvider;
-
- public AbstractTypeEnvironment(IExpressionTypeComputer expressionTypeComputer,
- IMetadataProvider<?, ?> metadataProvider) {
- this.expressionTypeComputer = expressionTypeComputer;
- this.metadataProvider = metadataProvider;
- }
-
- @Override
- public Object getType(ILogicalExpression expr) throws AlgebricksException {
- return expressionTypeComputer.getType(expr, metadataProvider, this);
- }
-
- @Override
- public void setVarType(LogicalVariable var, Object type) {
- varTypeMap.put(var, type);
- }
-
- @Override
- public boolean substituteProducedVariable(LogicalVariable v1, LogicalVariable v2) throws AlgebricksException {
- Object t = varTypeMap.get(v1);
- if (t == null) {
- return false;
- }
- varTypeMap.put(v1, null);
- varTypeMap.put(v2, t);
- 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/typing/ITypeEnvPointer.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypeEnvPointer.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypeEnvPointer.java
deleted file mode 100644
index 0b56db7..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypeEnvPointer.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.typing;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-
-public interface ITypeEnvPointer {
- public IVariableTypeEnvironment getTypeEnv();
-}
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/typing/ITypingContext.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypingContext.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypingContext.java
deleted file mode 100644
index 7945fa7..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/ITypingContext.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.typing;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public interface ITypingContext {
- public abstract IVariableTypeEnvironment getOutputTypeEnvironment(ILogicalOperator op);
-
- public abstract void setOutputTypeEnvironment(ILogicalOperator op, IVariableTypeEnvironment env);
-
- public abstract IExpressionTypeComputer getExpressionTypeComputer();
-
- public abstract INullableTypeComputer getNullableTypeComputer();
-
- public abstract IMetadataProvider<?, ?> getMetadataProvider();
-}
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/typing/NonPropagatingTypeEnvironment.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/NonPropagatingTypeEnvironment.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/NonPropagatingTypeEnvironment.java
deleted file mode 100644
index eb0eb71..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/NonPropagatingTypeEnvironment.java
+++ /dev/null
@@ -1,42 +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.typing;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public class NonPropagatingTypeEnvironment extends AbstractTypeEnvironment {
-
- public NonPropagatingTypeEnvironment(IExpressionTypeComputer expressionTypeComputer,
- IMetadataProvider<?, ?> metadataProvider) {
- super(expressionTypeComputer, metadataProvider);
- }
-
- @Override
- public Object getVarType(LogicalVariable var) throws AlgebricksException {
- return varTypeMap.get(var);
- }
-
- @Override
- public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariables,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- return getVarType(var);
- }
-
-}
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/typing/OpRefTypeEnvPointer.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/OpRefTypeEnvPointer.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/OpRefTypeEnvPointer.java
deleted file mode 100644
index 6a1c8b5..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/OpRefTypeEnvPointer.java
+++ /dev/null
@@ -1,42 +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.typing;
-
-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.expressions.IVariableTypeEnvironment;
-
-public class OpRefTypeEnvPointer implements ITypeEnvPointer {
-
- private final Mutable<ILogicalOperator> op;
- private final ITypingContext ctx;
-
- public OpRefTypeEnvPointer(Mutable<ILogicalOperator> op, ITypingContext ctx) {
- this.op = op;
- this.ctx = ctx;
- }
-
- @Override
- public IVariableTypeEnvironment getTypeEnv() {
- return ctx.getOutputTypeEnvironment(op.getValue());
- }
-
- @Override
- public String toString() {
- return this.getClass().getName() + ":" + op;
- }
-
-}
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/typing/PropagateOperatorInputsTypeEnvironment.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagateOperatorInputsTypeEnvironment.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagateOperatorInputsTypeEnvironment.java
deleted file mode 100644
index 87ee385..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagateOperatorInputsTypeEnvironment.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.core.algebra.typing;
-
-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.ILogicalOperator;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public class PropagateOperatorInputsTypeEnvironment extends AbstractTypeEnvironment {
-
- private final List<LogicalVariable> nonNullVariables = new ArrayList<LogicalVariable>();
- private final List<List<LogicalVariable>> correlatedNullableVariableLists = new ArrayList<List<LogicalVariable>>();
- private final ILogicalOperator op;
- private final ITypingContext ctx;
-
- public PropagateOperatorInputsTypeEnvironment(ILogicalOperator op, ITypingContext ctx,
- IExpressionTypeComputer expressionTypeComputer, IMetadataProvider<?, ?> metadataProvider) {
- super(expressionTypeComputer, metadataProvider);
- this.op = op;
- this.ctx = ctx;
- }
-
- public List<LogicalVariable> getNonNullVariables() {
- return nonNullVariables;
- }
-
- @Override
- public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- nonNullVariableList.addAll(nonNullVariables);
- return getVarTypeFullList(var, nonNullVariableList, correlatedNullableVariableLists);
- }
-
- private Object getVarTypeFullList(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- Object t = varTypeMap.get(var);
- if (t != null) {
- return t;
- }
- for (Mutable<ILogicalOperator> r : op.getInputs()) {
- ILogicalOperator c = r.getValue();
- IVariableTypeEnvironment env = ctx.getOutputTypeEnvironment(c);
- Object t2 = env.getVarType(var, nonNullVariableList, correlatedNullableVariableLists);
- if (t2 != null) {
- return t2;
- }
- }
- return null;
- }
-
- @Override
- public Object getVarType(LogicalVariable var) throws AlgebricksException {
- return getVarTypeFullList(var, nonNullVariables, correlatedNullableVariableLists);
- }
-
-}
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/typing/PropagatingTypeEnvironment.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagatingTypeEnvironment.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagatingTypeEnvironment.java
deleted file mode 100644
index d167cd7..0000000
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/typing/PropagatingTypeEnvironment.java
+++ /dev/null
@@ -1,87 +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.typing;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.properties.TypePropagationPolicy;
-
-public class PropagatingTypeEnvironment extends AbstractTypeEnvironment {
-
- private final TypePropagationPolicy policy;
-
- private final INullableTypeComputer nullableTypeComputer;
-
- private final ITypeEnvPointer[] envPointers;
-
- private final List<LogicalVariable> nonNullVariables = new ArrayList<LogicalVariable>();
-
- private final List<List<LogicalVariable>> correlatedNullableVariableLists = new ArrayList<List<LogicalVariable>>();
-
- public PropagatingTypeEnvironment(IExpressionTypeComputer expressionTypeComputer,
- INullableTypeComputer nullableTypeComputer, IMetadataProvider<?, ?> metadataProvider,
- TypePropagationPolicy policy, ITypeEnvPointer[] envPointers) {
- super(expressionTypeComputer, metadataProvider);
- this.nullableTypeComputer = nullableTypeComputer;
- this.policy = policy;
- this.envPointers = envPointers;
- }
-
- @Override
- public Object getVarType(LogicalVariable var) throws AlgebricksException {
- return getVarTypeFullList(var, nonNullVariables, correlatedNullableVariableLists);
- }
-
- public List<LogicalVariable> getNonNullVariables() {
- return nonNullVariables;
- }
-
- public List<List<LogicalVariable>> getCorrelatedNullableVariableLists() {
- return correlatedNullableVariableLists;
- }
-
- @Override
- public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- for (LogicalVariable v : nonNullVariables) {
- if (!nonNullVariableList.contains(v)) {
- nonNullVariableList.add(v);
- }
- }
- Object t = getVarTypeFullList(var, nonNullVariableList, correlatedNullableVariableLists);
- for (List<LogicalVariable> list : this.correlatedNullableVariableLists) {
- if (!correlatedNullableVariableLists.contains(list)) {
- correlatedNullableVariableLists.add(list);
- }
- }
- return t;
- }
-
- private Object getVarTypeFullList(LogicalVariable var, List<LogicalVariable> nonNullVariableList,
- List<List<LogicalVariable>> correlatedNullableVariableLists) throws AlgebricksException {
- Object t = varTypeMap.get(var);
- if (t != null) {
- return t;
- }
- return policy.getVarType(var, nullableTypeComputer, nonNullVariableList, correlatedNullableVariableLists,
- envPointers);
- }
-}