SQL++ parser:
1. refactored asterix-aql to become asterix-lang-common and asterix-lang-aql, where the former is the common part for different languages;
2. added asterix-lang-sqlpp on top of asterix-lang-common;
3. ported parser tests, optimizer tests and runtime tests in asterix-app to their sql++ version, and added parser tests for all the queries.
Change-Id: Ie5af4e3b692ca017ec047a1ba3b404a51beb3a2e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/466
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-algebra/pom.xml b/asterix-algebra/pom.xml
index aaf5c90..3e76d43 100644
--- a/asterix-algebra/pom.xml
+++ b/asterix-algebra/pom.xml
@@ -1,22 +1,16 @@
-<!--
- ! Licensed to the Apache Software Foundation (ASF) under one
- ! or more contributor license agreements. See the NOTICE file
- ! distributed with this work for additional information
- ! regarding copyright ownership. The ASF licenses this file
- ! to you 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 at
- !
- ! 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.
- !-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- ! Licensed to the Apache Software Foundation (ASF) under one ! or more
+ contributor license agreements. See the NOTICE file ! distributed with this
+ work for additional information ! regarding copyright ownership. The ASF
+ licenses this file ! to you 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 at ! ! 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. ! -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>asterix</artifactId>
@@ -98,7 +92,13 @@
</dependency>
<dependency>
<groupId>org.apache.asterix</groupId>
- <artifactId>asterix-aql</artifactId>
+ <artifactId>asterix-lang-aql</artifactId>
+ <version>0.8.8-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.asterix</groupId>
+ <artifactId>asterix-lang-sqlpp</artifactId>
<version>0.8.8-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalExpressionDeepCopyVisitor.java b/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalExpressionDeepCopyVisitor.java
index 3d4e31f..47066d2 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalExpressionDeepCopyVisitor.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalExpressionDeepCopyVisitor.java
@@ -82,8 +82,8 @@
}
// TODO return List<...>
- public ArrayList<Mutable<ILogicalExpression>> deepCopyExpressionReferenceList(List<Mutable<ILogicalExpression>> list)
- throws AlgebricksException {
+ public ArrayList<Mutable<ILogicalExpression>> deepCopyExpressionReferenceList(
+ List<Mutable<ILogicalExpression>> list) throws AlgebricksException {
ArrayList<Mutable<ILogicalExpression>> listCopy = new ArrayList<Mutable<ILogicalExpression>>(list.size());
for (Mutable<ILogicalExpression> exprRef : list) {
listCopy.add(deepCopyExpressionReference(exprRef));
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java b/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
index ad3b9cf..7d63ecc 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/LogicalOperatorDeepCopyVisitor.java
@@ -26,7 +26,6 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.algebricks.core.algebra.base.Counter;
@@ -76,10 +75,12 @@
private final Counter counter;
private final LogicalExpressionDeepCopyVisitor exprDeepCopyVisitor;
- // Key: Variable in the original plan. Value: New variable replacing the original one in the copied plan.
+ // Key: Variable in the original plan. Value: New variable replacing the
+ // original one in the copied plan.
private final Map<LogicalVariable, LogicalVariable> outVarMapping = new HashMap<LogicalVariable, LogicalVariable>();
- // Key: Variable in the original plan. Value: Variable with which to replace original variable in the plan copy.
+ // Key: Variable in the original plan. Value: Variable with which to replace
+ // original variable in the plan copy.
private final Map<LogicalVariable, LogicalVariable> inVarMapping;
public LogicalOperatorDeepCopyVisitor(Counter counter) {
@@ -93,7 +94,8 @@
* Starting variable counter.
* @param inVarMapping
* Variable mapping keyed by variables in the original plan.
- * Those variables are replaced by their corresponding value in the map in the copied plan.
+ * Those variables are replaced by their corresponding value in
+ * the map in the copied plan.
*/
public LogicalOperatorDeepCopyVisitor(Counter counter, Map<LogicalVariable, LogicalVariable> inVarMapping) {
this.counter = counter;
@@ -280,10 +282,10 @@
@Override
public ILogicalOperator visitGroupByOperator(GroupByOperator op, ILogicalOperator arg) throws AlgebricksException {
- List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByListCopy = deepCopyVariableExpressionReferencePairList(op
- .getGroupByList());
- List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorListCopy = deepCopyVariableExpressionReferencePairList(op
- .getDecorList());
+ List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByListCopy = deepCopyVariableExpressionReferencePairList(
+ op.getGroupByList());
+ List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> decorListCopy = deepCopyVariableExpressionReferencePairList(
+ op.getDecorList());
List<ILogicalPlan> nestedPlansCopy = new ArrayList<ILogicalPlan>();
GroupByOperator opCopy = new GroupByOperator(groupByListCopy, decorListCopy, nestedPlansCopy);
@@ -297,9 +299,10 @@
@Override
public ILogicalOperator visitInnerJoinOperator(InnerJoinOperator op, ILogicalOperator arg)
throws AlgebricksException {
- InnerJoinOperator opCopy = new InnerJoinOperator(exprDeepCopyVisitor.deepCopyExpressionReference(op
- .getCondition()), deepCopyOperatorReference(op.getInputs().get(0), null), deepCopyOperatorReference(op
- .getInputs().get(1), null));
+ InnerJoinOperator opCopy = new InnerJoinOperator(
+ exprDeepCopyVisitor.deepCopyExpressionReference(op.getCondition()),
+ deepCopyOperatorReference(op.getInputs().get(0), null),
+ deepCopyOperatorReference(op.getInputs().get(1), null));
copyAnnotations(op, opCopy);
opCopy.setExecutionMode(op.getExecutionMode());
return opCopy;
@@ -470,4 +473,5 @@
throws AlgebricksException {
throw new UnsupportedOperationException();
}
+
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
index 04ef9ca..778d0bb 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
@@ -21,8 +21,7 @@
import java.util.ArrayList;
import org.apache.commons.lang3.mutable.Mutable;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.asterix.om.base.AFloat;
import org.apache.asterix.om.base.AInt32;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AddEquivalenceClassForRecordConstructorRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AddEquivalenceClassForRecordConstructorRule.java
index 366e82e..ce8d95c 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AddEquivalenceClassForRecordConstructorRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AddEquivalenceClassForRecordConstructorRule.java
@@ -26,8 +26,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
import org.mortbay.util.SingletonList;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.base.AInt32;
import org.apache.asterix.om.constants.AsterixConstantValue;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -60,7 +59,8 @@
public class AddEquivalenceClassForRecordConstructorRule implements IAlgebraicRewriteRule {
@Override
- public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+ public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+ throws AlgebricksException {
return false;
}
@@ -117,8 +117,8 @@
ILogicalExpression expr = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX),
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(recordVar)),
- new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(
- new AInt32(parameterIndex / 2))))); // Every two parameters corresponds to a field.
+ new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AInt32(parameterIndex / 2))))); // Every two parameters corresponds to a field.
EquivalenceClass equivClass = new EquivalenceClass(SingletonList.newSingletonList(fieldVar), fieldVar,
SingletonList.newSingletonList(expr));
ecs.put(fieldVar, equivClass);
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByHandleFieldAccessRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByHandleFieldAccessRule.java
index 2c7f126..f5887be 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByHandleFieldAccessRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByHandleFieldAccessRule.java
@@ -23,9 +23,8 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
import org.apache.asterix.algebra.base.AsterixOperatorAnnotations;
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
index 8debc7a..2329bad 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
@@ -25,9 +25,8 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
import org.apache.asterix.algebra.base.AsterixOperatorAnnotations;
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.base.AInt32;
import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.base.IAObject;
@@ -57,7 +56,8 @@
public class ByNameToByIndexFieldAccessRule implements IAlgebraicRewriteRule {
@Override
- public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+ public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+ throws AlgebricksException {
return false;
}
@@ -156,9 +156,8 @@
return null;
}
return new ScalarFunctionCallExpression(
- FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX),
- fce.getArguments().get(0), new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(new AInt32(k)))));
+ FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX), fce.getArguments().get(0),
+ new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(k)))));
}
private static String getStringSecondArgument(AbstractFunctionCallExpression expr) {
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CancelUnnestWithNestedListifyRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CancelUnnestWithNestedListifyRule.java
index f43a12d..a46570b 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CancelUnnestWithNestedListifyRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/CancelUnnestWithNestedListifyRule.java
@@ -25,8 +25,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FeedScanCollectionToUnnest.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FeedScanCollectionToUnnest.java
index 4cb6ac6..941ff2d 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FeedScanCollectionToUnnest.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FeedScanCollectionToUnnest.java
@@ -23,8 +23,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
index cbe8afa..182a4e6 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
@@ -23,8 +23,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.asterix.om.base.IAObject;
import org.apache.asterix.om.constants.AsterixConstantValue;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
index 0969469..6faf77c 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
@@ -26,13 +26,12 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
import org.apache.asterix.algebra.base.LogicalOperatorDeepCopyVisitor;
-import org.apache.asterix.aql.base.Clause;
-import org.apache.asterix.aql.expression.Identifier;
import org.apache.asterix.aqlplus.parser.AQLPlusParser;
import org.apache.asterix.aqlplus.parser.ParseException;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.om.types.IAType;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IfElseToSwitchCaseFunctionRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IfElseToSwitchCaseFunctionRule.java
index 9d964f0..4fc88ea 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IfElseToSwitchCaseFunctionRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IfElseToSwitchCaseFunctionRule.java
@@ -23,8 +23,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
index 70b4d7d..8a1b0c6 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
@@ -23,8 +23,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlDataSource;
import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
import org.apache.asterix.metadata.declared.DatasetDataSource;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
index 5742f97..5e687dd 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
@@ -24,8 +24,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlDataSource;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.om.typecomputer.base.TypeComputerUtilities;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index 6eb3807..8b8769f 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -29,11 +29,10 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlDataSource;
import org.apache.asterix.metadata.declared.AqlIndex;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceUnnestForCollectionToSequenceRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceUnnestForCollectionToSequenceRule.java
index b661ef1..ab517fd 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceUnnestForCollectionToSequenceRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceUnnestForCollectionToSequenceRule.java
@@ -22,8 +22,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.om.types.IAType;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullPositionalVariableFromUnnestRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullPositionalVariableFromUnnestRule.java
index cec1b49..69acd35 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullPositionalVariableFromUnnestRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullPositionalVariableFromUnnestRule.java
@@ -22,8 +22,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
index 8c42457..85728bd 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveRedundantListifyRule.java
@@ -25,8 +25,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.ListSet;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
index 7cf5812..61af836 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetClosedRecordConstructorsRule.java
@@ -19,9 +19,8 @@
package org.apache.asterix.optimizer.rules;
import org.apache.commons.lang3.mutable.Mutable;
-
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.config.GlobalConfig;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.asterix.om.typecomputer.base.TypeComputerUtilities;
import org.apache.asterix.om.types.AOrderedListType;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SimilarityCheckRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SimilarityCheckRule.java
index b3781fc..9da0a58 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SimilarityCheckRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SimilarityCheckRule.java
@@ -23,9 +23,8 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.base.ADouble;
import org.apache.asterix.om.base.AFloat;
import org.apache.asterix.om.base.AInt32;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SweepIllegalNonfunctionalFunctions.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SweepIllegalNonfunctionalFunctions.java
index 3d74203..a22edca 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SweepIllegalNonfunctionalFunctions.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SweepIllegalNonfunctionalFunctions.java
@@ -21,7 +21,6 @@
import java.util.List;
import org.apache.commons.lang3.mutable.Mutable;
-
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
@@ -76,7 +75,8 @@
}
@Override
- public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+ public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+ throws AlgebricksException {
return false;
}
@@ -100,8 +100,8 @@
if (expr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
if (!expr.isFunctional()) {
AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr;
- throw new AlgebricksException("Found non-functional function " + fce.getFunctionIdentifier()
- + " in op " + op);
+ throw new AlgebricksException(
+ "Found non-functional function " + fce.getFunctionIdentifier() + " in op " + op);
}
}
}
@@ -291,10 +291,10 @@
}
@Override
- public Void visitExternalDataLookupOperator(ExternalDataLookupOperator op, Void arg) throws AlgebricksException {
+ public Void visitExternalDataLookupOperator(ExternalDataLookupOperator op, Void arg)
+ throws AlgebricksException {
return null;
}
-
}
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
index d274259..1c356c2 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
@@ -97,7 +97,7 @@
protected void fillSubTreeIndexExprs(OptimizableOperatorSubTree subTree,
Map<IAccessMethod, AccessMethodAnalysisContext> analyzedAMs, IOptimizationContext context)
- throws AlgebricksException {
+ throws AlgebricksException {
Iterator<Map.Entry<IAccessMethod, AccessMethodAnalysisContext>> amIt = analyzedAMs.entrySet().iterator();
// Check applicability of indexes by access method type.
while (amIt.hasNext()) {
@@ -156,7 +156,8 @@
|| chosenIndex.getIndexType() == IndexType.SINGLE_PARTITION_NGRAM_INVIX)
isKeywordOrNgramIndexChosen = true;
if ((chosenAccessMethod == BTreeAccessMethod.INSTANCE && chosenIndex.getIndexType() != IndexType.BTREE)
- || (chosenAccessMethod == RTreeAccessMethod.INSTANCE && chosenIndex.getIndexType() != IndexType.RTREE)
+ || (chosenAccessMethod == RTreeAccessMethod.INSTANCE
+ && chosenIndex.getIndexType() != IndexType.RTREE)
|| (chosenAccessMethod == InvertedIndexAccessMethod.INSTANCE && !isKeywordOrNgramIndexChosen)) {
continue;
}
@@ -226,7 +227,8 @@
if (indexedTypes.size() < 2 && optFuncExpr.getNumLogicalVars() == 1
&& optFuncExpr.getNumConstantAtRuntimeExpr() > 0) {
indexedTypes.add((IAType) AqlExpressionTypeComputer.INSTANCE.getType(
- optFuncExpr.getConstantAtRuntimeExpr(0), context.getMetadataProvider(), typeEnvironment));
+ optFuncExpr.getConstantAtRuntimeExpr(0), context.getMetadataProvider(),
+ typeEnvironment));
}
//infer type of logicalExpr based on index keyType
@@ -243,7 +245,7 @@
@Override
public Object getVarType(LogicalVariable var, List<LogicalVariable> nonNullVariables,
List<List<LogicalVariable>> correlatedNullableVariableLists)
- throws AlgebricksException {
+ throws AlgebricksException {
if (var.equals(optFuncExpr.getSourceVar(exprAndVarIdx.second)))
return keyType;
throw new IllegalArgumentException();
@@ -417,7 +419,7 @@
protected boolean fillIndexExprs(List<Index> datasetIndexes, List<String> fieldName, IAType fieldType,
IOptimizableFuncExpr optFuncExpr, int matchedFuncExprIndex, int varIdx,
OptimizableOperatorSubTree matchedSubTree, AccessMethodAnalysisContext analysisCtx)
- throws AlgebricksException {
+ throws AlgebricksException {
List<Index> indexCandidates = new ArrayList<Index>();
// Add an index to the candidates if one of the indexed fields is
// fieldName
@@ -448,7 +450,8 @@
subTree.dataset.getDatasetName());
for (IOptimizableFuncExpr optFuncExpr : analysisCtx.matchedFuncExprs) {
// Try to match variables from optFuncExpr to assigns or unnests.
- for (int assignOrUnnestIndex = 0; assignOrUnnestIndex < subTree.assignsAndUnnests.size(); assignOrUnnestIndex++) {
+ for (int assignOrUnnestIndex = 0; assignOrUnnestIndex < subTree.assignsAndUnnests
+ .size(); assignOrUnnestIndex++) {
AbstractLogicalOperator op = subTree.assignsAndUnnests.get(assignOrUnnestIndex);
if (op.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
AssignOperator assignOp = (AssignOperator) op;
@@ -465,13 +468,13 @@
// Remember matching subtree.
optFuncExpr.setOptimizableSubTree(optVarIndex, subTree);
List<String> fieldName = getFieldNameFromSubTree(optFuncExpr, subTree, assignOrUnnestIndex,
- varIndex, subTree.recordType, optVarIndex, optFuncExpr.getFuncExpr().getArguments()
- .get(optVarIndex).getValue());
+ varIndex, subTree.recordType, optVarIndex,
+ optFuncExpr.getFuncExpr().getArguments().get(optVarIndex).getValue());
if (fieldName == null) {
continue;
}
- IAType fieldType = (IAType) context.getOutputTypeEnvironment(assignOp).getType(
- optFuncExpr.getLogicalExpr(optVarIndex));
+ IAType fieldType = (IAType) context.getOutputTypeEnvironment(assignOp)
+ .getType(optFuncExpr.getLogicalExpr(optVarIndex));
// Set the fieldName in the corresponding matched
// function expression.
optFuncExpr.setFieldName(optVarIndex, fieldName);
@@ -506,8 +509,8 @@
continue;
}
}
- IAType fieldType = (IAType) context.getOutputTypeEnvironment(unnestOp).getType(
- optFuncExpr.getLogicalExpr(funcVarIndex));
+ IAType fieldType = (IAType) context.getOutputTypeEnvironment(unnestOp)
+ .getType(optFuncExpr.getLogicalExpr(funcVarIndex));
// Set the fieldName in the corresponding matched function
// expression.
optFuncExpr.setFieldName(funcVarIndex, fieldName);
@@ -549,7 +552,7 @@
private void matchVarsFromOptFuncExprToDataSourceScan(IOptimizableFuncExpr optFuncExpr, int optFuncExprIndex,
List<Index> datasetIndexes, List<LogicalVariable> dsVarList, OptimizableOperatorSubTree subTree,
AccessMethodAnalysisContext analysisCtx, IOptimizationContext context, boolean fromAdditionalDataSource)
- throws AlgebricksException {
+ throws AlgebricksException {
for (int varIndex = 0; varIndex < dsVarList.size(); varIndex++) {
LogicalVariable var = dsVarList.get(varIndex);
int funcVarIndex = optFuncExpr.findLogicalVar(var);
@@ -565,10 +568,11 @@
fieldName = DatasetUtils.getPartitioningKeys(subTree.dataset).get(varIndex);
fieldType = (IAType) context.getOutputTypeEnvironment(subTree.dataSourceRef.getValue()).getVarType(var);
} else {
- fieldName = DatasetUtils.getPartitioningKeys(subTree.ixJoinOuterAdditionalDatasets.get(varIndex)).get(
- varIndex);
- fieldType = (IAType) context.getOutputTypeEnvironment(
- subTree.ixJoinOuterAdditionalDataSourceRefs.get(varIndex).getValue()).getVarType(var);
+ fieldName = DatasetUtils.getPartitioningKeys(subTree.ixJoinOuterAdditionalDatasets.get(varIndex))
+ .get(varIndex);
+ fieldType = (IAType) context
+ .getOutputTypeEnvironment(subTree.ixJoinOuterAdditionalDataSourceRefs.get(varIndex).getValue())
+ .getVarType(var);
}
// Set the fieldName in the corresponding matched function
// expression, and remember matching subtree.
@@ -587,8 +591,8 @@
private void setTypeTag(IOptimizationContext context, OptimizableOperatorSubTree subTree,
IOptimizableFuncExpr optFuncExpr, int funcVarIndex) throws AlgebricksException {
// Set the typeTag if the type is not null
- IAType type = (IAType) context.getOutputTypeEnvironment(subTree.root).getVarType(
- optFuncExpr.getLogicalVar(funcVarIndex));
+ IAType type = (IAType) context.getOutputTypeEnvironment(subTree.root)
+ .getVarType(optFuncExpr.getLogicalVar(funcVarIndex));
optFuncExpr.setFieldType(funcVarIndex, type);
}
@@ -599,9 +603,9 @@
*
* @throws AlgebricksException
*/
- protected List<String> getFieldNameFromSubTree(IOptimizableFuncExpr optFuncExpr,
- OptimizableOperatorSubTree subTree, int opIndex, int assignVarIndex, ARecordType recordType,
- int funcVarIndex, ILogicalExpression parentFuncExpr) throws AlgebricksException {
+ protected List<String> getFieldNameFromSubTree(IOptimizableFuncExpr optFuncExpr, OptimizableOperatorSubTree subTree,
+ int opIndex, int assignVarIndex, ARecordType recordType, int funcVarIndex,
+ ILogicalExpression parentFuncExpr) throws AlgebricksException {
// Get expression corresponding to opVar at varIndex.
AbstractLogicalExpression expr = null;
AbstractFunctionCallExpression childFuncExpr = null;
@@ -714,7 +718,8 @@
if (!isByName) {
try {
- fieldName = ((ARecordType) recordType.getSubFieldType(parentFieldNames)).getFieldNames()[fieldIndex];
+ fieldName = ((ARecordType) recordType.getSubFieldType(parentFieldNames))
+ .getFieldNames()[fieldIndex];
} catch (IOException e) {
throw new AlgebricksException(e);
}
@@ -768,7 +773,8 @@
LogicalVariable curVar = ((VariableReferenceExpression) argExpr).getVariableReference();
// We look for the assign or unnest operator that produces curVar below
// the current operator
- for (int assignOrUnnestIndex = opIndex + 1; assignOrUnnestIndex < subTree.assignsAndUnnests.size(); assignOrUnnestIndex++) {
+ for (int assignOrUnnestIndex = opIndex + 1; assignOrUnnestIndex < subTree.assignsAndUnnests
+ .size(); assignOrUnnestIndex++) {
AbstractLogicalOperator curOp = subTree.assignsAndUnnests.get(assignOrUnnestIndex);
if (curOp.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
AssignOperator assignOp = (AssignOperator) curOp;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodAnalysisContext.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodAnalysisContext.java
index fda0dc3..b17cdfe 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodAnalysisContext.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodAnalysisContext.java
@@ -45,7 +45,7 @@
// Maps from index to the dataset it is indexing.
public Map<Index, Dataset> indexDatasetMap = new TreeMap<Index, Dataset>();
-
+
// Maps from an index to the number of matched fields in the query plan (for performing prefix search)
public Map<Index, Integer> indexNumMatchedKeys = new TreeMap<Index, Integer>();
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodJobGenParams.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodJobGenParams.java
index 8d64d6c..1f3d869 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodJobGenParams.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodJobGenParams.java
@@ -102,7 +102,7 @@
public boolean getRetainInput() {
return retainInput;
}
-
+
public boolean getRetainNull() {
return retainNull;
}
@@ -112,8 +112,8 @@
}
protected void writeVarList(List<LogicalVariable> varList, List<Mutable<ILogicalExpression>> funcArgs) {
- Mutable<ILogicalExpression> numKeysRef = new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(new AInt32(varList.size()))));
+ Mutable<ILogicalExpression> numKeysRef = new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AInt32(varList.size()))));
funcArgs.add(numKeysRef);
for (LogicalVariable keyVar : varList) {
Mutable<ILogicalExpression> keyVarRef = new MutableObject<ILogicalExpression>(
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
index b2c26a8..25e39c6 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
@@ -26,10 +26,10 @@
import java.util.Set;
import org.apache.asterix.algebra.operators.physical.ExternalDataLookupPOperator;
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.declared.AqlSourceId;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
@@ -186,8 +186,8 @@
} else {
return false;
}
- OptimizableFuncExpr newOptFuncExpr = new OptimizableFuncExpr(funcExpr, new LogicalVariable[] { fieldVar1,
- fieldVar2 }, new ILogicalExpression[0], new IAType[0]);
+ OptimizableFuncExpr newOptFuncExpr = new OptimizableFuncExpr(funcExpr,
+ new LogicalVariable[] { fieldVar1, fieldVar2 }, new ILogicalExpression[0], new IAType[0]);
for (IOptimizableFuncExpr optFuncExpr : analysisCtx.matchedFuncExprs) {
//avoid additional optFuncExpressions in case of a join
if (optFuncExpr.getFuncExpr().equals(funcExpr))
@@ -230,8 +230,8 @@
case SINGLE_PARTITION_WORD_INVIX:
case SINGLE_PARTITION_NGRAM_INVIX: {
for (int i = 0; i < index.getKeyFieldNames().size(); i++) {
- Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(index.getKeyFieldTypes()
- .get(i), index.getKeyFieldNames().get(i), recordType);
+ Pair<IAType, Boolean> keyPairType = Index.getNonNullableOpenFieldType(
+ index.getKeyFieldTypes().get(i), index.getKeyFieldNames().get(i), recordType);
dest.add(keyPairType.first);
}
break;
@@ -275,7 +275,7 @@
public static void appendSecondaryIndexOutputVars(Dataset dataset, ARecordType recordType, Index index,
boolean primaryKeysOnly, IOptimizationContext context, List<LogicalVariable> dest)
- throws AlgebricksException {
+ throws AlgebricksException {
int numPrimaryKeys = 0;
if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
numPrimaryKeys = IndexingConstants.getRIDSize(dataset);
@@ -329,7 +329,7 @@
*/
public static Pair<ILogicalExpression, Boolean> createSearchKeyExpr(IOptimizableFuncExpr optFuncExpr,
OptimizableOperatorSubTree indexSubTree, OptimizableOperatorSubTree probeSubTree)
- throws AlgebricksException {
+ throws AlgebricksException {
if (probeSubTree == null) {
// We are optimizing a selection query. Search key is a constant.
// Type Checking and type promotion is done here
@@ -390,11 +390,11 @@
} else {
// We are optimizing a join query. Determine which variable feeds the secondary index.
if (optFuncExpr.getOperatorSubTree(0) == null || optFuncExpr.getOperatorSubTree(0) == probeSubTree) {
- return new Pair<ILogicalExpression, Boolean>(new VariableReferenceExpression(
- optFuncExpr.getLogicalVar(0)), false);
+ return new Pair<ILogicalExpression, Boolean>(
+ new VariableReferenceExpression(optFuncExpr.getLogicalVar(0)), false);
} else {
- return new Pair<ILogicalExpression, Boolean>(new VariableReferenceExpression(
- optFuncExpr.getLogicalVar(1)), false);
+ return new Pair<ILogicalExpression, Boolean>(
+ new VariableReferenceExpression(optFuncExpr.getLogicalVar(1)), false);
}
}
}
@@ -402,7 +402,8 @@
/**
* Returns the first expr optimizable by this index.
*/
- public static IOptimizableFuncExpr chooseFirstOptFuncExpr(Index chosenIndex, AccessMethodAnalysisContext analysisCtx) {
+ public static IOptimizableFuncExpr chooseFirstOptFuncExpr(Index chosenIndex,
+ AccessMethodAnalysisContext analysisCtx) {
List<Pair<Integer, Integer>> indexExprs = analysisCtx.getIndexExprs(chosenIndex);
int firstExprIndex = indexExprs.get(0).first;
return analysisCtx.matchedFuncExprs.get(firstExprIndex);
@@ -434,7 +435,8 @@
// This is the operator that jobgen will be looking for. It contains an unnest function that has all necessary arguments to determine
// which index to use, which variables contain the index-search keys, what is the original dataset, etc.
UnnestMapOperator secondaryIndexUnnestOp = new UnnestMapOperator(secondaryIndexUnnestVars,
- new MutableObject<ILogicalExpression>(secondaryIndexSearchFunc), secondaryIndexOutputTypes, retainInput);
+ new MutableObject<ILogicalExpression>(secondaryIndexSearchFunc), secondaryIndexOutputTypes,
+ retainInput);
secondaryIndexUnnestOp.getInputs().add(new MutableObject<ILogicalOperator>(inputOp));
context.computeAndSetTypeEnvironmentForOperator(secondaryIndexUnnestOp);
secondaryIndexUnnestOp.setExecutionMode(ExecutionMode.PARTITIONED);
@@ -444,7 +446,7 @@
public static UnnestMapOperator createPrimaryIndexUnnestMap(AbstractDataSourceOperator dataSourceOp,
Dataset dataset, ARecordType recordType, ILogicalOperator inputOp, IOptimizationContext context,
boolean sortPrimaryKeys, boolean retainInput, boolean retainNull, boolean requiresBroadcast)
- throws AlgebricksException {
+ throws AlgebricksException {
List<LogicalVariable> primaryKeyVars = AccessMethodUtils.getPrimaryKeyVarsFromSecondaryUnnestMap(dataset,
inputOp);
// Optionally add a sort on the primary-index keys before searching the primary index.
@@ -454,8 +456,8 @@
for (LogicalVariable pkVar : primaryKeyVars) {
Mutable<ILogicalExpression> vRef = new MutableObject<ILogicalExpression>(
new VariableReferenceExpression(pkVar));
- order.getOrderExpressions().add(
- new Pair<IOrder, Mutable<ILogicalExpression>>(OrderOperator.ASC_ORDER, vRef));
+ order.getOrderExpressions()
+ .add(new Pair<IOrder, Mutable<ILogicalExpression>>(OrderOperator.ASC_ORDER, vRef));
}
// The secondary-index search feeds into the sort.
order.getInputs().add(new MutableObject<ILogicalOperator>(inputOp));
@@ -519,12 +521,14 @@
.equals(AlgebricksBuiltinFunctions.NOT)) {
ScalarFunctionCallExpression notFuncExpr = (ScalarFunctionCallExpression) selectOp
.getCondition().getValue();
- if (notFuncExpr.getArguments().get(0).getValue().getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+ if (notFuncExpr.getArguments().get(0).getValue()
+ .getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
if (((AbstractFunctionCallExpression) notFuncExpr.getArguments().get(0).getValue())
.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.IS_NULL)) {
isNullFuncExpr = (ScalarFunctionCallExpression) notFuncExpr.getArguments().get(0)
.getValue();
- if (isNullFuncExpr.getArguments().get(0).getValue().getExpressionTag() == LogicalExpressionTag.VARIABLE) {
+ if (isNullFuncExpr.getArguments().get(0).getValue()
+ .getExpressionTag() == LogicalExpressionTag.VARIABLE) {
foundSelectNonNull = true;
break;
}
@@ -570,8 +574,8 @@
}
private static void writeVarList(List<LogicalVariable> varList, List<Mutable<ILogicalExpression>> funcArgs) {
- Mutable<ILogicalExpression> numKeysRef = new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(new AInt32(varList.size()))));
+ Mutable<ILogicalExpression> numKeysRef = new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AInt32(varList.size()))));
funcArgs.add(numKeysRef);
for (LogicalVariable keyVar : varList) {
Mutable<ILogicalExpression> keyVarRef = new MutableObject<ILogicalExpression>(
@@ -581,8 +585,8 @@
}
private static void addStringArg(String argument, List<Mutable<ILogicalExpression>> funcArgs) {
- Mutable<ILogicalExpression> stringRef = new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(new AString(argument))));
+ Mutable<ILogicalExpression> stringRef = new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AString(argument))));
funcArgs.add(stringRef);
}
@@ -595,10 +599,10 @@
// add a sort on the RID fields before fetching external data.
OrderOperator order = new OrderOperator();
for (LogicalVariable pkVar : primaryKeyVars) {
- Mutable<ILogicalExpression> vRef = new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- pkVar));
- order.getOrderExpressions().add(
- new Pair<IOrder, Mutable<ILogicalExpression>>(OrderOperator.ASC_ORDER, vRef));
+ Mutable<ILogicalExpression> vRef = new MutableObject<ILogicalExpression>(
+ new VariableReferenceExpression(pkVar));
+ order.getOrderExpressions()
+ .add(new Pair<IOrder, Mutable<ILogicalExpression>>(OrderOperator.ASC_ORDER, vRef));
}
// The secondary-index search feeds into the sort.
order.getInputs().add(new MutableObject<ILogicalOperator>(inputOp));
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
index de28e4a..b795fcb 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/BTreeAccessMethod.java
@@ -28,10 +28,10 @@
import java.util.List;
import java.util.Set;
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.annotations.SkipSecondaryIndexSearchExpressionAnnotation;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.om.types.ARecordType;
@@ -79,6 +79,7 @@
// TODO: There is some redundancy here, since these are listed in AlgebricksBuiltinFunctions as well.
private static List<FunctionIdentifier> funcIdents = new ArrayList<FunctionIdentifier>();
+
static {
funcIdents.add(AlgebricksBuiltinFunctions.EQ);
funcIdents.add(AlgebricksBuiltinFunctions.LE);
@@ -217,7 +218,7 @@
Mutable<ILogicalExpression> conditionRef, OptimizableOperatorSubTree indexSubTree,
OptimizableOperatorSubTree probeSubTree, Index chosenIndex, AccessMethodAnalysisContext analysisCtx,
boolean retainInput, boolean retainNull, boolean requiresBroadcast, IOptimizationContext context)
- throws AlgebricksException {
+ throws AlgebricksException {
Dataset dataset = indexSubTree.dataset;
ARecordType recordType = indexSubTree.recordType;
// we made sure indexSubTree has datasource scan
@@ -268,8 +269,8 @@
throw new AlgebricksException(
"Could not match optimizable function expression to any index field name.");
}
- Pair<ILogicalExpression, Boolean> returnedSearchKeyExpr = AccessMethodUtils.createSearchKeyExpr(
- optFuncExpr, indexSubTree, probeSubTree);
+ Pair<ILogicalExpression, Boolean> returnedSearchKeyExpr = AccessMethodUtils.createSearchKeyExpr(optFuncExpr,
+ indexSubTree, probeSubTree);
ILogicalExpression searchKeyExpr = returnedSearchKeyExpr.first;
if (searchKeyExpr.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
constantAtRuntimeExpressions[keyPos] = searchKeyExpr;
@@ -435,8 +436,8 @@
// determine cases when prefix search could be applied
for (int i = 1; i < lowKeyExprs.length; i++) {
- if (lowKeyLimits[0] == null && lowKeyLimits[i] != null || lowKeyLimits[0] != null
- && lowKeyLimits[i] == null || highKeyLimits[0] == null && highKeyLimits[i] != null
+ if (lowKeyLimits[0] == null && lowKeyLimits[i] != null || lowKeyLimits[0] != null && lowKeyLimits[i] == null
+ || highKeyLimits[0] == null && highKeyLimits[i] != null
|| highKeyLimits[0] != null && highKeyLimits[i] == null) {
numSecondaryKeys--;
primaryIndexPostProccessingIsNeeded = true;
@@ -608,8 +609,8 @@
}
private LimitType getLimitType(IOptimizableFuncExpr optFuncExpr, OptimizableOperatorSubTree probeSubTree) {
- ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(optFuncExpr.getFuncExpr()
- .getFunctionIdentifier());
+ ComparisonKind ck = AlgebricksBuiltinFunctions
+ .getComparisonType(optFuncExpr.getFuncExpr().getFunctionIdentifier());
LimitType limit = null;
switch (ck) {
case EQ: {
@@ -669,12 +670,11 @@
return false;
}
}
- if (!index.isPrimaryIndex()
- && optFuncExpr.getFuncExpr().getAnnotations()
- .containsKey(SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE)) {
+ if (!index.isPrimaryIndex() && optFuncExpr.getFuncExpr().getAnnotations()
+ .containsKey(SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE)) {
return false;
}
// No additional analysis required for BTrees.
return true;
}
-}
\ No newline at end of file
+}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
index 4c150c0..dd30415 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
@@ -86,6 +86,7 @@
// Register access methods.
protected static Map<FunctionIdentifier, List<IAccessMethod>> accessMethods = new HashMap<FunctionIdentifier, List<IAccessMethod>>();
+
static {
registerAccessMethod(BTreeAccessMethod.INSTANCE, accessMethods);
registerAccessMethod(RTreeAccessMethod.INSTANCE, accessMethods);
@@ -253,7 +254,8 @@
if (op1.getInputs().size() != 1) {
return false;
}
- if (((AbstractLogicalOperator) op1.getInputs().get(0).getValue()).getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
+ if (((AbstractLogicalOperator) op1.getInputs().get(0).getValue())
+ .getOperatorTag() != LogicalOperatorTag.LEFTOUTERJOIN) {
return false;
}
if (op1.getOperatorTag() == LogicalOperatorTag.GROUP) {
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
index f374b9a..4af06e1 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
@@ -67,7 +67,8 @@
protected IVariableTypeEnvironment typeEnvironment = null;
@Override
- public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
+ public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
+ throws AlgebricksException {
return false;
}
@@ -92,8 +93,8 @@
ARecordType recType = null;
if (dataset != null && dataset.getDatasetType() == DatasetType.INTERNAL) {
filterFieldName = DatasetUtils.getFilterField(dataset);
- IAType itemType = ((AqlMetadataProvider) context.getMetadataProvider()).findType(
- dataset.getDataverseName(), dataset.getItemTypeName());
+ IAType itemType = ((AqlMetadataProvider) context.getMetadataProvider()).findType(dataset.getDataverseName(),
+ dataset.getItemTypeName());
if (itemType.getTypeTag() == ATypeTag.RECORD) {
recType = (ARecordType) itemType;
}
@@ -101,8 +102,8 @@
if (filterFieldName == null || recType == null) {
return false;
}
- List<Index> datasetIndexes = ((AqlMetadataProvider) context.getMetadataProvider()).getDatasetIndexes(
- dataset.getDataverseName(), dataset.getDatasetName());
+ List<Index> datasetIndexes = ((AqlMetadataProvider) context.getMetadataProvider())
+ .getDatasetIndexes(dataset.getDataverseName(), dataset.getDatasetName());
List<IOptimizableFuncExpr> optFuncExprs = new ArrayList<IOptimizableFuncExpr>();
@@ -129,8 +130,8 @@
List<Mutable<ILogicalExpression>> assignKeyExprList = new ArrayList<Mutable<ILogicalExpression>>();
for (IOptimizableFuncExpr optFuncExpr : optFuncExprs) {
- ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(optFuncExpr.getFuncExpr()
- .getFunctionIdentifier());
+ ComparisonKind ck = AlgebricksBuiltinFunctions
+ .getComparisonType(optFuncExpr.getFuncExpr().getFunctionIdentifier());
ILogicalExpression searchKeyExpr = optFuncExpr.getConstantAtRuntimeExpr(0);
LogicalVariable var = context.newVar();
assignKeyExprList.add(new MutableObject<ILogicalExpression>(searchKeyExpr));
@@ -166,14 +167,14 @@
List<Mutable<ILogicalExpression>> additionalFilteringExpressions = new ArrayList<Mutable<ILogicalExpression>>();;
for (LogicalVariable var : assignOp.getVariables()) {
- additionalFilteringExpressions.add(new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(var)));
+ additionalFilteringExpressions
+ .add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(var)));
}
dataSourceScanOp.setAdditionalFilteringExpressions(additionalFilteringExpressions);
- assignOp.getInputs().add(
- new MutableObject<ILogicalOperator>(dataSourceScanOp.getInputs().get(0).getValue()));
+ assignOp.getInputs()
+ .add(new MutableObject<ILogicalOperator>(dataSourceScanOp.getInputs().get(0).getValue()));
dataSourceScanOp.getInputs().get(0).setValue(assignOp);
}
} else if (descendantOp.getOperatorTag() == LogicalOperatorTag.UNNEST_MAP) {
@@ -199,12 +200,12 @@
List<Mutable<ILogicalExpression>> additionalFilteringExpressions = new ArrayList<Mutable<ILogicalExpression>>();;
for (LogicalVariable var : assignOp.getVariables()) {
- additionalFilteringExpressions.add(new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(var)));
+ additionalFilteringExpressions
+ .add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(var)));
}
unnestMapOp.setAdditionalFilteringExpressions(additionalFilteringExpressions);
- assignOp.getInputs().add(
- new MutableObject<ILogicalOperator>(unnestMapOp.getInputs().get(0).getValue()));
+ assignOp.getInputs()
+ .add(new MutableObject<ILogicalOperator>(unnestMapOp.getInputs().get(0).getValue()));
unnestMapOp.getInputs().get(0).setValue(assignOp);
}
}
@@ -234,8 +235,8 @@
}
AccessMethodJobGenParams jobGenParams = new AccessMethodJobGenParams();
jobGenParams.readFromFuncArgs(f.getArguments());
- return ((AqlMetadataProvider) context.getMetadataProvider()).findDataset(
- jobGenParams.dataverseName, jobGenParams.datasetName);
+ return ((AqlMetadataProvider) context.getMetadataProvider()).findDataset(jobGenParams.dataverseName,
+ jobGenParams.datasetName);
}
}
if (descendantOp.getInputs().isEmpty()) {
@@ -304,7 +305,8 @@
if (funcVarIndex == -1) {
continue;
}
- List<String> fieldName = getFieldNameFromSubAssignTree(optFuncExpr, descendantOp, varIndex, recType).second;
+ List<String> fieldName = getFieldNameFromSubAssignTree(optFuncExpr, descendantOp, varIndex,
+ recType).second;
if (fieldName == null) {
return false;
}
@@ -416,7 +418,8 @@
}
//get the nested info from the lower input
Pair<ARecordType, List<String>> lowerInfo = getFieldNameFromSubAssignTree(optFuncExpr,
- (AbstractLogicalOperator) op.getInputs().get(varCheck).getValue(), nestedAssignVar, recType);
+ (AbstractLogicalOperator) op.getInputs().get(varCheck).getValue(), nestedAssignVar,
+ recType);
if (lowerInfo != null) {
recType = lowerInfo.first;
returnList = lowerInfo.second;
@@ -430,8 +433,8 @@
return null;
}
ConstantExpression constExpr = (ConstantExpression) nameArg;
- returnList.addAll(Arrays.asList(((AString) ((AsterixConstantValue) constExpr.getValue()).getObject())
- .getStringValue()));
+ returnList.addAll(Arrays.asList(
+ ((AString) ((AsterixConstantValue) constExpr.getValue()).getObject()).getStringValue()));
return new Pair<ARecordType, List<String>>(recType, returnList);
} else if (funcIdent == AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX) {
ILogicalExpression idxArg = funcExpr.getArguments().get(1).getValue();
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
index 7414c93..40e8712 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
@@ -75,6 +75,7 @@
// Register access methods.
protected static Map<FunctionIdentifier, List<IAccessMethod>> accessMethods = new HashMap<FunctionIdentifier, List<IAccessMethod>>();
+
static {
registerAccessMethod(BTreeAccessMethod.INSTANCE, accessMethods);
registerAccessMethod(RTreeAccessMethod.INSTANCE, accessMethods);
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
index f3e3574..1ab6708 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
@@ -25,12 +25,12 @@
import java.util.Map;
import org.apache.asterix.algebra.base.LogicalOperatorDeepCopyVisitor;
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.annotations.SkipSecondaryIndexSearchExpressionAnnotation;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer;
import org.apache.asterix.formats.nontagged.AqlBinaryTokenizerFactoryProvider;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.om.base.AFloat;
@@ -99,6 +99,7 @@
}
private static List<FunctionIdentifier> funcIdents = new ArrayList<FunctionIdentifier>();
+
static {
funcIdents.add(AsterixBuiltinFunctions.STRING_CONTAINS);
// For matching similarity-check functions. For example, similarity-jaccard-check returns a list of two items,
@@ -109,6 +110,7 @@
// These function identifiers are matched in this AM's analyzeFuncExprArgs(),
// and are not visible to the outside driver.
private static HashSet<FunctionIdentifier> secondLevelFuncIdents = new HashSet<FunctionIdentifier>();
+
static {
secondLevelFuncIdents.add(AsterixBuiltinFunctions.SIMILARITY_JACCARD_CHECK);
secondLevelFuncIdents.add(AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK);
@@ -140,7 +142,7 @@
public boolean analyzeGetItemFuncExpr(AbstractFunctionCallExpression funcExpr,
List<AbstractLogicalOperator> assignsAndUnnests, AccessMethodAnalysisContext analysisCtx)
- throws AlgebricksException {
+ throws AlgebricksException {
if (funcExpr.getFunctionIdentifier() != AsterixBuiltinFunctions.GET_ITEM) {
return false;
}
@@ -248,8 +250,8 @@
if (fieldVarExpr2 == null) {
return false;
}
- OptimizableFuncExpr newOptFuncExpr = new OptimizableFuncExpr(funcExpr, new LogicalVariable[] { fieldVarExpr1,
- fieldVarExpr2 }, new ILogicalExpression[] { arg3 },
+ OptimizableFuncExpr newOptFuncExpr = new OptimizableFuncExpr(funcExpr,
+ new LogicalVariable[] { fieldVarExpr1, fieldVarExpr2 }, new ILogicalExpression[] { arg3 },
new IAType[] { (IAType) AqlExpressionTypeComputer.INSTANCE.getType(arg3, null, null) });
for (IOptimizableFuncExpr optFuncExpr : analysisCtx.matchedFuncExprs) {
//avoid additional optFuncExpressions in case of a join
@@ -297,8 +299,8 @@
}
OptimizableFuncExpr newOptFuncExpr = new OptimizableFuncExpr(funcExpr, new LogicalVariable[] { fieldVarExpr },
- new ILogicalExpression[] { constArg, arg3 }, new IAType[] {
- (IAType) AqlExpressionTypeComputer.INSTANCE.getType(constArg, null, null),
+ new ILogicalExpression[] { constArg, arg3 },
+ new IAType[] { (IAType) AqlExpressionTypeComputer.INSTANCE.getType(constArg, null, null),
(IAType) AqlExpressionTypeComputer.INSTANCE.getType(arg3, null, null) });
for (IOptimizableFuncExpr optFuncExpr : analysisCtx.matchedFuncExprs) {
//avoid additional optFuncExpressions in case of a join
@@ -360,7 +362,7 @@
private ILogicalOperator createSecondaryToPrimaryPlan(OptimizableOperatorSubTree indexSubTree,
OptimizableOperatorSubTree probeSubTree, Index chosenIndex, IOptimizableFuncExpr optFuncExpr,
boolean retainInput, boolean retainNull, boolean requiresBroadcast, IOptimizationContext context)
- throws AlgebricksException {
+ throws AlgebricksException {
Dataset dataset = indexSubTree.dataset;
ARecordType recordType = indexSubTree.recordType;
// we made sure indexSubTree has datasource scan
@@ -412,7 +414,8 @@
* index that optimizes optFuncExpr by replacing rewriting indexSubTree
* (which is the original subtree that will be replaced by the index plan).
*/
- private LogicalVariable getInputSearchVar(IOptimizableFuncExpr optFuncExpr, OptimizableOperatorSubTree indexSubTree) {
+ private LogicalVariable getInputSearchVar(IOptimizableFuncExpr optFuncExpr,
+ OptimizableOperatorSubTree indexSubTree) {
if (optFuncExpr.getOperatorSubTree(0) == indexSubTree) {
// If the index is on a dataset in subtree 0, then subtree 1 will feed.
return optFuncExpr.getLogicalVar(1);
@@ -462,9 +465,8 @@
// The arguments of edit-distance-contains() function are asymmetrical, we can only use index
// if the dataset of index subtree and the dataset of first argument's subtree is the same
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS
- && optFuncExpr.getOperatorSubTree(0).dataset != null
- && !optFuncExpr.getOperatorSubTree(0).dataset.getDatasetName().equals(
- indexSubTree.dataset.getDatasetName())) {
+ && optFuncExpr.getOperatorSubTree(0).dataset != null && !optFuncExpr.getOperatorSubTree(0).dataset
+ .getDatasetName().equals(indexSubTree.dataset.getDatasetName())) {
return false;
}
@@ -489,8 +491,8 @@
// Copy probe subtree, replacing their variables with new ones. We will use the original variables
// to stitch together a top-level equi join.
- Mutable<ILogicalOperator> originalProbeSubTreeRootRef = copyAndReinitProbeSubTree(probeSubTree, join
- .getCondition().getValue(), optFuncExpr, originalSubTreePKs, surrogateSubTreePKs, context);
+ Mutable<ILogicalOperator> originalProbeSubTreeRootRef = copyAndReinitProbeSubTree(probeSubTree,
+ join.getCondition().getValue(), optFuncExpr, originalSubTreePKs, surrogateSubTreePKs, context);
// Remember original live variables from the index sub tree.
List<LogicalVariable> indexSubTreeLiveVars = new ArrayList<LogicalVariable>();
@@ -502,7 +504,8 @@
Mutable<ILogicalOperator> panicJoinRef = null;
Map<LogicalVariable, LogicalVariable> panicVarMap = null;
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK
- || optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
+ || optFuncExpr.getFuncExpr()
+ .getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
panicJoinRef = new MutableObject<ILogicalOperator>(joinRef.getValue());
panicVarMap = new HashMap<LogicalVariable, LogicalVariable>();
Mutable<ILogicalOperator> newProbeRootRef = createPanicNestedLoopJoinPlan(panicJoinRef, indexSubTree,
@@ -646,7 +649,8 @@
int numPKVars = originalSubTreePKs.size();
for (int i = 0; i < numPKVars; i++) {
List<Mutable<ILogicalExpression>> args = new ArrayList<Mutable<ILogicalExpression>>();
- args.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(surrogateSubTreePKs.get(i))));
+ args.add(
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(surrogateSubTreePKs.get(i))));
args.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(originalSubTreePKs.get(i))));
ILogicalExpression eqFunc = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AlgebricksBuiltinFunctions.EQ), args);
@@ -728,15 +732,15 @@
switch (inputSearchVarType.getTypeTag()) {
case STRING: {
List<Mutable<ILogicalExpression>> isFilterableArgs = new ArrayList<Mutable<ILogicalExpression>>(4);
- isFilterableArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- inputSearchVar)));
+ isFilterableArgs
+ .add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(inputSearchVar)));
// Since we are optimizing a join, the similarity threshold should be the only constant in the optimizable function expression.
isFilterableArgs.add(new MutableObject<ILogicalExpression>(optFuncExpr.getConstantAtRuntimeExpr(0)));
- isFilterableArgs.add(new MutableObject<ILogicalExpression>(AccessMethodUtils
- .createInt32Constant(chosenIndex.getGramLength())));
+ isFilterableArgs.add(new MutableObject<ILogicalExpression>(
+ AccessMethodUtils.createInt32Constant(chosenIndex.getGramLength())));
boolean usePrePost = optFuncExpr.containsPartialField() ? false : true;
- isFilterableArgs.add(new MutableObject<ILogicalExpression>(AccessMethodUtils
- .createBooleanConstant(usePrePost)));
+ isFilterableArgs.add(
+ new MutableObject<ILogicalExpression>(AccessMethodUtils.createBooleanConstant(usePrePost)));
isFilterableExpr = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE),
isFilterableArgs);
@@ -745,8 +749,8 @@
case UNORDEREDLIST:
case ORDEREDLIST: {
List<Mutable<ILogicalExpression>> isFilterableArgs = new ArrayList<Mutable<ILogicalExpression>>(2);
- isFilterableArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- inputSearchVar)));
+ isFilterableArgs
+ .add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(inputSearchVar)));
// Since we are optimizing a join, the similarity threshold should be the only constant in the optimizable function expression.
isFilterableArgs.add(new MutableObject<ILogicalExpression>(optFuncExpr.getConstantAtRuntimeExpr(0)));
isFilterableExpr = new ScalarFunctionCallExpression(
@@ -770,8 +774,8 @@
isNotFilterableArgs.add(new MutableObject<ILogicalExpression>(isFilterableExpr));
ILogicalExpression isNotFilterableExpr = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.NOT), isNotFilterableArgs);
- SelectOperator isNotFilterableSelectOp = new SelectOperator(new MutableObject<ILogicalExpression>(
- isNotFilterableExpr), false, null);
+ SelectOperator isNotFilterableSelectOp = new SelectOperator(
+ new MutableObject<ILogicalExpression>(isNotFilterableExpr), false, null);
isNotFilterableSelectOp.getInputs().add(new MutableObject<ILogicalOperator>(inputOp));
isNotFilterableSelectOp.setExecutionMode(ExecutionMode.LOCAL);
context.computeAndSetTypeEnvironmentForOperator(isNotFilterableSelectOp);
@@ -814,25 +818,26 @@
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.SIMILARITY_JACCARD_CHECK) {
jobGenParams.setSearchModifierType(SearchModifierType.JACCARD);
// Add the similarity threshold which, by convention, is the last constant value.
- jobGenParams.setSimilarityThreshold(((ConstantExpression) optFuncExpr.getConstantAtRuntimeExpr(optFuncExpr
- .getNumConstantAtRuntimeExpr() - 1)).getValue());
+ jobGenParams.setSimilarityThreshold(((ConstantExpression) optFuncExpr
+ .getConstantAtRuntimeExpr(optFuncExpr.getNumConstantAtRuntimeExpr() - 1)).getValue());
}
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK
- || optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
+ || optFuncExpr.getFuncExpr()
+ .getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
if (optFuncExpr.containsPartialField()) {
jobGenParams.setSearchModifierType(SearchModifierType.CONJUNCTIVE_EDIT_DISTANCE);
} else {
jobGenParams.setSearchModifierType(SearchModifierType.EDIT_DISTANCE);
}
// Add the similarity threshold which, by convention, is the last constant value.
- jobGenParams.setSimilarityThreshold(((ConstantExpression) optFuncExpr.getConstantAtRuntimeExpr(optFuncExpr
- .getNumConstantAtRuntimeExpr() - 1)).getValue());
+ jobGenParams.setSimilarityThreshold(((ConstantExpression) optFuncExpr
+ .getConstantAtRuntimeExpr(optFuncExpr.getNumConstantAtRuntimeExpr() - 1)).getValue());
}
}
private void addKeyVarsAndExprs(IOptimizableFuncExpr optFuncExpr, ArrayList<LogicalVariable> keyVarList,
ArrayList<Mutable<ILogicalExpression>> keyExprList, IOptimizationContext context)
- throws AlgebricksException {
+ throws AlgebricksException {
// For now we are assuming a single secondary index key.
// Add a variable and its expr to the lists which will be passed into an assign op.
LogicalVariable keyVar = context.newVar();
@@ -849,7 +854,8 @@
}
if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CHECK
- || optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
+ || optFuncExpr.getFuncExpr()
+ .getFunctionIdentifier() == AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS) {
return isEditDistanceFuncOptimizable(index, optFuncExpr);
}
@@ -882,13 +888,13 @@
private boolean isEditDistanceFuncCompatible(ATypeTag typeTag, IndexType indexType) {
// We can only optimize edit distance on strings using an ngram index.
- if (typeTag == ATypeTag.STRING
- && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
+ if (typeTag == ATypeTag.STRING && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
return true;
}
// We can only optimize edit distance on lists using a word index.
- if ((typeTag == ATypeTag.ORDEREDLIST)
- && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
+ if ((typeTag == ATypeTag.ORDEREDLIST) && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
return true;
}
return false;
@@ -908,8 +914,8 @@
return false;
}
- AsterixConstantValue intConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantAtRuntimeExpr(1))
- .getValue();
+ AsterixConstantValue intConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr
+ .getConstantAtRuntimeExpr(1)).getValue();
IAObject intObj = intConstVal.getObject();
AInt32 edThresh = null;
@@ -933,8 +939,8 @@
}
}
- if ((typeTag == ATypeTag.ORDEREDLIST)
- && (index.getIndexType() == IndexType.SINGLE_PARTITION_WORD_INVIX || index.getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
+ if ((typeTag == ATypeTag.ORDEREDLIST) && (index.getIndexType() == IndexType.SINGLE_PARTITION_WORD_INVIX
+ || index.getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
IACollection alist = (IACollection) listOrStrObj;
// Compute merge threshold.
mergeThreshold = alist.size() - edThresh.getIntegerValue();
@@ -956,7 +962,8 @@
for (int i = 0; i < variableCount; i++) {
funcExpr = findTokensFunc(AsterixBuiltinFunctions.GRAM_TOKENS, optFuncExpr, i);
if (funcExpr != null) {
- return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType());
+ return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(),
+ index.getIndexType());
}
}
@@ -964,7 +971,8 @@
for (int i = 0; i < variableCount; i++) {
funcExpr = findTokensFunc(AsterixBuiltinFunctions.WORD_TOKENS, optFuncExpr, i);
if (funcExpr != null) {
- return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType());
+ return isJaccardFuncCompatible(funcExpr, optFuncExpr.getFieldType(i).getTypeTag(),
+ index.getIndexType());
}
}
@@ -978,8 +986,8 @@
targetVar = optFuncExpr.getLogicalVar(i);
if (targetVar == null)
continue;
- return isJaccardFuncCompatible(optFuncExpr.getFuncExpr().getArguments().get(i).getValue(), optFuncExpr
- .getFieldType(i).getTypeTag(), index.getIndexType());
+ return isJaccardFuncCompatible(optFuncExpr.getFuncExpr().getArguments().get(i).getValue(),
+ optFuncExpr.getFieldType(i).getTypeTag(), index.getIndexType());
}
return false;
@@ -1027,18 +1035,21 @@
AbstractFunctionCallExpression nonConstfuncExpr = (AbstractFunctionCallExpression) nonConstArg;
// We can use this index if the tokenization function matches the index type.
if (nonConstfuncExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.WORD_TOKENS
- && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
+ && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
return true;
}
if (nonConstfuncExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.GRAM_TOKENS
- && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
+ && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
return true;
}
}
if (nonConstArg.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
if ((typeTag == ATypeTag.ORDEREDLIST || typeTag == ATypeTag.UNORDEREDLIST)
- && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
+ && (indexType == IndexType.SINGLE_PARTITION_WORD_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_WORD_INVIX)) {
return true;
}
// We assume that the given list variable doesn't have ngram list in it since it is unrealistic.
@@ -1055,8 +1066,8 @@
}
private boolean isContainsFuncSelectOptimizable(Index index, IOptimizableFuncExpr optFuncExpr) {
- AsterixConstantValue strConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr.getConstantAtRuntimeExpr(0))
- .getValue();
+ AsterixConstantValue strConstVal = (AsterixConstantValue) ((ConstantExpression) optFuncExpr
+ .getConstantAtRuntimeExpr(0)).getValue();
IAObject strObj = strConstVal.getObject();
ATypeTag typeTag = strObj.getType().getTypeTag();
@@ -1083,8 +1094,8 @@
private boolean isContainsFuncCompatible(ATypeTag typeTag, IndexType indexType) {
//We can only optimize contains with ngram indexes.
- if ((typeTag == ATypeTag.STRING)
- && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
+ if ((typeTag == ATypeTag.STRING) && (indexType == IndexType.SINGLE_PARTITION_NGRAM_INVIX
+ || indexType == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX)) {
return true;
}
return false;
@@ -1100,8 +1111,8 @@
case SINGLE_PARTITION_NGRAM_INVIX:
case LENGTH_PARTITIONED_NGRAM_INVIX: {
// Make sure not to use pre- and postfixing for conjunctive searches.
- boolean prePost = (searchModifierType == SearchModifierType.CONJUNCTIVE || searchModifierType == SearchModifierType.CONJUNCTIVE_EDIT_DISTANCE) ? false
- : true;
+ boolean prePost = (searchModifierType == SearchModifierType.CONJUNCTIVE
+ || searchModifierType == SearchModifierType.CONJUNCTIVE_EDIT_DISTANCE) ? false : true;
return AqlBinaryTokenizerFactoryProvider.INSTANCE.getNGramTokenizerFactory(searchKeyType,
index.getGramLength(), prePost, false);
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexJobGenParams.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexJobGenParams.java
index f78172c..52f6e7f 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexJobGenParams.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexJobGenParams.java
@@ -72,13 +72,13 @@
public void writeToFuncArgs(List<Mutable<ILogicalExpression>> funcArgs) {
super.writeToFuncArgs(funcArgs);
// Write search modifier type.
- funcArgs.add(new MutableObject<ILogicalExpression>(AccessMethodUtils.createInt32Constant(searchModifierType
- .ordinal())));
+ funcArgs.add(new MutableObject<ILogicalExpression>(
+ AccessMethodUtils.createInt32Constant(searchModifierType.ordinal())));
// Write similarity threshold.
funcArgs.add(new MutableObject<ILogicalExpression>(new ConstantExpression(similarityThreshold)));
// Write search key type.
- funcArgs.add(new MutableObject<ILogicalExpression>(AccessMethodUtils.createInt32Constant(searchKeyType
- .ordinal())));
+ funcArgs.add(
+ new MutableObject<ILogicalExpression>(AccessMethodUtils.createInt32Constant(searchKeyType.ordinal())));
// Write key var list.
writeVarList(keyVarList, funcArgs);
// Write non-key var list.
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
index e9e55db..9c71011 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/RTreeAccessMethod.java
@@ -21,10 +21,11 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.common.annotations.SkipSecondaryIndexSearchExpressionAnnotation;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.om.base.AInt32;
@@ -61,6 +62,7 @@
public class RTreeAccessMethod implements IAccessMethod {
private static List<FunctionIdentifier> funcIdents = new ArrayList<FunctionIdentifier>();
+
static {
funcIdents.add(AsterixBuiltinFunctions.SPATIAL_INTERSECT);
}
@@ -168,8 +170,8 @@
private ILogicalOperator createSecondaryToPrimaryPlan(OptimizableOperatorSubTree indexSubTree,
OptimizableOperatorSubTree probeSubTree, Index chosenIndex, IOptimizableFuncExpr optFuncExpr,
- AccessMethodAnalysisContext analysisCtx, boolean retainInput, boolean retainNull,
- boolean requiresBroadcast, IOptimizationContext context) throws AlgebricksException {
+ AccessMethodAnalysisContext analysisCtx, boolean retainInput, boolean retainNull, boolean requiresBroadcast,
+ IOptimizationContext context) throws AlgebricksException {
Dataset dataset = indexSubTree.dataset;
ARecordType recordType = indexSubTree.recordType;
@@ -206,13 +208,11 @@
// Spatial object is the constant from the func expr we are optimizing.
createMBR.getArguments().add(new MutableObject<ILogicalExpression>(searchKeyExpr));
// The number of dimensions.
- createMBR.getArguments().add(
- new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(new AInt32(
- numDimensions)))));
+ createMBR.getArguments().add(new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AInt32(numDimensions)))));
// Which part of the MBR to extract.
- createMBR.getArguments().add(
- new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(new AInt32(i)))));
+ createMBR.getArguments().add(new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AInt32(i)))));
// Add a variable and its expr to the lists which will be passed into an assign op.
LogicalVariable keyVar = context.newVar();
keyVarList.add(keyVar);
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
index 420a330..9c50cf5 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/temporal/TranslateIntervalExpressionRule.java
@@ -23,8 +23,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
index 5c286b7..3e8bbb1 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/typecast/StaticTypeCastUtil.java
@@ -27,8 +27,7 @@
import org.apache.commons.lang3.mutable.Mutable;
import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.om.base.ANull;
import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.constants.AsterixConstantValue;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/EquivalenceClassUtils.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/EquivalenceClassUtils.java
index c0a1585..fe029d7 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/EquivalenceClassUtils.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/EquivalenceClassUtils.java
@@ -25,9 +25,8 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.mortbay.util.SingletonList;
-
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.InternalDatasetDetails;
import org.apache.asterix.om.base.AInt32;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractAqlTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractAqlTranslator.java
index 9acdcb7..f14adb1 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractAqlTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractAqlTranslator.java
@@ -23,15 +23,15 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.expression.DatasetDecl;
-import org.apache.asterix.aql.expression.DataverseDropStatement;
-import org.apache.asterix.aql.expression.DeleteStatement;
-import org.apache.asterix.aql.expression.DropStatement;
-import org.apache.asterix.aql.expression.InsertStatement;
-import org.apache.asterix.aql.expression.NodeGroupDropStatement;
import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.statement.DatasetDecl;
+import org.apache.asterix.lang.common.statement.DataverseDropStatement;
+import org.apache.asterix.lang.common.statement.DeleteStatement;
+import org.apache.asterix.lang.common.statement.DropStatement;
+import org.apache.asterix.lang.common.statement.InsertStatement;
+import org.apache.asterix.lang.common.statement.NodeGroupDropStatement;
import org.apache.asterix.metadata.bootstrap.MetadataConstants;
import org.apache.asterix.metadata.dataset.hints.DatasetHints;
import org.apache.asterix.metadata.entities.AsterixBuiltinTypeMap;
@@ -53,8 +53,8 @@
public void validateOperation(Dataverse defaultDataverse, Statement stmt) throws AsterixException {
- if (!(AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE) && AsterixClusterProperties.INSTANCE
- .isGlobalRecoveryCompleted())) {
+ if (!(AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE)
+ && AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted())) {
int maxWaitCycles = AsterixAppContextInfo.getInstance().getExternalProperties().getMaxWaitClusterActive();
int waitCycleCount = 0;
try {
@@ -65,13 +65,12 @@
}
} catch (InterruptedException e) {
if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.warning("Thread interrupted while waiting for cluster to be "
- + ClusterState.ACTIVE);
+ LOGGER.warning("Thread interrupted while waiting for cluster to be " + ClusterState.ACTIVE);
}
}
if (!AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE)) {
- throw new AsterixException(" Asterix Cluster is in " + ClusterState.UNUSABLE
- + " state." + "\n One or more Node Controllers have left or haven't joined yet.\n");
+ throw new AsterixException(" Asterix Cluster is in " + ClusterState.UNUSABLE + " state."
+ + "\n One or more Node Controllers have left or haven't joined yet.\n");
} else {
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Cluster is now " + ClusterState.ACTIVE);
@@ -88,7 +87,8 @@
int maxWaitCycles = AsterixAppContextInfo.getInstance().getExternalProperties().getMaxWaitClusterActive();
int waitCycleCount = 0;
try {
- while (!AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted() && waitCycleCount < maxWaitCycles) {
+ while (!AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted()
+ && waitCycleCount < maxWaitCycles) {
Thread.sleep(1000);
waitCycleCount++;
}
@@ -141,8 +141,8 @@
case DATAVERSE_DROP:
DataverseDropStatement dvDropStmt = (DataverseDropStatement) stmt;
- invalidOperation = MetadataConstants.METADATA_DATAVERSE_NAME.equals(dvDropStmt.getDataverseName()
- .getValue());
+ invalidOperation = MetadataConstants.METADATA_DATAVERSE_NAME
+ .equals(dvDropStmt.getDataverseName().getValue());
if (invalidOperation) {
message = "Cannot drop dataverse:" + dvDropStmt.getDataverseName().getValue();
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
index 8730e92..daff5b7 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -25,82 +25,79 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.base.Clause;
-import org.apache.asterix.aql.base.Expression;
-import org.apache.asterix.aql.base.Expression.Kind;
-import org.apache.asterix.aql.expression.CallExpr;
-import org.apache.asterix.aql.expression.CompactStatement;
-import org.apache.asterix.aql.expression.ConnectFeedStatement;
-import org.apache.asterix.aql.expression.CreateDataverseStatement;
-import org.apache.asterix.aql.expression.CreateFeedPolicyStatement;
-import org.apache.asterix.aql.expression.CreateFunctionStatement;
-import org.apache.asterix.aql.expression.CreateIndexStatement;
-import org.apache.asterix.aql.expression.CreatePrimaryFeedStatement;
-import org.apache.asterix.aql.expression.CreateSecondaryFeedStatement;
-import org.apache.asterix.aql.expression.DatasetDecl;
-import org.apache.asterix.aql.expression.DataverseDecl;
-import org.apache.asterix.aql.expression.DataverseDropStatement;
-import org.apache.asterix.aql.expression.DeleteStatement;
-import org.apache.asterix.aql.expression.DisconnectFeedStatement;
-import org.apache.asterix.aql.expression.DistinctClause;
-import org.apache.asterix.aql.expression.DropStatement;
-import org.apache.asterix.aql.expression.FLWOGRExpression;
-import org.apache.asterix.aql.expression.FeedDropStatement;
-import org.apache.asterix.aql.expression.FeedPolicyDropStatement;
-import org.apache.asterix.aql.expression.FieldAccessor;
-import org.apache.asterix.aql.expression.FieldBinding;
-import org.apache.asterix.aql.expression.ForClause;
-import org.apache.asterix.aql.expression.FunctionDecl;
-import org.apache.asterix.aql.expression.FunctionDropStatement;
-import org.apache.asterix.aql.expression.GbyVariableExpressionPair;
-import org.apache.asterix.aql.expression.GroupbyClause;
-import org.apache.asterix.aql.expression.IfExpr;
-import org.apache.asterix.aql.expression.IndexAccessor;
-import org.apache.asterix.aql.expression.IndexDropStatement;
-import org.apache.asterix.aql.expression.InsertStatement;
-import org.apache.asterix.aql.expression.LetClause;
-import org.apache.asterix.aql.expression.LimitClause;
-import org.apache.asterix.aql.expression.ListConstructor;
-import org.apache.asterix.aql.expression.ListConstructor.Type;
-import org.apache.asterix.aql.expression.LiteralExpr;
-import org.apache.asterix.aql.expression.LoadStatement;
-import org.apache.asterix.aql.expression.NodeGroupDropStatement;
-import org.apache.asterix.aql.expression.NodegroupDecl;
-import org.apache.asterix.aql.expression.OperatorExpr;
-import org.apache.asterix.aql.expression.OperatorType;
-import org.apache.asterix.aql.expression.OrderbyClause;
-import org.apache.asterix.aql.expression.OrderbyClause.OrderModifier;
-import org.apache.asterix.aql.expression.OrderedListTypeDefinition;
-import org.apache.asterix.aql.expression.QuantifiedExpression;
-import org.apache.asterix.aql.expression.QuantifiedExpression.Quantifier;
-import org.apache.asterix.aql.expression.QuantifiedPair;
-import org.apache.asterix.aql.expression.Query;
-import org.apache.asterix.aql.expression.RecordConstructor;
-import org.apache.asterix.aql.expression.RecordTypeDefinition;
-import org.apache.asterix.aql.expression.SetStatement;
-import org.apache.asterix.aql.expression.TypeDecl;
-import org.apache.asterix.aql.expression.TypeDropStatement;
-import org.apache.asterix.aql.expression.TypeReferenceExpression;
-import org.apache.asterix.aql.expression.UnaryExpr;
-import org.apache.asterix.aql.expression.UnaryExpr.Sign;
-import org.apache.asterix.aql.expression.UnionExpr;
-import org.apache.asterix.aql.expression.UnorderedListTypeDefinition;
-import org.apache.asterix.aql.expression.UpdateClause;
-import org.apache.asterix.aql.expression.UpdateStatement;
-import org.apache.asterix.aql.expression.VariableExpr;
-import org.apache.asterix.aql.expression.WhereClause;
-import org.apache.asterix.aql.expression.WriteStatement;
-import org.apache.asterix.aql.expression.visitor.IAqlExpressionVisitor;
-import org.apache.asterix.aql.util.FunctionUtils;
-import org.apache.asterix.aql.util.RangeMapBuilder;
import org.apache.asterix.common.config.AsterixMetadataProperties;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.functions.FunctionConstants;
import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.aql.clause.DistinctClause;
+import org.apache.asterix.lang.aql.clause.ForClause;
+import org.apache.asterix.lang.aql.expression.FLWOGRExpression;
+import org.apache.asterix.lang.aql.expression.UnionExpr;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.util.RangeMapBuilder;
+import org.apache.asterix.lang.aql.visitor.base.IAQLVisitor;
+import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.Expression.Kind;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.UpdateClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause.OrderModifier;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.ListConstructor.Type;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression.Quantifier;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
+import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.UnaryExpr.Sign;
+import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.CompactStatement;
+import org.apache.asterix.lang.common.statement.ConnectFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateDataverseStatement;
+import org.apache.asterix.lang.common.statement.CreateFeedPolicyStatement;
+import org.apache.asterix.lang.common.statement.CreateFunctionStatement;
+import org.apache.asterix.lang.common.statement.CreateIndexStatement;
+import org.apache.asterix.lang.common.statement.CreatePrimaryFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateSecondaryFeedStatement;
+import org.apache.asterix.lang.common.statement.DatasetDecl;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.DataverseDropStatement;
+import org.apache.asterix.lang.common.statement.DeleteStatement;
+import org.apache.asterix.lang.common.statement.DisconnectFeedStatement;
+import org.apache.asterix.lang.common.statement.DropStatement;
+import org.apache.asterix.lang.common.statement.FeedDropStatement;
+import org.apache.asterix.lang.common.statement.FeedPolicyDropStatement;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.FunctionDropStatement;
+import org.apache.asterix.lang.common.statement.IndexDropStatement;
+import org.apache.asterix.lang.common.statement.InsertStatement;
+import org.apache.asterix.lang.common.statement.LoadStatement;
+import org.apache.asterix.lang.common.statement.NodeGroupDropStatement;
+import org.apache.asterix.lang.common.statement.NodegroupDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.statement.SetStatement;
+import org.apache.asterix.lang.common.statement.TypeDecl;
+import org.apache.asterix.lang.common.statement.TypeDropStatement;
+import org.apache.asterix.lang.common.statement.UpdateStatement;
+import org.apache.asterix.lang.common.statement.WriteStatement;
+import org.apache.asterix.lang.common.struct.OperatorType;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
@@ -125,6 +122,8 @@
import org.apache.asterix.runtime.formats.FormatUtils;
import org.apache.asterix.translator.CompiledStatements.CompiledLoadFromFileStatement;
import org.apache.asterix.translator.CompiledStatements.ICompiledDmlStatement;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -182,8 +181,8 @@
* source for the current subtree.
*/
-public class AqlExpressionToPlanTranslator extends AbstractAqlTranslator implements
- IAqlExpressionVisitor<Pair<ILogicalOperator, LogicalVariable>, Mutable<ILogicalOperator>> {
+public class AqlExpressionToPlanTranslator extends AbstractAqlTranslator
+ implements IAQLVisitor<Pair<ILogicalOperator, LogicalVariable>, Mutable<ILogicalOperator>> {
private final AqlMetadataProvider metadataProvider;
private final TranslationContext context;
@@ -211,8 +210,8 @@
Dataset dataset = metadataProvider.findDataset(clffs.getDataverseName(), clffs.getDatasetName());
if (dataset == null) {
// This would never happen since we check for this in AqlTranslator
- throw new AlgebricksException("Unable to load dataset " + clffs.getDatasetName()
- + " since it does not exist");
+ throw new AlgebricksException(
+ "Unable to load dataset " + clffs.getDatasetName() + " since it does not exist");
}
IAType itemType = metadataProvider.findType(clffs.getDataverseName(), dataset.getItemTypeName());
DatasetDataSource targetDatasource = validateDatasetInfo(metadataProvider, stmt.getDataverseName(),
@@ -295,8 +294,8 @@
}
public ILogicalPlan translate(Query expr) throws AlgebricksException, AsterixException {
- Pair<ILogicalOperator, LogicalVariable> p = expr.accept(this, new MutableObject<ILogicalOperator>(
- new EmptyTupleSourceOperator()));
+ Pair<ILogicalOperator, LogicalVariable> p = expr.accept(this,
+ new MutableObject<ILogicalOperator>(new EmptyTupleSourceOperator()));
ArrayList<Mutable<ILogicalOperator>> globalPlanRoots = new ArrayList<Mutable<ILogicalOperator>>();
ILogicalOperator topOp = p.first;
ProjectOperator project = (ProjectOperator) topOp;
@@ -334,8 +333,8 @@
new MutableObject<ILogicalExpression>(new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.COLLECTION_TO_SEQUENCE),
new MutableObject<ILogicalExpression>(new VariableReferenceExpression(resVar)))));
- assignCollectionToSequence.getInputs().add(
- new MutableObject<ILogicalOperator>(project.getInputs().get(0).getValue()));
+ assignCollectionToSequence.getInputs()
+ .add(new MutableObject<ILogicalOperator>(project.getInputs().get(0).getValue()));
project.getInputs().get(0).setValue(assignCollectionToSequence);
project.getVariables().set(0, seqVar);
resVar = seqVar;
@@ -376,8 +375,8 @@
assign.getInputs().add(new MutableObject<ILogicalOperator>(project));
}
- Mutable<ILogicalExpression> varRef = new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- resVar));
+ Mutable<ILogicalExpression> varRef = new MutableObject<ILogicalExpression>(
+ new VariableReferenceExpression(resVar));
ILogicalOperator leafOperator = null;
switch (stmt.getKind()) {
@@ -408,13 +407,13 @@
leafOperator.getInputs().add(new MutableObject<ILogicalOperator>(insertOp));
break;
}
- case SUBSCRIBE_FEED: {
- ILogicalOperator insertOp = new InsertDeleteOperator(targetDatasource, varRef, varRefsForLoading,
- InsertDeleteOperator.Kind.INSERT, false);
- insertOp.getInputs().add(new MutableObject<ILogicalOperator>(assign));
- leafOperator = new SinkOperator();
- leafOperator.getInputs().add(new MutableObject<ILogicalOperator>(insertOp));
- break;
+ case SUBSCRIBE_FEED: {
+ ILogicalOperator insertOp = new InsertDeleteOperator(targetDatasource, varRef, varRefsForLoading,
+ InsertDeleteOperator.Kind.INSERT, false);
+ insertOp.getInputs().add(new MutableObject<ILogicalOperator>(assign));
+ leafOperator = new SinkOperator();
+ leafOperator.getInputs().add(new MutableObject<ILogicalOperator>(insertOp));
+ break;
}
}
topOp = leafOperator;
@@ -433,14 +432,16 @@
ScalarFunctionCallExpression f;
if (field.size() > 1) {
finfoAccess = FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_NESTED);
- f = new ScalarFunctionCallExpression(finfoAccess, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(METADATA_DUMMY_VAR)), new MutableObject<ILogicalExpression>(
- new ConstantExpression(new AsterixConstantValue(new AOrderedList(field)))));
+ f = new ScalarFunctionCallExpression(finfoAccess,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(METADATA_DUMMY_VAR)),
+ new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AOrderedList(field)))));
} else {
finfoAccess = FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME);
- f = new ScalarFunctionCallExpression(finfoAccess, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(METADATA_DUMMY_VAR)), new MutableObject<ILogicalExpression>(
- new ConstantExpression(new AsterixConstantValue(new AString(field.get(0))))));
+ f = new ScalarFunctionCallExpression(finfoAccess,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(METADATA_DUMMY_VAR)),
+ new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(new AString(field.get(0))))));
}
f.substituteVar(METADATA_DUMMY_VAR, resVar);
additionalFilteringAssignExpressions.add(new MutableObject<ILogicalExpression>(f));
@@ -476,7 +477,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitForClause(ForClause fc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(ForClause fc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v = context.newVar(fc.getVarExpr());
Expression inExpr = fc.getInExpr();
@@ -497,7 +498,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLetClause(LetClause lc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(LetClause lc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v;
ILogicalOperator returnedOp;
@@ -506,8 +507,8 @@
case VARIABLE_EXPRESSION: {
v = context.newVar(lc.getVarExpr());
LogicalVariable prev = context.getVar(((VariableExpr) lc.getBindingExpr()).getVar().getId());
- returnedOp = new AssignOperator(v, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(prev)));
+ returnedOp = new AssignOperator(v,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(prev)));
returnedOp.getInputs().add(tupSource);
break;
}
@@ -524,8 +525,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFlworExpression(FLWOGRExpression flwor,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FLWOGRExpression flwor, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Mutable<ILogicalOperator> flworPlan = tupSource;
boolean isTop = context.isTopFlwor();
if (isTop) {
@@ -565,15 +566,15 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFieldAccessor(FieldAccessor fa,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FieldAccessor fa, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(fa.getExpr(), tupSource);
LogicalVariable v = context.newVar();
AbstractFunctionCallExpression fldAccess = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME));
fldAccess.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
- ILogicalExpression faExpr = new ConstantExpression(new AsterixConstantValue(new AString(fa.getIdent()
- .getValue())));
+ ILogicalExpression faExpr = new ConstantExpression(
+ new AsterixConstantValue(new AString(fa.getIdent().getValue())));
fldAccess.getArguments().add(new MutableObject<ILogicalExpression>(faExpr));
AssignOperator a = new AssignOperator(v, new MutableObject<ILogicalExpression>(fldAccess));
a.getInputs().add(p.second);
@@ -581,8 +582,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIndexAccessor(IndexAccessor ia,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(IndexAccessor ia, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(ia.getExpr(), tupSource);
LogicalVariable v = context.newVar();
AbstractFunctionCallExpression f;
@@ -603,7 +604,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCallExpr(CallExpr fcall, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(CallExpr fcall, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v = context.newVar();
FunctionSignature signature = fcall.getFunctionSignature();
@@ -619,8 +620,8 @@
}
case LITERAL_EXPRESSION: {
LiteralExpr val = (LiteralExpr) expr;
- args.add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(
- ConstantHelper.objectFromLiteral(val.getValue())))));
+ args.add(new MutableObject<ILogicalExpression>(new ConstantExpression(
+ new AsterixConstantValue(ConstantHelper.objectFromLiteral(val.getValue())))));
break;
}
default: {
@@ -670,15 +671,15 @@
}
AbstractFunctionCallExpression f = null;
if (function.getLanguage().equalsIgnoreCase(Function.LANGUAGE_JAVA)) {
- IFunctionInfo finfo = ExternalFunctionCompilerUtil.getExternalFunctionInfo(
- metadataProvider.getMetadataTxnContext(), function);
+ IFunctionInfo finfo = ExternalFunctionCompilerUtil
+ .getExternalFunctionInfo(metadataProvider.getMetadataTxnContext(), function);
f = new ScalarFunctionCallExpression(finfo, args);
} else if (function.getLanguage().equalsIgnoreCase(Function.LANGUAGE_AQL)) {
IFunctionInfo finfo = FunctionUtils.getFunctionInfo(signature);
f = new ScalarFunctionCallExpression(finfo, args);
} else {
- throw new MetadataException(" User defined functions written in " + function.getLanguage()
- + " are not supported");
+ throw new MetadataException(
+ " User defined functions written in " + function.getLanguage() + " are not supported");
}
return f;
}
@@ -713,15 +714,14 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFunctionDecl(FunctionDecl fd,
- Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FunctionDecl fd, Mutable<ILogicalOperator> tupSource) {
// TODO Auto-generated method stub
throw new NotImplementedException();
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitGroupbyClause(GroupbyClause gc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(GroupbyClause gc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
GroupByOperator gOp = new GroupByOperator();
Mutable<ILogicalOperator> topOp = tupSource;
for (GbyVariableExpressionPair ve : gc.getGbyPairList()) {
@@ -755,14 +755,13 @@
LogicalVariable oldVar = context.getVar(var);
List<Mutable<ILogicalExpression>> flArgs = new ArrayList<Mutable<ILogicalExpression>>(1);
flArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldVar)));
- AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions.makeAggregateFunctionExpression(
- AsterixBuiltinFunctions.LISTIFY, flArgs);
+ AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions
+ .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, flArgs);
AggregateOperator agg = new AggregateOperator(mkSingletonArrayList(aggVar),
(List) mkSingletonArrayList(new MutableObject<ILogicalExpression>(fListify)));
- agg.getInputs().add(
- new MutableObject<ILogicalOperator>(new NestedTupleSourceOperator(
- new MutableObject<ILogicalOperator>(gOp))));
+ agg.getInputs().add(new MutableObject<ILogicalOperator>(
+ new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(gOp))));
ILogicalPlan plan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(agg));
gOp.getNestedPlans().add(plan);
// Hide the variable that was part of the "with", replacing it with
@@ -775,7 +774,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIfExpr(IfExpr ifexpr, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(IfExpr ifexpr, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
// In the most general case, IfThenElse is translated in the following
// way.
@@ -792,18 +791,18 @@
LogicalVariable varCond = pCond.second;
SubplanOperator sp = new SubplanOperator();
- Mutable<ILogicalOperator> nestedSource = new MutableObject<ILogicalOperator>(new NestedTupleSourceOperator(
- new MutableObject<ILogicalOperator>(sp)));
+ Mutable<ILogicalOperator> nestedSource = new MutableObject<ILogicalOperator>(
+ new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(sp)));
Pair<ILogicalOperator, LogicalVariable> pThen = ifexpr.getThenExpr().accept(this, nestedSource);
- SelectOperator sel1 = new SelectOperator(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- varCond)), false, null);
+ SelectOperator sel1 = new SelectOperator(
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(varCond)), false, null);
sel1.getInputs().add(new MutableObject<ILogicalOperator>(pThen.first));
Pair<ILogicalOperator, LogicalVariable> pElse = ifexpr.getElseExpr().accept(this, nestedSource);
AbstractFunctionCallExpression notVarCond = new ScalarFunctionCallExpression(
- FunctionUtils.getFunctionInfo(AlgebricksBuiltinFunctions.NOT), new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(varCond)));
+ FunctionUtils.getFunctionInfo(AlgebricksBuiltinFunctions.NOT),
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(varCond)));
SelectOperator sel2 = new SelectOperator(new MutableObject<ILogicalExpression>(notVarCond), false, null);
sel2.getInputs().add(new MutableObject<ILogicalOperator>(pElse.first));
@@ -827,10 +826,10 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLiteralExpr(LiteralExpr l, Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(LiteralExpr l, Mutable<ILogicalOperator> tupSource) {
LogicalVariable var = context.newVar();
- AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(ConstantHelper.objectFromLiteral(l.getValue())))));
+ AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(ConstantHelper.objectFromLiteral(l.getValue())))));
if (tupSource != null) {
a.getInputs().add(tupSource);
}
@@ -838,16 +837,16 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOperatorExpr(OperatorExpr op,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
- ArrayList<OperatorType> ops = op.getOpList();
+ public Pair<ILogicalOperator, LogicalVariable> visit(OperatorExpr op, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
+ List<OperatorType> ops = op.getOpList();
int nOps = ops.size();
if (nOps > 0 && (ops.get(0) == OperatorType.AND || ops.get(0) == OperatorType.OR)) {
return visitAndOrOperator(op, tupSource);
}
- ArrayList<Expression> exprs = op.getExprList();
+ List<Expression> exprs = op.getExprList();
Mutable<ILogicalOperator> topOp = tupSource;
@@ -872,8 +871,8 @@
c.getAnnotations().put(BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
}
} else {
- ((AbstractFunctionCallExpression) currExpr).getArguments().add(
- new MutableObject<ILogicalExpression>(e));
+ ((AbstractFunctionCallExpression) currExpr).getArguments()
+ .add(new MutableObject<ILogicalExpression>(e));
c.getArguments().add(new MutableObject<ILogicalExpression>(currExpr));
currExpr = c;
if (i == 1 && op.isBroadcastOperand(i)) {
@@ -889,8 +888,8 @@
f.getArguments().add(new MutableObject<ILogicalExpression>(e));
currExpr = f;
} else {
- ((AbstractFunctionCallExpression) currExpr).getArguments().add(
- new MutableObject<ILogicalExpression>(e));
+ ((AbstractFunctionCallExpression) currExpr).getArguments()
+ .add(new MutableObject<ILogicalExpression>(e));
f.getArguments().add(new MutableObject<ILogicalExpression>(currExpr));
currExpr = f;
}
@@ -901,8 +900,8 @@
if (i == 1 && op.isBroadcastOperand(i)) {
BroadcastExpressionAnnotation bcast = new BroadcastExpressionAnnotation();
bcast.setObject(BroadcastSide.RIGHT);
- ((AbstractFunctionCallExpression) currExpr).getAnnotations().put(
- BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
+ ((AbstractFunctionCallExpression) currExpr).getAnnotations()
+ .put(BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
}
}
}
@@ -924,8 +923,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOrderbyClause(OrderbyClause oc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(OrderbyClause oc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
OrderOperator ord = new OrderOperator();
Iterator<OrderModifier> modifIter = oc.getModifierList().iterator();
Mutable<ILogicalOperator> topOp = tupSource;
@@ -933,9 +932,8 @@
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(e, topOp);
OrderModifier m = modifIter.next();
OrderOperator.IOrder comp = (m == OrderModifier.ASC) ? OrderOperator.ASC_ORDER : OrderOperator.DESC_ORDER;
- ord.getOrderExpressions()
- .add(new Pair<IOrder, Mutable<ILogicalExpression>>(comp, new MutableObject<ILogicalExpression>(
- p.first)));
+ ord.getOrderExpressions().add(new Pair<IOrder, Mutable<ILogicalExpression>>(comp,
+ new MutableObject<ILogicalExpression>(p.first)));
topOp = p.second;
}
ord.getInputs().add(topOp);
@@ -955,8 +953,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitQuantifiedExpression(QuantifiedExpression qe,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(QuantifiedExpression qe, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Mutable<ILogicalOperator> topOp = tupSource;
ILogicalOperator firstOp = null;
@@ -966,8 +964,8 @@
Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = aqlExprToAlgExpression(qt.getExpr(), topOp);
topOp = eo1.second;
LogicalVariable uVar = context.newVar(qt.getVarExpr());
- ILogicalOperator u = new UnnestOperator(uVar, new MutableObject<ILogicalExpression>(
- makeUnnestExpression(eo1.first)));
+ ILogicalOperator u = new UnnestOperator(uVar,
+ new MutableObject<ILogicalExpression>(makeUnnestExpression(eo1.first)));
if (firstOp == null) {
firstOp = u;
@@ -1009,14 +1007,14 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitQuery(Query q, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(Query q, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
return q.getBody().accept(this, tupSource);
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitRecordConstructor(RecordConstructor rc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(RecordConstructor rc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
AbstractFunctionCallExpression f = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR));
LogicalVariable v1 = context.newVar();
@@ -1035,10 +1033,10 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitListConstructor(ListConstructor lc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
- FunctionIdentifier fid = (lc.getType() == Type.ORDERED_LIST_CONSTRUCTOR) ? AsterixBuiltinFunctions.ORDERED_LIST_CONSTRUCTOR
- : AsterixBuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR;
+ public Pair<ILogicalOperator, LogicalVariable> visit(ListConstructor lc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
+ FunctionIdentifier fid = (lc.getType() == Type.ORDERED_LIST_CONSTRUCTOR)
+ ? AsterixBuiltinFunctions.ORDERED_LIST_CONSTRUCTOR : AsterixBuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR;
AbstractFunctionCallExpression f = new ScalarFunctionCallExpression(FunctionUtils.getFunctionInfo(fid));
LogicalVariable v1 = context.newVar();
AssignOperator a = new AssignOperator(v1, new MutableObject<ILogicalExpression>(f));
@@ -1053,7 +1051,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnaryExpr(UnaryExpr u, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnaryExpr u, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Expression expr = u.getExpr();
Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(expr, tupSource);
@@ -1072,18 +1070,18 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitVariableExpr(VariableExpr v, Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(VariableExpr v, Mutable<ILogicalOperator> tupSource) {
// Should we ever get to this method?
LogicalVariable var = context.newVar();
LogicalVariable oldV = context.getVar(v.getVar().getId());
- AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(oldV)));
+ AssignOperator a = new AssignOperator(var,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldV)));
a.getInputs().add(tupSource);
return new Pair<ILogicalOperator, LogicalVariable>(a, var);
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitWhereClause(WhereClause w, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(WhereClause w, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(w.getWhereExpr(), tupSource);
SelectOperator s = new SelectOperator(new MutableObject<ILogicalExpression>(p.first), false, null);
@@ -1093,7 +1091,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLimitClause(LimitClause lc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(LimitClause lc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p1 = aqlExprToAlgExpression(lc.getLimitExpr(), tupSource);
LimitOperator opLim;
@@ -1110,8 +1108,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDistinctClause(DistinctClause dc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(DistinctClause dc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
List<Mutable<ILogicalExpression>> exprList = new ArrayList<Mutable<ILogicalExpression>>();
Mutable<ILogicalOperator> input = null;
for (Expression expr : dc.getDistinctByExpr()) {
@@ -1125,8 +1123,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnionExpr(UnionExpr unionExpr,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnionExpr unionExpr, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
//Translate the AQL union into an assign [var] <- [function-call: asterix:union, Args:[..]]
//The rule "IntroduceUnionRule" will translates this assign operator into the UnionAll operator.
Mutable<ILogicalOperator> ts = tupSource;
@@ -1242,8 +1240,8 @@
Mutable<ILogicalOperator> topOp) throws AsterixException {
switch (expr.getKind()) {
case VARIABLE_EXPRESSION: {
- VariableReferenceExpression ve = new VariableReferenceExpression(context.getVar(((VariableExpr) expr)
- .getVar().getId()));
+ VariableReferenceExpression ve = new VariableReferenceExpression(
+ context.getVar(((VariableExpr) expr).getVar().getId()));
return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(ve, topOp);
}
case LITERAL_EXPRESSION: {
@@ -1267,16 +1265,16 @@
if (((AbstractLogicalOperator) p.first).getOperatorTag() == LogicalOperatorTag.SUBPLAN) {
src.setValue(topOp.getValue());
Mutable<ILogicalOperator> top2 = new MutableObject<ILogicalOperator>(p.first);
- return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(new VariableReferenceExpression(
- p.second), top2);
+ return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(
+ new VariableReferenceExpression(p.second), top2);
} else {
SubplanOperator s = new SubplanOperator();
s.getInputs().add(topOp);
src.setValue(new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(s)));
Mutable<ILogicalOperator> planRoot = new MutableObject<ILogicalOperator>(p.first);
s.setRootOp(planRoot);
- return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(new VariableReferenceExpression(
- p.second), new MutableObject<ILogicalOperator>(s));
+ return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(
+ new VariableReferenceExpression(p.second), new MutableObject<ILogicalOperator>(s));
}
}
}
@@ -1320,10 +1318,10 @@
private Pair<ILogicalOperator, LogicalVariable> visitAndOrOperator(OperatorExpr op,
Mutable<ILogicalOperator> tupSource) throws AsterixException {
- ArrayList<OperatorType> ops = op.getOpList();
+ List<OperatorType> ops = op.getOpList();
int nOps = ops.size();
- ArrayList<Expression> exprs = op.getExprList();
+ List<Expression> exprs = op.getExprList();
Mutable<ILogicalOperator> topOp = tupSource;
@@ -1336,8 +1334,8 @@
// now look at the operator
if (i < nOps) {
if (ops.get(i) != opLogical) {
- throw new TranslationException("Unexpected operator " + ops.get(i)
- + " in an OperatorExpr starting with " + opLogical);
+ throw new TranslationException(
+ "Unexpected operator " + ops.get(i) + " in an OperatorExpr starting with " + opLogical);
}
}
f.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
@@ -1354,9 +1352,9 @@
private static boolean expressionNeedsNoNesting(Expression expr) {
Kind k = expr.getKind();
return k == Kind.LITERAL_EXPRESSION || k == Kind.LIST_CONSTRUCTOR_EXPRESSION
- || k == Kind.RECORD_CONSTRUCTOR_EXPRESSION || k == Kind.VARIABLE_EXPRESSION
- || k == Kind.CALL_EXPRESSION || k == Kind.OP_EXPRESSION || k == Kind.FIELD_ACCESSOR_EXPRESSION
- || k == Kind.INDEX_ACCESSOR_EXPRESSION || k == Kind.UNARY_EXPRESSION || k == Kind.UNION_EXPRESSION;
+ || k == Kind.RECORD_CONSTRUCTOR_EXPRESSION || k == Kind.VARIABLE_EXPRESSION || k == Kind.CALL_EXPRESSION
+ || k == Kind.OP_EXPRESSION || k == Kind.FIELD_ACCESSOR_EXPRESSION || k == Kind.INDEX_ACCESSOR_EXPRESSION
+ || k == Kind.UNARY_EXPRESSION || k == Kind.UNION_EXPRESSION;
}
private <T> ArrayList<T> mkSingletonArrayList(T item) {
@@ -1366,70 +1364,70 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeDecl(TypeDecl td, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeDecl td, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitRecordTypeDefiniton(RecordTypeDefinition tre,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeReferenceExpression(TypeReferenceExpression tre,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitNodegroupDecl(NodegroupDecl ngd, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(RecordTypeDefinition tre, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLoadStatement(LoadStatement stmtLoad,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropStatement(DropStatement del, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeReferenceExpression tre, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDisconnectFeedStatement(DisconnectFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(NodegroupDecl ngd, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateIndexStatement(CreateIndexStatement cis,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(LoadStatement stmtLoad, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOrderedListTypeDefiniton(OrderedListTypeDefinition olte,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(DropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnorderedListTypeDefiniton(UnorderedListTypeDefinition ulte,
+ public Pair<ILogicalOperator, LogicalVariable> visit(DisconnectFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateIndexStatement cis, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(OrderedListTypeDefinition olte, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnorderedListTypeDefinition ulte,
Mutable<ILogicalOperator> arg) throws AsterixException {
// TODO Auto-generated method stub
return null;
@@ -1459,92 +1457,92 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitInsertStatement(InsertStatement insert,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitDeleteStatement(DeleteStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitUpdateStatement(UpdateStatement update,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitUpdateClause(UpdateClause del, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(InsertStatement insert, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDataverseDecl(DataverseDecl dv, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(DeleteStatement del, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDatasetDecl(DatasetDecl dd, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UpdateStatement update, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitSetStatement(SetStatement ss, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UpdateClause del, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitWriteStatement(WriteStatement ws, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(DataverseDecl dv, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateDataverseStatement(CreateDataverseStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(DatasetDecl dd, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIndexDropStatement(IndexDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(SetStatement ss, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitNodeGroupDropStatement(NodeGroupDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(WriteStatement ws, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDataverseDropStatement(DataverseDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateDataverseStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeDropStatement(TypeDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(IndexDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(NodeGroupDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(DataverseDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@@ -1557,56 +1555,56 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFunctionDropStatement(FunctionDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FunctionDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
-
+
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreatePrimaryFeedStatement(CreatePrimaryFeedStatement del,
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreatePrimaryFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateSecondaryFeedStatement del,
Mutable<ILogicalOperator> arg) throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateSecondaryFeedStatement(CreateSecondaryFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitConnectFeedStatement(ConnectFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(ConnectFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropFeedStatement(FeedDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FeedDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCompactStatement(CompactStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(CompactStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateFeedPolicyStatement(CreateFeedPolicyStatement cfps,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- return null;
- }
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropFeedPolicyStatement(FeedPolicyDropStatement dfs,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateFeedPolicyStatement cfps, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(FeedPolicyDropStatement dfs, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
return null;
}
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
index fffe503..cd3b05a 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
@@ -24,87 +24,83 @@
import java.util.List;
import java.util.logging.Logger;
-import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.commons.lang3.mutable.MutableObject;
-
-import org.apache.asterix.aql.base.Clause;
-import org.apache.asterix.aql.base.Expression;
-import org.apache.asterix.aql.base.Expression.Kind;
-import org.apache.asterix.aql.expression.CallExpr;
-import org.apache.asterix.aql.expression.CompactStatement;
-import org.apache.asterix.aql.expression.ConnectFeedStatement;
-import org.apache.asterix.aql.expression.CreateDataverseStatement;
-import org.apache.asterix.aql.expression.CreateFeedPolicyStatement;
-import org.apache.asterix.aql.expression.CreateFeedStatement;
-import org.apache.asterix.aql.expression.CreateFunctionStatement;
-import org.apache.asterix.aql.expression.CreateIndexStatement;
-import org.apache.asterix.aql.expression.CreatePrimaryFeedStatement;
-import org.apache.asterix.aql.expression.CreateSecondaryFeedStatement;
-import org.apache.asterix.aql.expression.DatasetDecl;
-import org.apache.asterix.aql.expression.DataverseDecl;
-import org.apache.asterix.aql.expression.DataverseDropStatement;
-import org.apache.asterix.aql.expression.DeleteStatement;
-import org.apache.asterix.aql.expression.DisconnectFeedStatement;
-import org.apache.asterix.aql.expression.DistinctClause;
-import org.apache.asterix.aql.expression.DropStatement;
-import org.apache.asterix.aql.expression.FLWOGRExpression;
-import org.apache.asterix.aql.expression.FeedDropStatement;
-import org.apache.asterix.aql.expression.FeedPolicyDropStatement;
-import org.apache.asterix.aql.expression.FieldAccessor;
-import org.apache.asterix.aql.expression.FieldBinding;
-import org.apache.asterix.aql.expression.ForClause;
-import org.apache.asterix.aql.expression.FunctionDecl;
-import org.apache.asterix.aql.expression.FunctionDropStatement;
-import org.apache.asterix.aql.expression.GbyVariableExpressionPair;
-import org.apache.asterix.aql.expression.GroupbyClause;
-import org.apache.asterix.aql.expression.Identifier;
-import org.apache.asterix.aql.expression.IfExpr;
-import org.apache.asterix.aql.expression.IndexAccessor;
-import org.apache.asterix.aql.expression.IndexDropStatement;
-import org.apache.asterix.aql.expression.InsertStatement;
-import org.apache.asterix.aql.expression.JoinClause;
-import org.apache.asterix.aql.expression.LetClause;
-import org.apache.asterix.aql.expression.LimitClause;
-import org.apache.asterix.aql.expression.ListConstructor;
-import org.apache.asterix.aql.expression.ListConstructor.Type;
-import org.apache.asterix.aql.expression.LiteralExpr;
-import org.apache.asterix.aql.expression.LoadStatement;
-import org.apache.asterix.aql.expression.MetaVariableClause;
-import org.apache.asterix.aql.expression.MetaVariableExpr;
-import org.apache.asterix.aql.expression.NodeGroupDropStatement;
-import org.apache.asterix.aql.expression.NodegroupDecl;
-import org.apache.asterix.aql.expression.OperatorExpr;
-import org.apache.asterix.aql.expression.OperatorType;
-import org.apache.asterix.aql.expression.OrderbyClause;
-import org.apache.asterix.aql.expression.OrderbyClause.OrderModifier;
-import org.apache.asterix.aql.expression.OrderedListTypeDefinition;
-import org.apache.asterix.aql.expression.QuantifiedExpression;
-import org.apache.asterix.aql.expression.QuantifiedExpression.Quantifier;
-import org.apache.asterix.aql.expression.QuantifiedPair;
-import org.apache.asterix.aql.expression.Query;
-import org.apache.asterix.aql.expression.RecordConstructor;
-import org.apache.asterix.aql.expression.RecordTypeDefinition;
-import org.apache.asterix.aql.expression.SetStatement;
-import org.apache.asterix.aql.expression.TypeDecl;
-import org.apache.asterix.aql.expression.TypeDropStatement;
-import org.apache.asterix.aql.expression.TypeReferenceExpression;
-import org.apache.asterix.aql.expression.UnaryExpr;
-import org.apache.asterix.aql.expression.UnaryExpr.Sign;
-import org.apache.asterix.aql.expression.UnionExpr;
-import org.apache.asterix.aql.expression.UnorderedListTypeDefinition;
-import org.apache.asterix.aql.expression.UpdateClause;
-import org.apache.asterix.aql.expression.UpdateStatement;
-import org.apache.asterix.aql.expression.VariableExpr;
-import org.apache.asterix.aql.expression.WhereClause;
-import org.apache.asterix.aql.expression.WriteStatement;
-import org.apache.asterix.aql.expression.visitor.IAqlPlusExpressionVisitor;
-import org.apache.asterix.aql.util.FunctionUtils;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.functions.FunctionConstants;
import org.apache.asterix.common.functions.FunctionSignature;
import org.apache.asterix.common.transactions.JobId;
import org.apache.asterix.formats.base.IDataFormat;
+import org.apache.asterix.lang.aql.clause.DistinctClause;
+import org.apache.asterix.lang.aql.clause.ForClause;
+import org.apache.asterix.lang.aql.clause.JoinClause;
+import org.apache.asterix.lang.aql.clause.MetaVariableClause;
+import org.apache.asterix.lang.aql.expression.FLWOGRExpression;
+import org.apache.asterix.lang.aql.expression.MetaVariableExpr;
+import org.apache.asterix.lang.aql.expression.UnionExpr;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
+import org.apache.asterix.lang.aql.visitor.base.IAQLPlusVisitor;
+import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.Expression.Kind;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.UpdateClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause.OrderModifier;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.ListConstructor.Type;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression.Quantifier;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
+import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.UnaryExpr.Sign;
+import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.statement.CompactStatement;
+import org.apache.asterix.lang.common.statement.ConnectFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateDataverseStatement;
+import org.apache.asterix.lang.common.statement.CreateFeedPolicyStatement;
+import org.apache.asterix.lang.common.statement.CreateFunctionStatement;
+import org.apache.asterix.lang.common.statement.CreateIndexStatement;
+import org.apache.asterix.lang.common.statement.CreatePrimaryFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateSecondaryFeedStatement;
+import org.apache.asterix.lang.common.statement.DatasetDecl;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.DataverseDropStatement;
+import org.apache.asterix.lang.common.statement.DeleteStatement;
+import org.apache.asterix.lang.common.statement.DisconnectFeedStatement;
+import org.apache.asterix.lang.common.statement.DropStatement;
+import org.apache.asterix.lang.common.statement.FeedDropStatement;
+import org.apache.asterix.lang.common.statement.FeedPolicyDropStatement;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.FunctionDropStatement;
+import org.apache.asterix.lang.common.statement.IndexDropStatement;
+import org.apache.asterix.lang.common.statement.InsertStatement;
+import org.apache.asterix.lang.common.statement.LoadStatement;
+import org.apache.asterix.lang.common.statement.NodeGroupDropStatement;
+import org.apache.asterix.lang.common.statement.NodegroupDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.statement.SetStatement;
+import org.apache.asterix.lang.common.statement.TypeDecl;
+import org.apache.asterix.lang.common.statement.TypeDropStatement;
+import org.apache.asterix.lang.common.statement.UpdateStatement;
+import org.apache.asterix.lang.common.statement.WriteStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.OperatorType;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.asterix.metadata.declared.FileSplitDataSink;
import org.apache.asterix.metadata.declared.FileSplitSinkId;
@@ -118,6 +114,8 @@
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.translator.CompiledStatements.ICompiledDmlStatement;
+import org.apache.commons.lang3.mutable.Mutable;
+import org.apache.commons.lang3.mutable.MutableObject;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -172,8 +170,8 @@
* source for the current subtree.
*/
-public class AqlPlusExpressionToPlanTranslator extends AbstractAqlTranslator implements
- IAqlPlusExpressionVisitor<Pair<ILogicalOperator, LogicalVariable>, Mutable<ILogicalOperator>> {
+public class AqlPlusExpressionToPlanTranslator extends AbstractAqlTranslator
+ implements IAQLPlusVisitor<Pair<ILogicalOperator, LogicalVariable>, Mutable<ILogicalOperator>> {
private static final Logger LOGGER = Logger.getLogger(AqlPlusExpressionToPlanTranslator.class.getName());
@@ -240,15 +238,15 @@
return translate(expr, null);
}
- public ILogicalPlan translate(Query expr, AqlMetadataProvider metadata) throws AlgebricksException,
- AsterixException {
+ public ILogicalPlan translate(Query expr, AqlMetadataProvider metadata)
+ throws AlgebricksException, AsterixException {
IDataFormat format = metadata.getFormat();
if (format == null) {
throw new AlgebricksException("Data format has not been set.");
}
format.registerRuntimeFunctions();
- Pair<ILogicalOperator, LogicalVariable> p = expr.accept(this, new MutableObject<ILogicalOperator>(
- new EmptyTupleSourceOperator()));
+ Pair<ILogicalOperator, LogicalVariable> p = expr.accept(this,
+ new MutableObject<ILogicalOperator>(new EmptyTupleSourceOperator()));
ArrayList<Mutable<ILogicalOperator>> globalPlanRoots = new ArrayList<Mutable<ILogicalOperator>>();
@@ -319,7 +317,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitForClause(ForClause fc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(ForClause fc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v = context.newVar(fc.getVarExpr());
@@ -340,7 +338,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLetClause(LetClause lc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(LetClause lc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v;
ILogicalOperator returnedOp;
@@ -349,8 +347,8 @@
case VARIABLE_EXPRESSION: {
v = context.newVar(lc.getVarExpr());
LogicalVariable prev = context.getVar(((VariableExpr) lc.getBindingExpr()).getVar().getId());
- returnedOp = new AssignOperator(v, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(prev)));
+ returnedOp = new AssignOperator(v,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(prev)));
returnedOp.getInputs().add(tupSource);
break;
}
@@ -367,8 +365,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFlworExpression(FLWOGRExpression flwor,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FLWOGRExpression flwor, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Mutable<ILogicalOperator> flworPlan = tupSource;
boolean isTop = context.isTopFlwor();
if (isTop) {
@@ -408,15 +406,15 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFieldAccessor(FieldAccessor fa,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FieldAccessor fa, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(fa.getExpr(), tupSource);
LogicalVariable v = context.newVar();
AbstractFunctionCallExpression fldAccess = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME));
fldAccess.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
- ILogicalExpression faExpr = new ConstantExpression(new AsterixConstantValue(new AString(fa.getIdent()
- .getValue())));
+ ILogicalExpression faExpr = new ConstantExpression(
+ new AsterixConstantValue(new AString(fa.getIdent().getValue())));
fldAccess.getArguments().add(new MutableObject<ILogicalExpression>(faExpr));
AssignOperator a = new AssignOperator(v, new MutableObject<ILogicalExpression>(fldAccess));
a.getInputs().add(p.second);
@@ -425,8 +423,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIndexAccessor(IndexAccessor ia,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(IndexAccessor ia, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(ia.getExpr(), tupSource);
LogicalVariable v = context.newVar();
AbstractFunctionCallExpression f;
@@ -447,7 +445,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCallExpr(CallExpr fcall, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(CallExpr fcall, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
LogicalVariable v = context.newVar();
FunctionSignature signature = fcall.getFunctionSignature();
@@ -463,8 +461,8 @@
}
case LITERAL_EXPRESSION: {
LiteralExpr val = (LiteralExpr) expr;
- args.add(new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(
- ConstantHelper.objectFromLiteral(val.getValue())))));
+ args.add(new MutableObject<ILogicalExpression>(new ConstantExpression(
+ new AsterixConstantValue(ConstantHelper.objectFromLiteral(val.getValue())))));
break;
}
default: {
@@ -512,15 +510,14 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFunctionDecl(FunctionDecl fd,
- Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FunctionDecl fd, Mutable<ILogicalOperator> tupSource) {
// TODO Auto-generated method stub
throw new NotImplementedException();
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitGroupbyClause(GroupbyClause gc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(GroupbyClause gc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
GroupByOperator gOp = new GroupByOperator();
Mutable<ILogicalOperator> topOp = tupSource;
for (GbyVariableExpressionPair ve : gc.getGbyPairList()) {
@@ -554,13 +551,12 @@
LogicalVariable oldVar = context.getVar(var);
List<Mutable<ILogicalExpression>> flArgs = new ArrayList<Mutable<ILogicalExpression>>(1);
flArgs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldVar)));
- AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions.makeAggregateFunctionExpression(
- AsterixBuiltinFunctions.LISTIFY, flArgs);
+ AggregateFunctionCallExpression fListify = AsterixBuiltinFunctions
+ .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, flArgs);
AggregateOperator agg = new AggregateOperator(mkSingletonArrayList(aggVar),
(List) mkSingletonArrayList(new MutableObject<ILogicalExpression>(fListify)));
- agg.getInputs().add(
- new MutableObject<ILogicalOperator>(new NestedTupleSourceOperator(
- new MutableObject<ILogicalOperator>(gOp))));
+ agg.getInputs().add(new MutableObject<ILogicalOperator>(
+ new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(gOp))));
ILogicalPlan plan = new ALogicalPlanImpl(new MutableObject<ILogicalOperator>(agg));
gOp.getNestedPlans().add(plan);
// Hide the variable that was part of the "with", replacing it with
@@ -573,7 +569,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIfExpr(IfExpr ifexpr, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(IfExpr ifexpr, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
// In the most general case, IfThenElse is translated in the following
// way.
@@ -590,18 +586,18 @@
LogicalVariable varCond = pCond.second;
SubplanOperator sp = new SubplanOperator();
- Mutable<ILogicalOperator> nestedSource = new MutableObject<ILogicalOperator>(new NestedTupleSourceOperator(
- new MutableObject<ILogicalOperator>(sp)));
+ Mutable<ILogicalOperator> nestedSource = new MutableObject<ILogicalOperator>(
+ new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(sp)));
Pair<ILogicalOperator, LogicalVariable> pThen = ifexpr.getThenExpr().accept(this, nestedSource);
- SelectOperator sel1 = new SelectOperator(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(
- varCond)), false, null);
+ SelectOperator sel1 = new SelectOperator(
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(varCond)), false, null);
sel1.getInputs().add(new MutableObject<ILogicalOperator>(pThen.first));
Pair<ILogicalOperator, LogicalVariable> pElse = ifexpr.getElseExpr().accept(this, nestedSource);
AbstractFunctionCallExpression notVarCond = new ScalarFunctionCallExpression(
- FunctionUtils.getFunctionInfo(AlgebricksBuiltinFunctions.NOT), new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(varCond)));
+ FunctionUtils.getFunctionInfo(AlgebricksBuiltinFunctions.NOT),
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(varCond)));
SelectOperator sel2 = new SelectOperator(new MutableObject<ILogicalExpression>(notVarCond), false, null);
sel2.getInputs().add(new MutableObject<ILogicalOperator>(pElse.first));
@@ -625,10 +621,10 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLiteralExpr(LiteralExpr l, Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(LiteralExpr l, Mutable<ILogicalOperator> tupSource) {
LogicalVariable var = context.newVar();
- AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(new ConstantExpression(
- new AsterixConstantValue(ConstantHelper.objectFromLiteral(l.getValue())))));
+ AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(
+ new ConstantExpression(new AsterixConstantValue(ConstantHelper.objectFromLiteral(l.getValue())))));
if (tupSource != null) {
a.getInputs().add(tupSource);
}
@@ -636,16 +632,16 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOperatorExpr(OperatorExpr op,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
- ArrayList<OperatorType> ops = op.getOpList();
+ public Pair<ILogicalOperator, LogicalVariable> visit(OperatorExpr op, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
+ List<OperatorType> ops = op.getOpList();
int nOps = ops.size();
if (nOps > 0 && (ops.get(0) == OperatorType.AND || ops.get(0) == OperatorType.OR)) {
return visitAndOrOperator(op, tupSource);
}
- ArrayList<Expression> exprs = op.getExprList();
+ List<Expression> exprs = op.getExprList();
Mutable<ILogicalOperator> topOp = tupSource;
@@ -670,8 +666,8 @@
c.getAnnotations().put(BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
}
} else {
- ((AbstractFunctionCallExpression) currExpr).getArguments().add(
- new MutableObject<ILogicalExpression>(e));
+ ((AbstractFunctionCallExpression) currExpr).getArguments()
+ .add(new MutableObject<ILogicalExpression>(e));
c.getArguments().add(new MutableObject<ILogicalExpression>(currExpr));
currExpr = c;
if (i == 1 && op.isBroadcastOperand(i)) {
@@ -687,8 +683,8 @@
f.getArguments().add(new MutableObject<ILogicalExpression>(e));
currExpr = f;
} else {
- ((AbstractFunctionCallExpression) currExpr).getArguments().add(
- new MutableObject<ILogicalExpression>(e));
+ ((AbstractFunctionCallExpression) currExpr).getArguments()
+ .add(new MutableObject<ILogicalExpression>(e));
f.getArguments().add(new MutableObject<ILogicalExpression>(currExpr));
currExpr = f;
}
@@ -699,8 +695,8 @@
if (i == 1 && op.isBroadcastOperand(i)) {
BroadcastExpressionAnnotation bcast = new BroadcastExpressionAnnotation();
bcast.setObject(BroadcastSide.RIGHT);
- ((AbstractFunctionCallExpression) currExpr).getAnnotations().put(
- BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
+ ((AbstractFunctionCallExpression) currExpr).getAnnotations()
+ .put(BroadcastExpressionAnnotation.BROADCAST_ANNOTATION_KEY, bcast);
}
}
}
@@ -714,8 +710,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOrderbyClause(OrderbyClause oc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(OrderbyClause oc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
OrderOperator ord = new OrderOperator();
Iterator<OrderModifier> modifIter = oc.getModifierList().iterator();
@@ -724,9 +720,8 @@
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(e, topOp);
OrderModifier m = modifIter.next();
OrderOperator.IOrder comp = (m == OrderModifier.ASC) ? OrderOperator.ASC_ORDER : OrderOperator.DESC_ORDER;
- ord.getOrderExpressions()
- .add(new Pair<IOrder, Mutable<ILogicalExpression>>(comp, new MutableObject<ILogicalExpression>(
- p.first)));
+ ord.getOrderExpressions().add(new Pair<IOrder, Mutable<ILogicalExpression>>(comp,
+ new MutableObject<ILogicalExpression>(p.first)));
topOp = p.second;
}
ord.getInputs().add(topOp);
@@ -740,8 +735,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitQuantifiedExpression(QuantifiedExpression qe,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(QuantifiedExpression qe, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Mutable<ILogicalOperator> topOp = tupSource;
ILogicalOperator firstOp = null;
@@ -751,8 +746,8 @@
Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo1 = aqlExprToAlgExpression(qt.getExpr(), topOp);
topOp = eo1.second;
LogicalVariable uVar = context.newVar(qt.getVarExpr());
- ILogicalOperator u = new UnnestOperator(uVar, new MutableObject<ILogicalExpression>(
- makeUnnestExpression(eo1.first)));
+ ILogicalOperator u = new UnnestOperator(uVar,
+ new MutableObject<ILogicalExpression>(makeUnnestExpression(eo1.first)));
if (firstOp == null) {
firstOp = u;
@@ -794,14 +789,14 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitQuery(Query q, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(Query q, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
return q.getBody().accept(this, tupSource);
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitRecordConstructor(RecordConstructor rc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(RecordConstructor rc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
AbstractFunctionCallExpression f = new ScalarFunctionCallExpression(
FunctionUtils.getFunctionInfo(AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR));
LogicalVariable v1 = context.newVar();
@@ -820,10 +815,10 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitListConstructor(ListConstructor lc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
- FunctionIdentifier fid = (lc.getType() == Type.ORDERED_LIST_CONSTRUCTOR) ? AsterixBuiltinFunctions.ORDERED_LIST_CONSTRUCTOR
- : AsterixBuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR;
+ public Pair<ILogicalOperator, LogicalVariable> visit(ListConstructor lc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
+ FunctionIdentifier fid = (lc.getType() == Type.ORDERED_LIST_CONSTRUCTOR)
+ ? AsterixBuiltinFunctions.ORDERED_LIST_CONSTRUCTOR : AsterixBuiltinFunctions.UNORDERED_LIST_CONSTRUCTOR;
AbstractFunctionCallExpression f = new ScalarFunctionCallExpression(FunctionUtils.getFunctionInfo(fid));
LogicalVariable v1 = context.newVar();
AssignOperator a = new AssignOperator(v1, new MutableObject<ILogicalExpression>(f));
@@ -838,7 +833,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnaryExpr(UnaryExpr u, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnaryExpr u, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Expression expr = u.getExpr();
Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = aqlExprToAlgExpression(expr, tupSource);
@@ -857,18 +852,18 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitVariableExpr(VariableExpr v, Mutable<ILogicalOperator> tupSource) {
+ public Pair<ILogicalOperator, LogicalVariable> visit(VariableExpr v, Mutable<ILogicalOperator> tupSource) {
// Should we ever get to this method?
LogicalVariable var = context.newVar();
LogicalVariable oldV = context.getVar(v.getVar().getId());
- AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(
- new VariableReferenceExpression(oldV)));
+ AssignOperator a = new AssignOperator(var,
+ new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oldV)));
a.getInputs().add(tupSource);
return new Pair<ILogicalOperator, LogicalVariable>(a, var);
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitWhereClause(WhereClause w, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(WhereClause w, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p = aqlExprToAlgExpression(w.getWhereExpr(), tupSource);
SelectOperator s = new SelectOperator(new MutableObject<ILogicalExpression>(p.first), false, null);
@@ -878,7 +873,7 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLimitClause(LimitClause lc, Mutable<ILogicalOperator> tupSource)
+ public Pair<ILogicalOperator, LogicalVariable> visit(LimitClause lc, Mutable<ILogicalOperator> tupSource)
throws AsterixException {
Pair<ILogicalExpression, Mutable<ILogicalOperator>> p1 = aqlExprToAlgExpression(lc.getLimitExpr(), tupSource);
LimitOperator opLim;
@@ -895,8 +890,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDistinctClause(DistinctClause dc,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(DistinctClause dc, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
List<Mutable<ILogicalExpression>> exprList = new ArrayList<Mutable<ILogicalExpression>>();
Mutable<ILogicalOperator> input = null;
for (Expression expr : dc.getDistinctByExpr()) {
@@ -910,8 +905,8 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnionExpr(UnionExpr unionExpr,
- Mutable<ILogicalOperator> tupSource) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnionExpr unionExpr, Mutable<ILogicalOperator> tupSource)
+ throws AsterixException {
Mutable<ILogicalOperator> ts = tupSource;
ILogicalOperator lastOp = null;
LogicalVariable lastVar = null;
@@ -953,8 +948,8 @@
aggregVars.add(aggVar);
List<Mutable<ILogicalExpression>> afcExprs = new ArrayList<Mutable<ILogicalExpression>>(1);
afcExprs.add(new MutableObject<ILogicalExpression>(new VariableReferenceExpression(lastVar)));
- AggregateFunctionCallExpression afc = AsterixBuiltinFunctions.makeAggregateFunctionExpression(
- AsterixBuiltinFunctions.LISTIFY, afcExprs);
+ AggregateFunctionCallExpression afc = AsterixBuiltinFunctions
+ .makeAggregateFunctionExpression(AsterixBuiltinFunctions.LISTIFY, afcExprs);
ArrayList<Mutable<ILogicalExpression>> aggregExprs = new ArrayList<Mutable<ILogicalExpression>>(1);
aggregExprs.add(new MutableObject<ILogicalExpression>(afc));
AggregateOperator agg = new AggregateOperator(aggregVars, aggregExprs);
@@ -1059,8 +1054,8 @@
Mutable<ILogicalOperator> topOp) throws AsterixException {
switch (expr.getKind()) {
case VARIABLE_EXPRESSION: {
- VariableReferenceExpression ve = new VariableReferenceExpression(context.getVar(((VariableExpr) expr)
- .getVar().getId()));
+ VariableReferenceExpression ve = new VariableReferenceExpression(
+ context.getVar(((VariableExpr) expr).getVar().getId()));
return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(ve, topOp);
}
case METAVARIABLE_EXPRESSION: {
@@ -1088,16 +1083,16 @@
if (((AbstractLogicalOperator) p.first).getOperatorTag() == LogicalOperatorTag.SUBPLAN) {
// src.setOperator(topOp.getOperator());
Mutable<ILogicalOperator> top2 = new MutableObject<ILogicalOperator>(p.first);
- return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(new VariableReferenceExpression(
- p.second), top2);
+ return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(
+ new VariableReferenceExpression(p.second), top2);
} else {
SubplanOperator s = new SubplanOperator();
s.getInputs().add(topOp);
src.setValue(new NestedTupleSourceOperator(new MutableObject<ILogicalOperator>(s)));
Mutable<ILogicalOperator> planRoot = new MutableObject<ILogicalOperator>(p.first);
s.setRootOp(planRoot);
- return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(new VariableReferenceExpression(
- p.second), new MutableObject<ILogicalOperator>(s));
+ return new Pair<ILogicalExpression, Mutable<ILogicalOperator>>(
+ new VariableReferenceExpression(p.second), new MutableObject<ILogicalOperator>(s));
}
}
}
@@ -1141,10 +1136,10 @@
private Pair<ILogicalOperator, LogicalVariable> visitAndOrOperator(OperatorExpr op,
Mutable<ILogicalOperator> tupSource) throws AsterixException {
- ArrayList<OperatorType> ops = op.getOpList();
+ List<OperatorType> ops = op.getOpList();
int nOps = ops.size();
- ArrayList<Expression> exprs = op.getExprList();
+ List<Expression> exprs = op.getExprList();
Mutable<ILogicalOperator> topOp = tupSource;
@@ -1157,8 +1152,8 @@
// now look at the operator
if (i < nOps) {
if (ops.get(i) != opLogical) {
- throw new TranslationException("Unexpected operator " + ops.get(i)
- + " in an OperatorExpr starting with " + opLogical);
+ throw new TranslationException(
+ "Unexpected operator " + ops.get(i) + " in an OperatorExpr starting with " + opLogical);
}
}
f.getArguments().add(new MutableObject<ILogicalExpression>(p.first));
@@ -1175,9 +1170,9 @@
private static boolean expressionNeedsNoNesting(Expression expr) {
Kind k = expr.getKind();
return k == Kind.LITERAL_EXPRESSION || k == Kind.LIST_CONSTRUCTOR_EXPRESSION
- || k == Kind.RECORD_CONSTRUCTOR_EXPRESSION || k == Kind.VARIABLE_EXPRESSION
- || k == Kind.CALL_EXPRESSION || k == Kind.OP_EXPRESSION || k == Kind.FIELD_ACCESSOR_EXPRESSION
- || k == Kind.INDEX_ACCESSOR_EXPRESSION || k == Kind.UNARY_EXPRESSION;
+ || k == Kind.RECORD_CONSTRUCTOR_EXPRESSION || k == Kind.VARIABLE_EXPRESSION || k == Kind.CALL_EXPRESSION
+ || k == Kind.OP_EXPRESSION || k == Kind.FIELD_ACCESSOR_EXPRESSION || k == Kind.INDEX_ACCESSOR_EXPRESSION
+ || k == Kind.UNARY_EXPRESSION;
}
private <T> ArrayList<T> mkSingletonArrayList(T item) {
@@ -1187,63 +1182,63 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeDecl(TypeDecl td, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeDecl td, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitRecordTypeDefiniton(RecordTypeDefinition tre,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeReferenceExpression(TypeReferenceExpression tre,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitNodegroupDecl(NodegroupDecl ngd, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(RecordTypeDefinition tre, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitLoadStatement(LoadStatement stmtLoad,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropStatement(DropStatement del, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeReferenceExpression tre, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateIndexStatement(CreateIndexStatement cis,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(NodegroupDecl ngd, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitOrderedListTypeDefiniton(OrderedListTypeDefinition olte,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(LoadStatement stmtLoad, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitUnorderedListTypeDefiniton(UnorderedListTypeDefinition ulte,
+ public Pair<ILogicalOperator, LogicalVariable> visit(DropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateIndexStatement cis, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(OrderedListTypeDefinition olte, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(UnorderedListTypeDefinition ulte,
Mutable<ILogicalOperator> arg) throws AsterixException {
// TODO Auto-generated method stub
return null;
@@ -1302,8 +1297,8 @@
public Pair<ILogicalOperator, LogicalVariable> visitMetaVariableExpr(MetaVariableExpr me,
Mutable<ILogicalOperator> tupSource) throws AsterixException {
LogicalVariable var = context.newVar();
- AssignOperator a = new AssignOperator(var, new MutableObject<ILogicalExpression>(
- metaScopeExp.getVariableReferenceExpression(me.getVar())));
+ AssignOperator a = new AssignOperator(var,
+ new MutableObject<ILogicalExpression>(metaScopeExp.getVariableReferenceExpression(me.getVar())));
a.getInputs().add(tupSource);
return new Pair<ILogicalOperator, LogicalVariable>(a, var);
}
@@ -1340,99 +1335,99 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitInsertStatement(InsertStatement insert,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitDeleteStatement(DeleteStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitUpdateStatement(UpdateStatement update,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitUpdateClause(UpdateClause del, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(InsertStatement insert, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDataverseDecl(DataverseDecl dv, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(DeleteStatement del, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDatasetDecl(DatasetDecl dd, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UpdateStatement update, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitSetStatement(SetStatement ss, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(UpdateClause del, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitWriteStatement(WriteStatement ws, Mutable<ILogicalOperator> arg)
+ public Pair<ILogicalOperator, LogicalVariable> visit(DataverseDecl dv, Mutable<ILogicalOperator> arg)
throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateDataverseStatement(CreateDataverseStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(DatasetDecl dd, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitIndexDropStatement(IndexDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(SetStatement ss, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitNodeGroupDropStatement(NodeGroupDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(WriteStatement ws, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDataverseDropStatement(DataverseDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateDataverseStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitTypeDropStatement(TypeDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(IndexDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDisconnectFeedStatement(DisconnectFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(NodeGroupDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(DataverseDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(TypeDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(DisconnectFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@@ -1445,57 +1440,57 @@
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitFunctionDropStatement(FunctionDropStatement del,
+ public Pair<ILogicalOperator, LogicalVariable> visit(FunctionDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(ConnectFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(FeedDropStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CompactStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreatePrimaryFeedStatement del, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateSecondaryFeedStatement del,
Mutable<ILogicalOperator> arg) throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitConnectFeedStatement(ConnectFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(CreateFeedPolicyStatement cfps, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
@Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropFeedStatement(FeedDropStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitCompactStatement(CompactStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreatePrimaryFeedStatement(CreatePrimaryFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateSecondaryFeedStatement(CreateSecondaryFeedStatement del,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitCreateFeedPolicyStatement(CreateFeedPolicyStatement cfps,
- Mutable<ILogicalOperator> arg) throws AsterixException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Pair<ILogicalOperator, LogicalVariable> visitDropFeedPolicyStatement(FeedPolicyDropStatement dfs,
- Mutable<ILogicalOperator> arg) throws AsterixException {
+ public Pair<ILogicalOperator, LogicalVariable> visit(FeedPolicyDropStatement dfs, Mutable<ILogicalOperator> arg)
+ throws AsterixException {
// TODO Auto-generated method stub
return null;
}
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
index 25649ee..013d226 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
@@ -22,25 +22,25 @@
import java.util.List;
import java.util.Map;
-import org.apache.asterix.aql.base.Clause;
-import org.apache.asterix.aql.base.Expression;
-import org.apache.asterix.aql.base.Statement.Kind;
-import org.apache.asterix.aql.expression.CallExpr;
-import org.apache.asterix.aql.expression.FLWOGRExpression;
-import org.apache.asterix.aql.expression.FieldAccessor;
-import org.apache.asterix.aql.expression.FieldBinding;
-import org.apache.asterix.aql.expression.ForClause;
-import org.apache.asterix.aql.expression.Identifier;
-import org.apache.asterix.aql.expression.LiteralExpr;
-import org.apache.asterix.aql.expression.Query;
-import org.apache.asterix.aql.expression.RecordConstructor;
-import org.apache.asterix.aql.expression.VariableExpr;
-import org.apache.asterix.aql.expression.WhereClause;
-import org.apache.asterix.aql.literal.StringLiteral;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.feeds.FeedConnectionRequest;
import org.apache.asterix.common.functions.FunctionConstants;
import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.aql.clause.ForClause;
+import org.apache.asterix.lang.aql.expression.FLWOGRExpression;
+import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.Statement.Kind;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.literal.StringLiteral;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.struct.Identifier;
import org.apache.asterix.metadata.declared.AqlMetadataProvider;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.om.types.ARecordType;
@@ -211,7 +211,8 @@
private final int gramLength;
public CompiledCreateIndexStatement(String indexName, String dataverseName, String datasetName,
- List<List<String>> keyFields, List<IAType> keyTypes, boolean isEnforced, int gramLength, IndexType indexType) {
+ List<List<String>> keyFields, List<IAType> keyTypes, boolean isEnforced, int gramLength,
+ IndexType indexType) {
this.indexName = indexName;
this.dataverseName = dataverseName;
this.datasetName = datasetName;
@@ -390,7 +391,7 @@
return policyName;
}
}
-
+
public static class CompiledSubscribeFeedStatement implements ICompiledDmlStatement {
private final FeedConnectionRequest request;
@@ -432,7 +433,6 @@
}
-
public static class CompiledDisconnectFeedStatement implements ICompiledDmlStatement {
private String dataverseName;
private String datasetName;
@@ -483,8 +483,8 @@
private int varCounter;
private AqlMetadataProvider metadataProvider;
- public CompiledDeleteStatement(VariableExpr var, String dataverseName, String datasetName,
- Expression condition, int varCounter, AqlMetadataProvider metadataProvider) {
+ public CompiledDeleteStatement(VariableExpr var, String dataverseName, String datasetName, Expression condition,
+ int varCounter, AqlMetadataProvider metadataProvider) {
this.var = var;
this.dataverseName = dataverseName;
this.datasetName = datasetName;
@@ -592,7 +592,8 @@
private final int gramLength;
public CompiledIndexCompactStatement(String dataverseName, String datasetName, String indexName,
- List<List<String>> keyFields, List<IAType> keyTypes, boolean isEnforced, int gramLength, IndexType indexType) {
+ List<List<String>> keyFields, List<IAType> keyTypes, boolean isEnforced, int gramLength,
+ IndexType indexType) {
super(dataverseName, datasetName);
this.indexName = indexName;
this.keyFields = keyFields;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
index dcbc697..8a2d3a5 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/ConstantHelper.java
@@ -18,12 +18,12 @@
*/
package org.apache.asterix.translator;
-import org.apache.asterix.aql.base.Literal;
-import org.apache.asterix.aql.literal.DoubleLiteral;
-import org.apache.asterix.aql.literal.FloatLiteral;
-import org.apache.asterix.aql.literal.IntegerLiteral;
-import org.apache.asterix.aql.literal.LongIntegerLiteral;
-import org.apache.asterix.aql.literal.StringLiteral;
+import org.apache.asterix.lang.common.base.Literal;
+import org.apache.asterix.lang.common.literal.DoubleLiteral;
+import org.apache.asterix.lang.common.literal.FloatLiteral;
+import org.apache.asterix.lang.common.literal.IntegerLiteral;
+import org.apache.asterix.lang.common.literal.LongIntegerLiteral;
+import org.apache.asterix.lang.common.literal.StringLiteral;
import org.apache.asterix.om.base.ABoolean;
import org.apache.asterix.om.base.ADouble;
import org.apache.asterix.om.base.AFloat;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
index 74e4d3a..70236b1 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
@@ -20,7 +20,7 @@
import java.util.HashMap;
-import org.apache.asterix.aql.expression.VariableExpr;
+import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.hyracks.algebricks.core.algebra.base.Counter;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
index 6230cbf..bff41ab 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
@@ -25,15 +25,15 @@
import java.util.List;
import java.util.Map;
-import org.apache.asterix.aql.expression.OrderedListTypeDefinition;
-import org.apache.asterix.aql.expression.RecordTypeDefinition;
-import org.apache.asterix.aql.expression.RecordTypeDefinition.RecordKind;
-import org.apache.asterix.aql.expression.TypeExpression;
-import org.apache.asterix.aql.expression.TypeReferenceExpression;
-import org.apache.asterix.aql.expression.UnorderedListTypeDefinition;
import org.apache.asterix.common.annotations.IRecordFieldDataGen;
import org.apache.asterix.common.annotations.RecordDataGenAnnotation;
import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
+import org.apache.asterix.lang.common.expression.TypeExpression;
+import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
+import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition.RecordKind;
import org.apache.asterix.metadata.MetadataException;
import org.apache.asterix.metadata.MetadataManager;
import org.apache.asterix.metadata.MetadataTransactionContext;
@@ -60,8 +60,8 @@
}
public static Map<TypeSignature, IAType> computeTypes(MetadataTransactionContext mdTxnCtx, TypeExpression typeExpr,
- String typeName, String typeDataverse, Map<TypeSignature, IAType> typeMap) throws AlgebricksException,
- MetadataException {
+ String typeName, String typeDataverse, Map<TypeSignature, IAType> typeMap)
+ throws AlgebricksException, MetadataException {
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes = new HashMap<String, Map<ARecordType, List<Integer>>>();
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes = new HashMap<TypeSignature, List<AbstractCollectionType>>();
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences = new HashMap<TypeSignature, List<TypeSignature>>();
@@ -82,7 +82,7 @@
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences, String typeDataverse)
- throws AlgebricksException {
+ throws AlgebricksException {
if (builtinTypeMap.get(typeName) != null) {
throw new AlgebricksException("Cannot redefine builtin type " + typeName + " .");
@@ -135,7 +135,7 @@
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<TypeSignature, List<TypeSignature>> incompleteTopLevelTypeReferences, String typeDataverse)
- throws AlgebricksException, MetadataException {
+ throws AlgebricksException, MetadataException {
// solve remaining top level references
for (TypeSignature typeSignature : incompleteTopLevelTypeReferences.keySet()) {
@@ -196,7 +196,7 @@
private static AOrderedListType computeOrderedListType(TypeSignature typeSignature, OrderedListTypeDefinition oltd,
Map<TypeSignature, IAType> typeMap, Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaultDataverse)
- throws AsterixException {
+ throws AsterixException {
TypeExpression tExpr = oltd.getItemTypeExpression();
String typeName = typeSignature != null ? typeSignature.getName() : null;
AOrderedListType aolt = new AOrderedListType(null, typeName);
@@ -208,7 +208,7 @@
UnorderedListTypeDefinition ultd, Map<TypeSignature, IAType> typeMap,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes,
Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes, String defaulDataverse)
- throws AsterixException {
+ throws AsterixException {
TypeExpression tExpr = ultd.getItemTypeExpression();
String typeName = typeSignature != null ? typeSignature.getName() : null;
AUnorderedListType ault = new AUnorderedListType(null, typeName);
@@ -313,7 +313,7 @@
private static ARecordType computeRecordType(TypeSignature typeSignature, RecordTypeDefinition rtd,
Map<TypeSignature, IAType> typeMap, Map<String, Map<ARecordType, List<Integer>>> incompleteFieldTypes,
Map<TypeSignature, List<AbstractCollectionType>> incompleteItemTypes, String defaultDataverse)
- throws AsterixException {
+ throws AsterixException {
List<String> names = rtd.getFieldNames();
int n = names.size();
String[] fldNames = new String[n];
@@ -361,8 +361,8 @@
}
case RECORD: {
RecordTypeDefinition recTypeDef2 = (RecordTypeDefinition) texpr;
- IAType t2 = computeRecordType(null, recTypeDef2, typeMap, incompleteFieldTypes,
- incompleteItemTypes, defaultDataverse);
+ IAType t2 = computeRecordType(null, recTypeDef2, typeMap, incompleteFieldTypes, incompleteItemTypes,
+ defaultDataverse);
if (!rtd.getNullableFields().get(j)) { // not nullable
fldTypes[j] = t2;
} else { // nullable
@@ -379,8 +379,8 @@
}
case UNORDEREDLIST: {
UnorderedListTypeDefinition ultd = (UnorderedListTypeDefinition) texpr;
- IAType t2 = computeUnorderedListType(null, ultd, typeMap, incompleteItemTypes,
- incompleteFieldTypes, defaultDataverse);
+ IAType t2 = computeUnorderedListType(null, ultd, typeMap, incompleteItemTypes, incompleteFieldTypes,
+ defaultDataverse);
fldTypes[j] = (rtd.getNullableFields().get(j)) ? AUnionType.createNullableType(t2) : t2;
break;
}
diff --git a/asterix-algebra/src/main/javacc/AQLPlus.jj b/asterix-algebra/src/main/javacc/AQLPlus.jj
index 6b7b361..853631c 100644
--- a/asterix-algebra/src/main/javacc/AQLPlus.jj
+++ b/asterix-algebra/src/main/javacc/AQLPlus.jj
@@ -29,40 +29,79 @@
package org.apache.asterix.aqlplus.parser;
-import java.io.*;
-import java.util.List;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.ArrayList;
-import java.util.Stack;
-import java.util.Map;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-import org.apache.asterix.aql.literal.FloatLiteral;
-import org.apache.asterix.aql.literal.DoubleLiteral;
-import org.apache.asterix.aql.literal.FalseLiteral;
-import org.apache.asterix.aql.base.Literal;
-import org.apache.asterix.aql.literal.IntegerLiteral;
-import org.apache.asterix.aql.literal.LongIntegerLiteral;
-import org.apache.asterix.aql.literal.NullLiteral;
-import org.apache.asterix.aql.literal.StringLiteral;
-import org.apache.asterix.aql.literal.TrueLiteral;
-import org.apache.asterix.aql.parser.ScopeChecker;
-import org.apache.asterix.aql.base.*;
-import org.apache.asterix.aql.expression.*;
-import org.apache.asterix.aql.expression.visitor.AQLPrintVisitor;
-import org.apache.asterix.aql.expression.UnaryExpr.Sign;
-import org.apache.asterix.aql.expression.TypeExpression.TypeExprKind;
-import org.apache.asterix.aql.base.Statement.Kind;
-import org.apache.asterix.aql.context.Scope;
-import org.apache.asterix.aql.context.RootScopeFactory;
import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.om.functions.AsterixFunction;
import org.apache.asterix.common.functions.FunctionSignature;
+import org.apache.asterix.lang.aql.clause.DistinctClause;
+import org.apache.asterix.lang.aql.clause.ForClause;
+import org.apache.asterix.lang.aql.clause.JoinClause;
+import org.apache.asterix.lang.aql.clause.MetaVariableClause;
+import org.apache.asterix.lang.aql.expression.FLWOGRExpression;
+import org.apache.asterix.lang.aql.expression.MetaVariableExpr;
+import org.apache.asterix.lang.aql.expression.UnionExpr;
+import org.apache.asterix.lang.common.base.Clause;
+import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.Literal;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.clause.GroupbyClause;
+import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.clause.LimitClause;
+import org.apache.asterix.lang.common.clause.OrderbyClause;
+import org.apache.asterix.lang.common.clause.WhereClause;
+import org.apache.asterix.lang.common.context.RootScopeFactory;
+import org.apache.asterix.lang.common.context.Scope;
+import org.apache.asterix.lang.common.expression.AbstractAccessor;
+import org.apache.asterix.lang.common.expression.CallExpr;
+import org.apache.asterix.lang.common.expression.FieldAccessor;
+import org.apache.asterix.lang.common.expression.FieldBinding;
+import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
+import org.apache.asterix.lang.common.expression.IfExpr;
+import org.apache.asterix.lang.common.expression.IndexAccessor;
+import org.apache.asterix.lang.common.expression.ListConstructor;
+import org.apache.asterix.lang.common.expression.LiteralExpr;
+import org.apache.asterix.lang.common.expression.OperatorExpr;
+import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.QuantifiedExpression;
+import org.apache.asterix.lang.common.expression.RecordConstructor;
+import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
+import org.apache.asterix.lang.common.expression.TypeExpression;
+import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
+import org.apache.asterix.lang.common.expression.UnaryExpr;
+import org.apache.asterix.lang.common.expression.UnaryExpr.Sign;
+import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
+import org.apache.asterix.lang.common.expression.VariableExpr;
+import org.apache.asterix.lang.common.literal.DoubleLiteral;
+import org.apache.asterix.lang.common.literal.FalseLiteral;
+import org.apache.asterix.lang.common.literal.FloatLiteral;
+import org.apache.asterix.lang.common.literal.IntegerLiteral;
+import org.apache.asterix.lang.common.literal.LongIntegerLiteral;
+import org.apache.asterix.lang.common.literal.NullLiteral;
+import org.apache.asterix.lang.common.literal.StringLiteral;
+import org.apache.asterix.lang.common.literal.TrueLiteral;
+import org.apache.asterix.lang.common.parser.ScopeChecker;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.LoadStatement;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.statement.SetStatement;
+import org.apache.asterix.lang.common.statement.TypeDecl;
+import org.apache.asterix.lang.common.statement.WriteStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
+import org.apache.asterix.lang.common.struct.QuantifiedPair;
+import org.apache.asterix.lang.common.struct.VarIdentifier;
import org.apache.asterix.metadata.bootstrap.MetadataConstants;
-
-import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionAnnotation;
import org.apache.hyracks.algebricks.core.algebra.expressions.IndexedNLJoinExpressionAnnotation;
-import org.apache.hyracks.algebricks.common.utils.Pair;
-
public class AQLPlusParser extends ScopeChecker {
@@ -1251,7 +1290,7 @@
{
getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
lc.setVarExpr(varExp);
- lc.setBeExpr(beExp);
+ lc.setBindingExpr(beExp);
return lc;
}
}