You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2015/08/25 18:42:03 UTC
[50/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-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
deleted file mode 100644
index 39f3550..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
+++ /dev/null
@@ -1,32 +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.common.constraints;
-
-public class AlgebricksAbsolutePartitionConstraint extends AlgebricksPartitionConstraint {
- private final String[] locations;
-
- public AlgebricksAbsolutePartitionConstraint(String[] locations) {
- this.locations = locations;
- }
-
- @Override
- public PartitionConstraintType getPartitionConstraintType() {
- return PartitionConstraintType.ABSOLUTE;
- }
-
- public String[] getLocations() {
- return locations;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java
deleted file mode 100644
index dd62f47..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.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.common.constraints;
-
-public class AlgebricksCountPartitionConstraint extends AlgebricksPartitionConstraint {
-
- private final int count;
-
- public AlgebricksCountPartitionConstraint(int count) {
- this.count = count;
- }
-
- @Override
- public PartitionConstraintType getPartitionConstraintType() {
- return PartitionConstraintType.COUNT;
- }
-
- public int getCount() {
- return count;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
deleted file mode 100644
index a458451..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
+++ /dev/null
@@ -1,24 +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.common.constraints;
-
-public abstract class AlgebricksPartitionConstraint {
- public enum PartitionConstraintType {
- ABSOLUTE,
- COUNT
- }
-
- public abstract PartitionConstraintType getPartitionConstraintType();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
deleted file mode 100644
index 8ad27b1..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
+++ /dev/null
@@ -1,58 +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.common.constraints;
-
-import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
-import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public class AlgebricksPartitionConstraintHelper {
-
- public static void setPartitionConstraintInJobSpec(JobSpecification jobSpec, IOperatorDescriptor opDesc,
- AlgebricksPartitionConstraint apc) {
- switch (apc.getPartitionConstraintType()) {
- case ABSOLUTE: {
- AlgebricksAbsolutePartitionConstraint absPc = (AlgebricksAbsolutePartitionConstraint) apc;
- PartitionConstraintHelper.addAbsoluteLocationConstraint(jobSpec, opDesc, absPc.getLocations());
- break;
- }
- case COUNT: {
- AlgebricksCountPartitionConstraint cntPc = (AlgebricksCountPartitionConstraint) apc;
- PartitionConstraintHelper.addPartitionCountConstraint(jobSpec, opDesc, cntPc.getCount());
- break;
- }
- default: {
- throw new IllegalStateException();
- }
- }
- }
-
- public static int getPartitionCount(AlgebricksPartitionConstraint partitionConstraint) {
- switch (partitionConstraint.getPartitionConstraintType()) {
- case COUNT: {
- AlgebricksCountPartitionConstraint pcc = (AlgebricksCountPartitionConstraint) partitionConstraint;
- return pcc.getCount();
- }
- case ABSOLUTE: {
- AlgebricksAbsolutePartitionConstraint epc = (AlgebricksAbsolutePartitionConstraint) partitionConstraint;
- return epc.getLocations().length;
- }
- default: {
- throw new IllegalStateException();
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/AlgebricksException.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/AlgebricksException.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/AlgebricksException.java
deleted file mode 100644
index 6f39167..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/AlgebricksException.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.common.exceptions;
-
-public class AlgebricksException extends Exception {
- private static final long serialVersionUID = 1L;
-
- public AlgebricksException() {
- }
-
- public AlgebricksException(String message) {
- super(message);
- }
-
- public AlgebricksException(Throwable cause) {
- super(cause);
- }
-
- public AlgebricksException(String message, Throwable cause) {
- super(message, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/NotImplementedException.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/NotImplementedException.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/NotImplementedException.java
deleted file mode 100644
index cc0c975..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/exceptions/NotImplementedException.java
+++ /dev/null
@@ -1,35 +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.common.exceptions;
-
-public class NotImplementedException extends RuntimeException {
- private static final long serialVersionUID = 2L;
-
- public NotImplementedException() {
- System.err.println("Not implemented.");
- }
-
- public NotImplementedException(String message) {
- super(message);
- }
-
- public NotImplementedException(Throwable cause) {
- super(cause);
- }
-
- public NotImplementedException(String message, Throwable cause) {
- super(message, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/ListSet.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/ListSet.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/ListSet.java
deleted file mode 100644
index f4ed6c1..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/ListSet.java
+++ /dev/null
@@ -1,125 +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.common.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-public class ListSet<E> implements Set<E> {
- private List<E> list = new ArrayList<E>();
-
- public ListSet() {
- }
-
- public ListSet(Collection<? extends E> arg) {
- this.addAll(arg);
- }
-
- @Override
- public boolean add(E arg0) {
- if (list.contains(arg0))
- return false;
- return list.add(arg0);
- }
-
- @Override
- public boolean addAll(Collection<? extends E> arg0) {
- for (E item : arg0)
- if (list.contains(item))
- return false;
- return list.addAll(arg0);
- }
-
- @Override
- public void clear() {
- list.clear();
- }
-
- @Override
- public boolean contains(Object arg0) {
- return list.contains(arg0);
- }
-
- @Override
- public boolean containsAll(Collection<?> arg0) {
- return list.containsAll(arg0);
- }
-
- @Override
- public boolean isEmpty() {
- return list.isEmpty();
- }
-
- @Override
- public Iterator<E> iterator() {
- return list.iterator();
- }
-
- @Override
- public boolean remove(Object arg0) {
- return list.remove(arg0);
- }
-
- @Override
- public boolean removeAll(Collection<?> arg0) {
- return list.removeAll(arg0);
- }
-
- @Override
- public boolean retainAll(Collection<?> arg0) {
- return list.retainAll(arg0);
- }
-
- @Override
- public int size() {
- return list.size();
- }
-
- @Override
- public Object[] toArray() {
- return list.toArray();
- }
-
- @Override
- public <T> T[] toArray(T[] arg0) {
- return list.toArray(arg0);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public boolean equals(Object arg) {
- if (!(arg instanceof Set))
- return false;
- Set<E> set = (Set<E>) arg;
- for (E item : set) {
- if (!this.contains(item))
- return false;
- }
- for (E item : this) {
- if (!set.contains(item))
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return list.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Pair.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Pair.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Pair.java
deleted file mode 100644
index e8ba583..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Pair.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.common.utils;
-
-import java.io.Serializable;
-
-public class Pair<T1, T2> implements Serializable {
-
- private static final long serialVersionUID = 1L;
- public T1 first;
- public T2 second;
-
- public Pair(T1 first, T2 second) {
- this.first = first;
- this.second = second;
- }
-
- @Override
- public String toString() {
- return first + "," + second;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Pair<?, ?>)) {
- return false;
- } else {
- Pair<?, ?> p = (Pair<?, ?>) obj;
- return this.first.equals(p.first) && this.second.equals(p.second);
- }
- }
-
- @Override
- public int hashCode() {
- return first.hashCode() * 31 + second.hashCode();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Triple.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Triple.java b/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Triple.java
deleted file mode 100644
index fe76c4a..0000000
--- a/algebricks/algebricks-common/src/main/java/edu/uci/ics/hyracks/algebricks/common/utils/Triple.java
+++ /dev/null
@@ -1,46 +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.common.utils;
-
-public class Triple<T1, T2, T3> {
- public T1 first;
- public T2 second;
- public T3 third;
-
- public Triple(T1 first, T2 second, T3 third) {
- this.first = first;
- this.second = second;
- this.third = third;
- }
-
- @Override
- public String toString() {
- return first + "," + second + ", " + third;
- }
-
- @Override
- public int hashCode() {
- return first.hashCode() * 31 + second.hashCode() * 15 + third.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof Triple<?, ?, ?>))
- return false;
- Triple<?, ?, ?> triple = (Triple<?, ?, ?>) o;
- return first.equals(triple.first) && second.equals(triple.second) && third.equals(triple.third);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
new file mode 100644
index 0000000..39f3550
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
@@ -0,0 +1,32 @@
+/*
+ * 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.common.constraints;
+
+public class AlgebricksAbsolutePartitionConstraint extends AlgebricksPartitionConstraint {
+ private final String[] locations;
+
+ public AlgebricksAbsolutePartitionConstraint(String[] locations) {
+ this.locations = locations;
+ }
+
+ @Override
+ public PartitionConstraintType getPartitionConstraintType() {
+ return PartitionConstraintType.ABSOLUTE;
+ }
+
+ public String[] getLocations() {
+ return locations;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java
new file mode 100644
index 0000000..dd62f47
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksCountPartitionConstraint.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.constraints;
+
+public class AlgebricksCountPartitionConstraint extends AlgebricksPartitionConstraint {
+
+ private final int count;
+
+ public AlgebricksCountPartitionConstraint(int count) {
+ this.count = count;
+ }
+
+ @Override
+ public PartitionConstraintType getPartitionConstraintType() {
+ return PartitionConstraintType.COUNT;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
new file mode 100644
index 0000000..a458451
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraint.java
@@ -0,0 +1,24 @@
+/*
+ * 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.common.constraints;
+
+public abstract class AlgebricksPartitionConstraint {
+ public enum PartitionConstraintType {
+ ABSOLUTE,
+ COUNT
+ }
+
+ public abstract PartitionConstraintType getPartitionConstraintType();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
new file mode 100644
index 0000000..8ad27b1
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksPartitionConstraintHelper.java
@@ -0,0 +1,58 @@
+/*
+ * 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.common.constraints;
+
+import edu.uci.ics.hyracks.api.constraints.PartitionConstraintHelper;
+import edu.uci.ics.hyracks.api.dataflow.IOperatorDescriptor;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
+
+public class AlgebricksPartitionConstraintHelper {
+
+ public static void setPartitionConstraintInJobSpec(JobSpecification jobSpec, IOperatorDescriptor opDesc,
+ AlgebricksPartitionConstraint apc) {
+ switch (apc.getPartitionConstraintType()) {
+ case ABSOLUTE: {
+ AlgebricksAbsolutePartitionConstraint absPc = (AlgebricksAbsolutePartitionConstraint) apc;
+ PartitionConstraintHelper.addAbsoluteLocationConstraint(jobSpec, opDesc, absPc.getLocations());
+ break;
+ }
+ case COUNT: {
+ AlgebricksCountPartitionConstraint cntPc = (AlgebricksCountPartitionConstraint) apc;
+ PartitionConstraintHelper.addPartitionCountConstraint(jobSpec, opDesc, cntPc.getCount());
+ break;
+ }
+ default: {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+ public static int getPartitionCount(AlgebricksPartitionConstraint partitionConstraint) {
+ switch (partitionConstraint.getPartitionConstraintType()) {
+ case COUNT: {
+ AlgebricksCountPartitionConstraint pcc = (AlgebricksCountPartitionConstraint) partitionConstraint;
+ return pcc.getCount();
+ }
+ case ABSOLUTE: {
+ AlgebricksAbsolutePartitionConstraint epc = (AlgebricksAbsolutePartitionConstraint) partitionConstraint;
+ return epc.getLocations().length;
+ }
+ default: {
+ throw new IllegalStateException();
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
new file mode 100644
index 0000000..6f39167
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/AlgebricksException.java
@@ -0,0 +1,34 @@
+/*
+ * 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.common.exceptions;
+
+public class AlgebricksException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public AlgebricksException() {
+ }
+
+ public AlgebricksException(String message) {
+ super(message);
+ }
+
+ public AlgebricksException(Throwable cause) {
+ super(cause);
+ }
+
+ public AlgebricksException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/NotImplementedException.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/NotImplementedException.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/NotImplementedException.java
new file mode 100644
index 0000000..cc0c975
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/exceptions/NotImplementedException.java
@@ -0,0 +1,35 @@
+/*
+ * 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.common.exceptions;
+
+public class NotImplementedException extends RuntimeException {
+ private static final long serialVersionUID = 2L;
+
+ public NotImplementedException() {
+ System.err.println("Not implemented.");
+ }
+
+ public NotImplementedException(String message) {
+ super(message);
+ }
+
+ public NotImplementedException(Throwable cause) {
+ super(cause);
+ }
+
+ public NotImplementedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/ListSet.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/ListSet.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/ListSet.java
new file mode 100644
index 0000000..f4ed6c1
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/ListSet.java
@@ -0,0 +1,125 @@
+/*
+ * 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.common.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+public class ListSet<E> implements Set<E> {
+ private List<E> list = new ArrayList<E>();
+
+ public ListSet() {
+ }
+
+ public ListSet(Collection<? extends E> arg) {
+ this.addAll(arg);
+ }
+
+ @Override
+ public boolean add(E arg0) {
+ if (list.contains(arg0))
+ return false;
+ return list.add(arg0);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> arg0) {
+ for (E item : arg0)
+ if (list.contains(item))
+ return false;
+ return list.addAll(arg0);
+ }
+
+ @Override
+ public void clear() {
+ list.clear();
+ }
+
+ @Override
+ public boolean contains(Object arg0) {
+ return list.contains(arg0);
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> arg0) {
+ return list.containsAll(arg0);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return list.isEmpty();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return list.iterator();
+ }
+
+ @Override
+ public boolean remove(Object arg0) {
+ return list.remove(arg0);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> arg0) {
+ return list.removeAll(arg0);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> arg0) {
+ return list.retainAll(arg0);
+ }
+
+ @Override
+ public int size() {
+ return list.size();
+ }
+
+ @Override
+ public Object[] toArray() {
+ return list.toArray();
+ }
+
+ @Override
+ public <T> T[] toArray(T[] arg0) {
+ return list.toArray(arg0);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean equals(Object arg) {
+ if (!(arg instanceof Set))
+ return false;
+ Set<E> set = (Set<E>) arg;
+ for (E item : set) {
+ if (!this.contains(item))
+ return false;
+ }
+ for (E item : this) {
+ if (!set.contains(item))
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return list.toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Pair.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Pair.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Pair.java
new file mode 100644
index 0000000..e8ba583
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Pair.java
@@ -0,0 +1,50 @@
+/*
+ * 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.common.utils;
+
+import java.io.Serializable;
+
+public class Pair<T1, T2> implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ public T1 first;
+ public T2 second;
+
+ public Pair(T1 first, T2 second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ @Override
+ public String toString() {
+ return first + "," + second;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Pair<?, ?>)) {
+ return false;
+ } else {
+ Pair<?, ?> p = (Pair<?, ?>) obj;
+ return this.first.equals(p.first) && this.second.equals(p.second);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return first.hashCode() * 31 + second.hashCode();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Triple.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Triple.java b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Triple.java
new file mode 100644
index 0000000..fe76c4a
--- /dev/null
+++ b/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/utils/Triple.java
@@ -0,0 +1,46 @@
+/*
+ * 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.common.utils;
+
+public class Triple<T1, T2, T3> {
+ public T1 first;
+ public T2 second;
+ public T3 third;
+
+ public Triple(T1 first, T2 second, T3 third) {
+ this.first = first;
+ this.second = second;
+ this.third = third;
+ }
+
+ @Override
+ public String toString() {
+ return first + "," + second + ", " + third;
+ }
+
+ @Override
+ public int hashCode() {
+ return first.hashCode() * 31 + second.hashCode() * 15 + third.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Triple<?, ?, ?>))
+ return false;
+ Triple<?, ?, ?> triple = (Triple<?, ?, ?>) o;
+ return first.equals(triple.first) && second.equals(triple.second) && third.equals(triple.third);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
deleted file mode 100644
index 3d92d68..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
+++ /dev/null
@@ -1,230 +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.compiler.api;
-
-import java.util.List;
-
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
-import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IPartialAggregationTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
-import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspectorFactory;
-import edu.uci.ics.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
-import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
-import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFamilyProvider;
-import edu.uci.ics.hyracks.algebricks.data.IBinaryIntegerInspectorFactory;
-import edu.uci.ics.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider;
-import edu.uci.ics.hyracks.algebricks.data.IPrinterFactoryProvider;
-import edu.uci.ics.hyracks.algebricks.data.ISerializerDeserializerProvider;
-import edu.uci.ics.hyracks.algebricks.data.ITypeTraitProvider;
-import edu.uci.ics.hyracks.api.dataflow.value.INullWriterFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
-
-public abstract class AbstractCompilerFactoryBuilder {
-
- protected List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> logicalRewrites;
- protected List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> physicalRewrites;
- protected ITypeTraitProvider typeTraitProvider;
- protected ISerializerDeserializerProvider serializerDeserializerProvider;
- protected IBinaryHashFunctionFactoryProvider hashFunctionFactoryProvider;
- protected IBinaryHashFunctionFamilyProvider hashFunctionFamilyProvider;
- protected IBinaryComparatorFactoryProvider comparatorFactoryProvider;
- protected IBinaryBooleanInspectorFactory binaryBooleanInspectorFactory;
- protected IBinaryIntegerInspectorFactory binaryIntegerInspectorFactory;
- protected IPrinterFactoryProvider printerProvider;
- protected IPredicateEvaluatorFactoryProvider predEvaluatorFactoryProvider;
- protected IExpressionRuntimeProvider expressionRuntimeProvider;
- protected IExpressionTypeComputer expressionTypeComputer;
- protected INullableTypeComputer nullableTypeComputer;
- protected IExpressionEvalSizeComputer expressionEvalSizeComputer;
- protected INullWriterFactory nullWriterFactory;
- protected INormalizedKeyComputerFactoryProvider normalizedKeyComputerFactoryProvider;
- protected IPartialAggregationTypeComputer partialAggregationTypeComputer;
- protected IMergeAggregationExpressionFactory mergeAggregationExpressionFactory;
- protected PhysicalOptimizationConfig physicalOptimizationConfig = new PhysicalOptimizationConfig();
- protected AlgebricksPartitionConstraint clusterLocations;
-
- public abstract ICompilerFactory create();
-
- public void setLogicalRewrites(List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> logicalRewrites) {
- this.logicalRewrites = logicalRewrites;
- }
-
- public void setPhysicalRewrites(List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> physicalRewrites) {
- this.physicalRewrites = physicalRewrites;
- }
-
- public void setTypeTraitProvider(ITypeTraitProvider typeTraitProvider) {
- this.typeTraitProvider = typeTraitProvider;
- }
-
- public ITypeTraitProvider getTypeTraitProvider() {
- return typeTraitProvider;
- }
-
- public void setSerializerDeserializerProvider(ISerializerDeserializerProvider serializerDeserializerProvider) {
- this.serializerDeserializerProvider = serializerDeserializerProvider;
- }
-
- public ISerializerDeserializerProvider getSerializerDeserializerProvider() {
- return serializerDeserializerProvider;
- }
-
- public void setHashFunctionFactoryProvider(IBinaryHashFunctionFactoryProvider hashFunctionFactoryProvider) {
- this.hashFunctionFactoryProvider = hashFunctionFactoryProvider;
- }
-
- public IBinaryHashFunctionFactoryProvider getHashFunctionFactoryProvider() {
- return hashFunctionFactoryProvider;
- }
-
- public void setHashFunctionFamilyProvider(IBinaryHashFunctionFamilyProvider hashFunctionFamilyProvider) {
- this.hashFunctionFamilyProvider = hashFunctionFamilyProvider;
- }
-
- public IBinaryHashFunctionFamilyProvider getHashFunctionFamilyProvider() {
- return hashFunctionFamilyProvider;
- }
-
- public void setComparatorFactoryProvider(IBinaryComparatorFactoryProvider comparatorFactoryProvider) {
- this.comparatorFactoryProvider = comparatorFactoryProvider;
- }
-
- public IBinaryComparatorFactoryProvider getComparatorFactoryProvider() {
- return comparatorFactoryProvider;
- }
-
- public void setPredicateEvaluatorFactoryProvider(IPredicateEvaluatorFactoryProvider predEvaluatorFactoryProvider) {
- this.predEvaluatorFactoryProvider = predEvaluatorFactoryProvider;
- }
-
- public IPredicateEvaluatorFactoryProvider getPredicateEvaluatorFactory() {
- return predEvaluatorFactoryProvider;
- }
-
- public void setBinaryBooleanInspectorFactory(IBinaryBooleanInspectorFactory binaryBooleanInspectorFactory) {
- this.binaryBooleanInspectorFactory = binaryBooleanInspectorFactory;
- }
-
- public IBinaryBooleanInspectorFactory getBinaryBooleanInspectorFactory() {
- return binaryBooleanInspectorFactory;
- }
-
- public void setBinaryIntegerInspectorFactory(IBinaryIntegerInspectorFactory binaryIntegerInspectorFactory) {
- this.binaryIntegerInspectorFactory = binaryIntegerInspectorFactory;
- }
-
- public IBinaryIntegerInspectorFactory getBinaryIntegerInspectorFactory() {
- return binaryIntegerInspectorFactory;
- }
-
- public void setPrinterProvider(IPrinterFactoryProvider printerProvider) {
- this.printerProvider = printerProvider;
- }
-
- public IPrinterFactoryProvider getPrinterProvider() {
- return printerProvider;
- }
-
- public void setExpressionRuntimeProvider(IExpressionRuntimeProvider expressionRuntimeProvider) {
- this.expressionRuntimeProvider = expressionRuntimeProvider;
- }
-
- public IExpressionRuntimeProvider getExpressionRuntimeProvider() {
- return expressionRuntimeProvider;
- }
-
- public void setExpressionTypeComputer(IExpressionTypeComputer expressionTypeComputer) {
- this.expressionTypeComputer = expressionTypeComputer;
- }
-
- public IExpressionTypeComputer getExpressionTypeComputer() {
- return expressionTypeComputer;
- }
-
- public void setClusterLocations(AlgebricksPartitionConstraint clusterLocations) {
- this.clusterLocations = clusterLocations;
- }
-
- public AlgebricksPartitionConstraint getClusterLocations() {
- return clusterLocations;
- }
-
- public void setNullWriterFactory(INullWriterFactory nullWriterFactory) {
- this.nullWriterFactory = nullWriterFactory;
- }
-
- public INullWriterFactory getNullWriterFactory() {
- return nullWriterFactory;
- }
-
- public void setExpressionEvalSizeComputer(IExpressionEvalSizeComputer expressionEvalSizeComputer) {
- this.expressionEvalSizeComputer = expressionEvalSizeComputer;
- }
-
- public IExpressionEvalSizeComputer getExpressionEvalSizeComputer() {
- return expressionEvalSizeComputer;
- }
-
- public void setNormalizedKeyComputerFactoryProvider(
- INormalizedKeyComputerFactoryProvider normalizedKeyComputerFactoryProvider) {
- this.normalizedKeyComputerFactoryProvider = normalizedKeyComputerFactoryProvider;
- }
-
- public INormalizedKeyComputerFactoryProvider getNormalizedKeyComputerFactoryProvider() {
- return normalizedKeyComputerFactoryProvider;
- }
-
- public IPartialAggregationTypeComputer getPartialAggregationTypeComputer() {
- return partialAggregationTypeComputer;
- }
-
- public void setPartialAggregationTypeComputer(IPartialAggregationTypeComputer partialAggregationTypeComputer) {
- this.partialAggregationTypeComputer = partialAggregationTypeComputer;
- }
-
- public IMergeAggregationExpressionFactory getIMergeAggregationExpressionFactory() {
- return mergeAggregationExpressionFactory;
- }
-
- public void setIMergeAggregationExpressionFactory(
- IMergeAggregationExpressionFactory mergeAggregationExpressionFactory) {
- this.mergeAggregationExpressionFactory = mergeAggregationExpressionFactory;
- }
-
- public PhysicalOptimizationConfig getPhysicalOptimizationConfig() {
- return physicalOptimizationConfig;
- }
-
- public void setPhysicalOptimizationConfig(PhysicalOptimizationConfig physicalOptimizationConfig) {
- this.physicalOptimizationConfig = physicalOptimizationConfig;
- }
-
- public void setNullableTypeComputer(INullableTypeComputer nullableTypeComputer) {
- this.nullableTypeComputer = nullableTypeComputer;
- }
-
- public INullableTypeComputer getNullableTypeComputer() {
- return nullableTypeComputer;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
deleted file mode 100644
index 26dc343..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
+++ /dev/null
@@ -1,107 +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.compiler.api;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-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.prettyprint.LogicalOperatorPrettyPrintVisitor;
-import edu.uci.ics.hyracks.algebricks.core.config.AlgebricksConfig;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.PlanCompiler;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IOptimizationContextFactory;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
-import edu.uci.ics.hyracks.api.job.IJobletEventListenerFactory;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public class HeuristicCompilerFactoryBuilder extends AbstractCompilerFactoryBuilder {
-
- public static class DefaultOptimizationContextFactory implements IOptimizationContextFactory {
-
- public static final DefaultOptimizationContextFactory INSTANCE = new DefaultOptimizationContextFactory();
-
- private DefaultOptimizationContextFactory() {
- }
-
- @Override
- public IOptimizationContext createOptimizationContext(int varCounter,
- IExpressionEvalSizeComputer expressionEvalSizeComputer,
- IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
- IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
- PhysicalOptimizationConfig physicalOptimizationConfig) {
- LogicalOperatorPrettyPrintVisitor prettyPrintVisitor = new LogicalOperatorPrettyPrintVisitor();
- return new AlgebricksOptimizationContext(varCounter, expressionEvalSizeComputer,
- mergeAggregationExpressionFactory, expressionTypeComputer, nullableTypeComputer,
- physicalOptimizationConfig, prettyPrintVisitor);
- }
- }
-
- private IOptimizationContextFactory optCtxFactory;
-
- public HeuristicCompilerFactoryBuilder() {
- this.optCtxFactory = DefaultOptimizationContextFactory.INSTANCE;
- }
-
- public HeuristicCompilerFactoryBuilder(IOptimizationContextFactory optCtxFactory) {
- this.optCtxFactory = optCtxFactory;
- }
-
- @Override
- public ICompilerFactory create() {
- return new ICompilerFactory() {
- @Override
- public ICompiler createCompiler(final ILogicalPlan plan, final IMetadataProvider<?, ?> metadata,
- int varCounter) {
- final IOptimizationContext oc = optCtxFactory.createOptimizationContext(varCounter,
- expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer,
- nullableTypeComputer, physicalOptimizationConfig);
- oc.setMetadataDeclarations(metadata);
- final HeuristicOptimizer opt = new HeuristicOptimizer(plan, logicalRewrites, physicalRewrites, oc);
- return new ICompiler() {
-
- @Override
- public void optimize() throws AlgebricksException {
- opt.optimize();
- }
-
- @Override
- public JobSpecification createJob(Object appContext,
- IJobletEventListenerFactory jobEventListenerFactory) throws AlgebricksException {
- AlgebricksConfig.ALGEBRICKS_LOGGER.fine("Starting Job Generation.\n");
- JobGenContext context = new JobGenContext(null, metadata, appContext,
- serializerDeserializerProvider, hashFunctionFactoryProvider,
- hashFunctionFamilyProvider, comparatorFactoryProvider, typeTraitProvider,
- binaryBooleanInspectorFactory, binaryIntegerInspectorFactory, printerProvider,
- nullWriterFactory, normalizedKeyComputerFactoryProvider, expressionRuntimeProvider,
- expressionTypeComputer, nullableTypeComputer, oc, expressionEvalSizeComputer,
- partialAggregationTypeComputer, predEvaluatorFactoryProvider,
- physicalOptimizationConfig.getFrameSize(), clusterLocations);
-
- PlanCompiler pc = new PlanCompiler(context);
- return pc.compilePlan(plan, null, jobEventListenerFactory);
- }
- };
- }
- };
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompiler.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompiler.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompiler.java
deleted file mode 100644
index 436be40..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompiler.java
+++ /dev/null
@@ -1,26 +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.compiler.api;
-
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.api.job.IJobletEventListenerFactory;
-import edu.uci.ics.hyracks.api.job.JobSpecification;
-
-public interface ICompiler {
- public void optimize() throws AlgebricksException;
-
- public JobSpecification createJob(Object appContext, IJobletEventListenerFactory jobEventListenerFactory)
- throws AlgebricksException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompilerFactory.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompilerFactory.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompilerFactory.java
deleted file mode 100644
index 66f3b81..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/api/ICompilerFactory.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.compiler.api;
-
-import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public interface ICompilerFactory {
- ICompiler createCompiler(ILogicalPlan plan, IMetadataProvider<?, ?> metadata, int varCounter);
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/PrioritizedRuleController.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/PrioritizedRuleController.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/PrioritizedRuleController.java
deleted file mode 100644
index 2062c5f..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/PrioritizedRuleController.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package edu.uci.ics.hyracks.algebricks.compiler.rewriter.rulecontrollers;
-
-import java.util.Collection;
-
-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.rewriter.base.AbstractRuleController;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-
-/**
- *
- * Runs each rule until it produces no changes. Then the whole collection of
- * rules is run again until no change is made.
- *
- *
- * @author Nicola
- *
- */
-
-public class PrioritizedRuleController extends AbstractRuleController {
-
- public PrioritizedRuleController() {
- super();
- }
-
- @Override
- public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root, Collection<IAlgebraicRewriteRule> rules)
- throws AlgebricksException {
- boolean anyRuleFired = false;
- boolean anyChange = false;
- do {
- anyChange = false;
- for (IAlgebraicRewriteRule r : rules) {
- while (true) {
- boolean ruleFired = rewriteOperatorRef(root, r);
- if (ruleFired) {
- anyChange = true;
- anyRuleFired = true;
- } else {
- break; // go to next rule
- }
- }
- }
- } while (anyChange);
- return anyRuleFired;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialFixpointRuleController.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialFixpointRuleController.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialFixpointRuleController.java
deleted file mode 100644
index 2f65c8a..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialFixpointRuleController.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.compiler.rewriter.rulecontrollers;
-
-import java.util.Collection;
-
-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.rewriter.base.AbstractRuleController;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-
-/**
- * Runs rules sequentially (round-robin), until one iteration over all rules
- * produces no change.
- *
- * @author Nicola
- */
-public class SequentialFixpointRuleController extends AbstractRuleController {
-
- private boolean fullDfs;
-
- public SequentialFixpointRuleController(boolean fullDfs) {
- super();
- this.fullDfs = fullDfs;
- }
-
- @Override
- public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root,
- Collection<IAlgebraicRewriteRule> ruleCollection) throws AlgebricksException {
- boolean anyRuleFired = false;
- boolean anyChange = false;
- do {
- anyChange = false;
- for (IAlgebraicRewriteRule rule : ruleCollection) {
- boolean ruleFired = rewriteOperatorRef(root, rule, true, fullDfs);
- if (ruleFired) {
- anyChange = true;
- anyRuleFired = true;
- }
- }
- } while (anyChange);
- return anyRuleFired;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialOnceRuleController.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialOnceRuleController.java b/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialOnceRuleController.java
deleted file mode 100644
index 0f8ec80..0000000
--- a/algebricks/algebricks-compiler/src/main/java/edu/uci/ics/hyracks/algebricks/compiler/rewriter/rulecontrollers/SequentialOnceRuleController.java
+++ /dev/null
@@ -1,46 +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.compiler.rewriter.rulecontrollers;
-
-import java.util.Collection;
-
-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.rewriter.base.AbstractRuleController;
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
-
-public class SequentialOnceRuleController extends AbstractRuleController {
-
- private final boolean enterNestedPlans;
-
- public SequentialOnceRuleController(boolean enterNestedPlans) {
- super();
- this.enterNestedPlans = enterNestedPlans;
- }
-
- @Override
- public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root, Collection<IAlgebraicRewriteRule> rules)
- throws AlgebricksException {
- boolean fired = false;
- for (IAlgebraicRewriteRule rule : rules) {
- if (rewriteOperatorRef(root, rule, enterNestedPlans, true)) {
- fired = true;
- }
- }
- return fired;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java b/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
new file mode 100644
index 0000000..3d92d68
--- /dev/null
+++ b/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
@@ -0,0 +1,230 @@
+/*
+ * 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.compiler.api;
+
+import java.util.List;
+
+import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IPartialAggregationTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryBooleanInspectorFactory;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFactoryProvider;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryHashFunctionFamilyProvider;
+import edu.uci.ics.hyracks.algebricks.data.IBinaryIntegerInspectorFactory;
+import edu.uci.ics.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactoryProvider;
+import edu.uci.ics.hyracks.algebricks.data.ISerializerDeserializerProvider;
+import edu.uci.ics.hyracks.algebricks.data.ITypeTraitProvider;
+import edu.uci.ics.hyracks.api.dataflow.value.INullWriterFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
+
+public abstract class AbstractCompilerFactoryBuilder {
+
+ protected List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> logicalRewrites;
+ protected List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> physicalRewrites;
+ protected ITypeTraitProvider typeTraitProvider;
+ protected ISerializerDeserializerProvider serializerDeserializerProvider;
+ protected IBinaryHashFunctionFactoryProvider hashFunctionFactoryProvider;
+ protected IBinaryHashFunctionFamilyProvider hashFunctionFamilyProvider;
+ protected IBinaryComparatorFactoryProvider comparatorFactoryProvider;
+ protected IBinaryBooleanInspectorFactory binaryBooleanInspectorFactory;
+ protected IBinaryIntegerInspectorFactory binaryIntegerInspectorFactory;
+ protected IPrinterFactoryProvider printerProvider;
+ protected IPredicateEvaluatorFactoryProvider predEvaluatorFactoryProvider;
+ protected IExpressionRuntimeProvider expressionRuntimeProvider;
+ protected IExpressionTypeComputer expressionTypeComputer;
+ protected INullableTypeComputer nullableTypeComputer;
+ protected IExpressionEvalSizeComputer expressionEvalSizeComputer;
+ protected INullWriterFactory nullWriterFactory;
+ protected INormalizedKeyComputerFactoryProvider normalizedKeyComputerFactoryProvider;
+ protected IPartialAggregationTypeComputer partialAggregationTypeComputer;
+ protected IMergeAggregationExpressionFactory mergeAggregationExpressionFactory;
+ protected PhysicalOptimizationConfig physicalOptimizationConfig = new PhysicalOptimizationConfig();
+ protected AlgebricksPartitionConstraint clusterLocations;
+
+ public abstract ICompilerFactory create();
+
+ public void setLogicalRewrites(List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> logicalRewrites) {
+ this.logicalRewrites = logicalRewrites;
+ }
+
+ public void setPhysicalRewrites(List<Pair<AbstractRuleController, List<IAlgebraicRewriteRule>>> physicalRewrites) {
+ this.physicalRewrites = physicalRewrites;
+ }
+
+ public void setTypeTraitProvider(ITypeTraitProvider typeTraitProvider) {
+ this.typeTraitProvider = typeTraitProvider;
+ }
+
+ public ITypeTraitProvider getTypeTraitProvider() {
+ return typeTraitProvider;
+ }
+
+ public void setSerializerDeserializerProvider(ISerializerDeserializerProvider serializerDeserializerProvider) {
+ this.serializerDeserializerProvider = serializerDeserializerProvider;
+ }
+
+ public ISerializerDeserializerProvider getSerializerDeserializerProvider() {
+ return serializerDeserializerProvider;
+ }
+
+ public void setHashFunctionFactoryProvider(IBinaryHashFunctionFactoryProvider hashFunctionFactoryProvider) {
+ this.hashFunctionFactoryProvider = hashFunctionFactoryProvider;
+ }
+
+ public IBinaryHashFunctionFactoryProvider getHashFunctionFactoryProvider() {
+ return hashFunctionFactoryProvider;
+ }
+
+ public void setHashFunctionFamilyProvider(IBinaryHashFunctionFamilyProvider hashFunctionFamilyProvider) {
+ this.hashFunctionFamilyProvider = hashFunctionFamilyProvider;
+ }
+
+ public IBinaryHashFunctionFamilyProvider getHashFunctionFamilyProvider() {
+ return hashFunctionFamilyProvider;
+ }
+
+ public void setComparatorFactoryProvider(IBinaryComparatorFactoryProvider comparatorFactoryProvider) {
+ this.comparatorFactoryProvider = comparatorFactoryProvider;
+ }
+
+ public IBinaryComparatorFactoryProvider getComparatorFactoryProvider() {
+ return comparatorFactoryProvider;
+ }
+
+ public void setPredicateEvaluatorFactoryProvider(IPredicateEvaluatorFactoryProvider predEvaluatorFactoryProvider) {
+ this.predEvaluatorFactoryProvider = predEvaluatorFactoryProvider;
+ }
+
+ public IPredicateEvaluatorFactoryProvider getPredicateEvaluatorFactory() {
+ return predEvaluatorFactoryProvider;
+ }
+
+ public void setBinaryBooleanInspectorFactory(IBinaryBooleanInspectorFactory binaryBooleanInspectorFactory) {
+ this.binaryBooleanInspectorFactory = binaryBooleanInspectorFactory;
+ }
+
+ public IBinaryBooleanInspectorFactory getBinaryBooleanInspectorFactory() {
+ return binaryBooleanInspectorFactory;
+ }
+
+ public void setBinaryIntegerInspectorFactory(IBinaryIntegerInspectorFactory binaryIntegerInspectorFactory) {
+ this.binaryIntegerInspectorFactory = binaryIntegerInspectorFactory;
+ }
+
+ public IBinaryIntegerInspectorFactory getBinaryIntegerInspectorFactory() {
+ return binaryIntegerInspectorFactory;
+ }
+
+ public void setPrinterProvider(IPrinterFactoryProvider printerProvider) {
+ this.printerProvider = printerProvider;
+ }
+
+ public IPrinterFactoryProvider getPrinterProvider() {
+ return printerProvider;
+ }
+
+ public void setExpressionRuntimeProvider(IExpressionRuntimeProvider expressionRuntimeProvider) {
+ this.expressionRuntimeProvider = expressionRuntimeProvider;
+ }
+
+ public IExpressionRuntimeProvider getExpressionRuntimeProvider() {
+ return expressionRuntimeProvider;
+ }
+
+ public void setExpressionTypeComputer(IExpressionTypeComputer expressionTypeComputer) {
+ this.expressionTypeComputer = expressionTypeComputer;
+ }
+
+ public IExpressionTypeComputer getExpressionTypeComputer() {
+ return expressionTypeComputer;
+ }
+
+ public void setClusterLocations(AlgebricksPartitionConstraint clusterLocations) {
+ this.clusterLocations = clusterLocations;
+ }
+
+ public AlgebricksPartitionConstraint getClusterLocations() {
+ return clusterLocations;
+ }
+
+ public void setNullWriterFactory(INullWriterFactory nullWriterFactory) {
+ this.nullWriterFactory = nullWriterFactory;
+ }
+
+ public INullWriterFactory getNullWriterFactory() {
+ return nullWriterFactory;
+ }
+
+ public void setExpressionEvalSizeComputer(IExpressionEvalSizeComputer expressionEvalSizeComputer) {
+ this.expressionEvalSizeComputer = expressionEvalSizeComputer;
+ }
+
+ public IExpressionEvalSizeComputer getExpressionEvalSizeComputer() {
+ return expressionEvalSizeComputer;
+ }
+
+ public void setNormalizedKeyComputerFactoryProvider(
+ INormalizedKeyComputerFactoryProvider normalizedKeyComputerFactoryProvider) {
+ this.normalizedKeyComputerFactoryProvider = normalizedKeyComputerFactoryProvider;
+ }
+
+ public INormalizedKeyComputerFactoryProvider getNormalizedKeyComputerFactoryProvider() {
+ return normalizedKeyComputerFactoryProvider;
+ }
+
+ public IPartialAggregationTypeComputer getPartialAggregationTypeComputer() {
+ return partialAggregationTypeComputer;
+ }
+
+ public void setPartialAggregationTypeComputer(IPartialAggregationTypeComputer partialAggregationTypeComputer) {
+ this.partialAggregationTypeComputer = partialAggregationTypeComputer;
+ }
+
+ public IMergeAggregationExpressionFactory getIMergeAggregationExpressionFactory() {
+ return mergeAggregationExpressionFactory;
+ }
+
+ public void setIMergeAggregationExpressionFactory(
+ IMergeAggregationExpressionFactory mergeAggregationExpressionFactory) {
+ this.mergeAggregationExpressionFactory = mergeAggregationExpressionFactory;
+ }
+
+ public PhysicalOptimizationConfig getPhysicalOptimizationConfig() {
+ return physicalOptimizationConfig;
+ }
+
+ public void setPhysicalOptimizationConfig(PhysicalOptimizationConfig physicalOptimizationConfig) {
+ this.physicalOptimizationConfig = physicalOptimizationConfig;
+ }
+
+ public void setNullableTypeComputer(INullableTypeComputer nullableTypeComputer) {
+ this.nullableTypeComputer = nullableTypeComputer;
+ }
+
+ public INullableTypeComputer getNullableTypeComputer() {
+ return nullableTypeComputer;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/9939b48e/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java b/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
new file mode 100644
index 0000000..26dc343
--- /dev/null
+++ b/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
@@ -0,0 +1,107 @@
+/*
+ * 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.compiler.api;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalPlan;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
+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.prettyprint.LogicalOperatorPrettyPrintVisitor;
+import edu.uci.ics.hyracks.algebricks.core.config.AlgebricksConfig;
+import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.JobGenContext;
+import edu.uci.ics.hyracks.algebricks.core.jobgen.impl.PlanCompiler;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.HeuristicOptimizer;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.IOptimizationContextFactory;
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
+import edu.uci.ics.hyracks.api.job.IJobletEventListenerFactory;
+import edu.uci.ics.hyracks.api.job.JobSpecification;
+
+public class HeuristicCompilerFactoryBuilder extends AbstractCompilerFactoryBuilder {
+
+ public static class DefaultOptimizationContextFactory implements IOptimizationContextFactory {
+
+ public static final DefaultOptimizationContextFactory INSTANCE = new DefaultOptimizationContextFactory();
+
+ private DefaultOptimizationContextFactory() {
+ }
+
+ @Override
+ public IOptimizationContext createOptimizationContext(int varCounter,
+ IExpressionEvalSizeComputer expressionEvalSizeComputer,
+ IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
+ IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
+ PhysicalOptimizationConfig physicalOptimizationConfig) {
+ LogicalOperatorPrettyPrintVisitor prettyPrintVisitor = new LogicalOperatorPrettyPrintVisitor();
+ return new AlgebricksOptimizationContext(varCounter, expressionEvalSizeComputer,
+ mergeAggregationExpressionFactory, expressionTypeComputer, nullableTypeComputer,
+ physicalOptimizationConfig, prettyPrintVisitor);
+ }
+ }
+
+ private IOptimizationContextFactory optCtxFactory;
+
+ public HeuristicCompilerFactoryBuilder() {
+ this.optCtxFactory = DefaultOptimizationContextFactory.INSTANCE;
+ }
+
+ public HeuristicCompilerFactoryBuilder(IOptimizationContextFactory optCtxFactory) {
+ this.optCtxFactory = optCtxFactory;
+ }
+
+ @Override
+ public ICompilerFactory create() {
+ return new ICompilerFactory() {
+ @Override
+ public ICompiler createCompiler(final ILogicalPlan plan, final IMetadataProvider<?, ?> metadata,
+ int varCounter) {
+ final IOptimizationContext oc = optCtxFactory.createOptimizationContext(varCounter,
+ expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer,
+ nullableTypeComputer, physicalOptimizationConfig);
+ oc.setMetadataDeclarations(metadata);
+ final HeuristicOptimizer opt = new HeuristicOptimizer(plan, logicalRewrites, physicalRewrites, oc);
+ return new ICompiler() {
+
+ @Override
+ public void optimize() throws AlgebricksException {
+ opt.optimize();
+ }
+
+ @Override
+ public JobSpecification createJob(Object appContext,
+ IJobletEventListenerFactory jobEventListenerFactory) throws AlgebricksException {
+ AlgebricksConfig.ALGEBRICKS_LOGGER.fine("Starting Job Generation.\n");
+ JobGenContext context = new JobGenContext(null, metadata, appContext,
+ serializerDeserializerProvider, hashFunctionFactoryProvider,
+ hashFunctionFamilyProvider, comparatorFactoryProvider, typeTraitProvider,
+ binaryBooleanInspectorFactory, binaryIntegerInspectorFactory, printerProvider,
+ nullWriterFactory, normalizedKeyComputerFactoryProvider, expressionRuntimeProvider,
+ expressionTypeComputer, nullableTypeComputer, oc, expressionEvalSizeComputer,
+ partialAggregationTypeComputer, predEvaluatorFactoryProvider,
+ physicalOptimizationConfig.getFrameSize(), clusterLocations);
+
+ PlanCompiler pc = new PlanCompiler(context);
+ return pc.compilePlan(plan, null, jobEventListenerFactory);
+ }
+ };
+ }
+ };
+ }
+
+}