asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject [7/7] asterixdb git commit: ASTERIXDB-1711: remove some Aql-prefixes
Date Thu, 24 Nov 2016 00:57:34 GMT
ASTERIXDB-1711: remove some Aql-prefixes

Change-Id: Ia0b64ffa7c50cd62fc3303fdb44eb769f56c978a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1314
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/42600592
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/42600592
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/42600592

Branch: refs/heads/master
Commit: 426005929cac4d839899f948389e3e89cfce0db2
Parents: beeff1d
Author: Till Westmann <tillw@apache.org>
Authored: Tue Nov 22 23:07:50 2016 -0800
Committer: Till Westmann <tillw@apache.org>
Committed: Wed Nov 23 16:56:47 2016 -0800

----------------------------------------------------------------------
 .../ILangExpressionToPlanTranslatorFactory.java |    4 +-
 .../algebra/extension/IExtensionStatement.java  |    4 +-
 .../physical/BTreeSearchPOperator.java          |   12 +-
 .../operators/physical/CommitPOperator.java     |    4 +-
 .../physical/ExternalDataLookupPOperator.java   |   22 +-
 .../physical/IndexSearchPOperator.java          |    6 +-
 .../physical/InvertedIndexPOperator.java        |   14 +-
 .../physical/RTreeSearchPOperator.java          |    8 +-
 .../asterix/optimizer/base/AnalysisUtil.java    |    4 +-
 .../asterix/optimizer/base/FuzzyUtils.java      |    8 +-
 .../optimizer/rules/ConstantFoldingRule.java    |    6 +-
 .../asterix/optimizer/rules/FuzzyEqRule.java    |    6 +-
 .../asterix/optimizer/rules/FuzzyJoinRule.java  |    4 +-
 .../rules/IntroduceAutogenerateIDRule.java      |    6 +-
 .../rules/IntroduceDynamicTypeCastRule.java     |    6 +-
 ...aterializationForInsertWithSelfScanRule.java |   10 +-
 ...ceRandomPartitioningFeedComputationRule.java |    7 +-
 ...IntroduceSecondaryIndexInsertDeleteRule.java |   14 +-
 .../IntroduceStaticTypeCastForInsertRule.java   |    4 +-
 .../rules/MetaFunctionToMetaVariableRule.java   |   11 +-
 .../optimizer/rules/PushFieldAccessRule.java    |   21 +-
 .../rules/RemoveSortInFeedIngestionRule.java    |    7 +-
 .../optimizer/rules/ResolveVariableRule.java    |    8 +-
 .../rules/SetAsterixPhysicalOperatorsRule.java  |   10 +-
 .../rules/SetupCommitExtensionOpRule.java       |    4 +-
 .../optimizer/rules/UnnestToDataScanRule.java   |   24 +-
 .../am/AbstractIntroduceAccessMethodRule.java   |   14 +-
 .../optimizer/rules/am/AccessMethodUtils.java   |    4 +-
 .../rules/am/IntroduceJoinAccessMethodRule.java |    4 +-
 .../am/IntroduceLSMComponentFilterRule.java     |   19 +-
 .../am/IntroduceSelectAccessMethodRule.java     |    4 +-
 .../rules/am/InvertedIndexAccessMethod.java     |    8 +-
 .../rules/am/OptimizableOperatorSubTree.java    |   16 +-
 .../AqlExpressionToPlanTranslator.java          |    4 +-
 .../AqlExpressionToPlanTranslatorFactory.java   |    4 +-
 .../AqlPlusExpressionToPlanTranslator.java      |    8 +-
 .../asterix/translator/IStatementExecutor.java  |    4 +-
 .../LangExpressionToPlanTranslator.java         |   19 +-
 .../SqlppExpressionToPlanTranslator.java        |    4 +-
 .../SqlppExpressionToPlanTranslatorFactory.java |    4 +-
 .../apache/asterix/api/common/APIFramework.java |   10 +-
 .../api/http/servlet/ConnectorAPIServlet.java   |    4 +-
 .../external/ExternalIndexingOperations.java    |   26 +-
 .../asterix/app/external/FeedOperations.java    |    6 +-
 .../asterix/app/translator/QueryTranslator.java |   72 +-
 .../apache/asterix/file/DatasetOperations.java  |   10 +-
 .../asterix/file/DataverseOperations.java       |    4 +-
 .../apache/asterix/file/IndexOperations.java    |   12 +-
 .../file/SecondaryBTreeOperationsHelper.java    |    4 +-
 .../file/SecondaryIndexOperationsHelper.java    |   10 +-
 .../SecondaryInvertedIndexOperationsHelper.java |    6 +-
 .../file/SecondaryRTreeOperationsHelper.java    |   26 +-
 .../bootstrap/GlobalRecoveryManager.java        |    4 +-
 .../apache/asterix/util/FlushDatasetUtils.java  |    4 +-
 .../http/servlet/ConnectorAPIServletTest.java   |    4 +-
 .../asterix/test/sqlpp/ParserTestExecutor.java  |   16 +-
 .../lang/aql/rewrites/AqlQueryRewriter.java     |    8 +-
 .../lang/aql/visitor/AQLInlineUdfsVisitor.java  |    4 +-
 .../lang/common/base/IQueryRewriter.java        |    4 +-
 .../asterix/lang/common/util/FunctionUtil.java  |    4 +-
 .../visitor/AbstractInlineUdfsVisitor.java      |    6 +-
 .../rewrites/SqlppFunctionBodyRewriter.java     |    4 +-
 .../lang/sqlpp/rewrites/SqlppQueryRewriter.java |    8 +-
 .../visitor/SqlppInlineUdfsVisitor.java         |    4 +-
 .../visitor/VariableCheckAndRewriteVisitor.java |    6 +-
 .../metadata/declared/AqlDataSource.java        |  164 --
 .../AqlDataSourcePartitioningProvider.java      |  109 -
 .../asterix/metadata/declared/AqlIndex.java     |   61 -
 .../declared/AqlLogicalPlanAndMetadataImpl.java |    6 +-
 .../metadata/declared/AqlMetadataProvider.java  | 2255 -----------------
 .../asterix/metadata/declared/AqlSourceId.java  |   46 -
 .../asterix/metadata/declared/DataSource.java   |  164 ++
 .../asterix/metadata/declared/DataSourceId.java |   46 +
 .../metadata/declared/DataSourceIndex.java      |   61 +
 .../DataSourcePartitioningProvider.java         |  108 +
 .../metadata/declared/DatasetDataSource.java    |   22 +-
 .../metadata/declared/FeedDataSource.java       |    8 +-
 .../metadata/declared/LoadableDataSource.java   |   10 +-
 .../metadata/declared/MetadataManagerUtil.java  |   12 +-
 .../metadata/declared/MetadataProvider.java     | 2256 ++++++++++++++++++
 .../functions/MetadataBuiltinFunctions.java     |   10 +-
 .../asterix/metadata/utils/DatasetUtils.java    |    4 +-
 .../utils/ExternalDatasetsRegistry.java         |    6 +-
 .../data/common/AqlExpressionTypeComputer.java  |   97 -
 .../data/common/ExpressionTypeComputer.java     |   97 +
 85 files changed, 3074 insertions(+), 3084 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslatorFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslatorFactory.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslatorFactory.java
index 1c241e7..5db516e 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslatorFactory.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/base/ILangExpressionToPlanTranslatorFactory.java
@@ -18,7 +18,7 @@
  */
 package org.apache.asterix.algebra.base;
 
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 
 public interface ILangExpressionToPlanTranslatorFactory {
@@ -31,7 +31,7 @@ public interface ILangExpressionToPlanTranslatorFactory {
      * @return a logical query plan.
      * @throws AlgebricksException
      */
-    ILangExpressionToPlanTranslator createExpressionToPlanTranslator(AqlMetadataProvider metadataProvider,
+    ILangExpressionToPlanTranslator createExpressionToPlanTranslator(MetadataProvider metadataProvider,
             int currentVarCountert) throws AlgebricksException;
 
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IExtensionStatement.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IExtensionStatement.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IExtensionStatement.java
index d15ae6f..b0f863b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IExtensionStatement.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/extension/IExtensionStatement.java
@@ -19,7 +19,7 @@
 package org.apache.asterix.algebra.extension;
 
 import org.apache.asterix.lang.common.base.Statement;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.translator.IStatementExecutor;
 import org.apache.asterix.translator.IStatementExecutor.ResultDelivery;
 import org.apache.asterix.translator.IStatementExecutor.Stats;
@@ -49,7 +49,7 @@ public interface IExtensionStatement extends Statement {
      * @param resultSetIdCounter
      * @throws Exception
      */
-    void handle(IStatementExecutor statementExecutor, AqlMetadataProvider metadataProvider,
+    void handle(IStatementExecutor statementExecutor, MetadataProvider metadataProvider,
             IHyracksClientConnection hcc, IHyracksDataset hdc, ResultDelivery resultDelivery, Stats stats,
             int resultSetIdCounter) throws HyracksDataException, AlgebricksException;
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
index c3796ac..c9223b4 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/BTreeSearchPOperator.java
@@ -21,9 +21,9 @@ package org.apache.asterix.algebra.operators.physical;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.metadata.declared.AqlIndex;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.DataSourceIndex;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -72,7 +72,7 @@ public class BTreeSearchPOperator extends IndexSearchPOperator {
     private final boolean isEqCondition;
     private Object implConfig;
 
-    public BTreeSearchPOperator(IDataSourceIndex<String, AqlSourceId> idx, INodeDomain domain,
+    public BTreeSearchPOperator(IDataSourceIndex<String, DataSourceId> idx, INodeDomain domain,
             boolean requiresBroadcast, boolean isPrimaryIndex, boolean isEqCondition,
             List<LogicalVariable> lowKeyVarList, List<LogicalVariable> highKeyVarList) {
         super(idx, domain, requiresBroadcast);
@@ -117,7 +117,7 @@ public class BTreeSearchPOperator extends IndexSearchPOperator {
         int[] minFilterFieldIndexes = getKeyIndexes(unnestMap.getMinFilterVars(), inputSchemas);
         int[] maxFilterFieldIndexes = getKeyIndexes(unnestMap.getMaxFilterVars(), inputSchemas);
 
-        AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
         Dataset dataset = metadataProvider.findDataset(jobGenParams.getDataverseName(), jobGenParams.getDatasetName());
         IVariableTypeEnvironment typeEnv = context.getTypeEnvironment(op);
         List<LogicalVariable> outputVars = unnestMap.getVariables();
@@ -150,7 +150,7 @@ public class BTreeSearchPOperator extends IndexSearchPOperator {
             if (isPrimaryIndex && isEqCondition) {
 
                 // If this is a composite primary index, then all of the keys should be provided.
-                Index searchIndex = ((AqlIndex) idx).getIndex();
+                Index searchIndex = ((DataSourceIndex) idx).getIndex();
                 int numberOfKeyFields = searchIndex.getKeyFieldNames().size();
 
                 if (numberOfKeyFields < 2

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitPOperator.java
index 5a1c929..5426ccc 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/CommitPOperator.java
@@ -22,7 +22,7 @@ package org.apache.asterix.algebra.operators.physical;
 import java.util.List;
 
 import org.apache.asterix.common.transactions.JobId;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.IHyracksJobBuilder;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
@@ -87,7 +87,7 @@ public class CommitPOperator extends AbstractPhysicalOperator {
     public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
             IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
                     throws AlgebricksException {
-        AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
         RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema,
                 context);
         int[] primaryKeyFields = JobGenHelper.variablesToFieldIndexes(primaryKeyLogicalVars, inputSchemas[0]);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/ExternalDataLookupPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/ExternalDataLookupPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/ExternalDataLookupPOperator.java
index 0fb6be7..81cc402 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/ExternalDataLookupPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/ExternalDataLookupPOperator.java
@@ -21,11 +21,11 @@ package org.apache.asterix.algebra.operators.physical;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSource.Type;
+import org.apache.asterix.metadata.declared.DataSourceId;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -60,7 +60,7 @@ import org.apache.hyracks.api.dataflow.IOperatorDescriptor;
 public class ExternalDataLookupPOperator extends AbstractScanPOperator {
 
     private final List<LogicalVariable> ridVarList;
-    private AqlSourceId datasetId;
+    private DataSourceId datasetId;
     private Dataset dataset;
     private ARecordType recordType;
     private Index secondaryIndex;
@@ -68,7 +68,7 @@ public class ExternalDataLookupPOperator extends AbstractScanPOperator {
     private boolean retainInput;
     private boolean retainNull;
 
-    public ExternalDataLookupPOperator(AqlSourceId datasetId, Dataset dataset, ARecordType recordType,
+    public ExternalDataLookupPOperator(DataSourceId datasetId, Dataset dataset, ARecordType recordType,
             Index secondaryIndex, List<LogicalVariable> ridVarList, boolean requiresBroadcast, boolean retainInput,
             boolean retainNull) {
         this.datasetId = datasetId;
@@ -97,11 +97,11 @@ public class ExternalDataLookupPOperator extends AbstractScanPOperator {
         this.recordType = recordType;
     }
 
-    public AqlSourceId getDatasetId() {
+    public DataSourceId getDatasetId() {
         return datasetId;
     }
 
-    public void setDatasetId(AqlSourceId datasetId) {
+    public void setDatasetId(DataSourceId datasetId) {
         this.datasetId = datasetId;
     }
 
@@ -113,8 +113,8 @@ public class ExternalDataLookupPOperator extends AbstractScanPOperator {
     @Override
     public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context)
             throws AlgebricksException {
-        AqlDataSource ds = new DatasetDataSource(datasetId, dataset, recordType,
-                null /*external dataset doesn't have meta records.*/, AqlDataSourceType.EXTERNAL_DATASET,
+        DataSource ds = new DatasetDataSource(datasetId, dataset, recordType,
+                null /*external dataset doesn't have meta records.*/, Type.EXTERNAL_DATASET,
                 dataset.getDatasetDetails(), context.getComputationNodeDomain());
         IDataSourcePropertiesProvider dspp = ds.getPropertiesProvider();
         AbstractScanOperator as = (AbstractScanOperator) op;
@@ -144,7 +144,7 @@ public class ExternalDataLookupPOperator extends AbstractScanPOperator {
             VariableUtilities.getProducedVariables(unnestMap, outputVars);
         }
 
-        AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
         Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> externalLoopup = metadataProvider
                 .buildExternalDataLookupRuntime(builder.getJobSpec(), dataset, secondaryIndex, ridIndexes, retainInput,
                         typeEnv, outputVars, opSchema, context, metadataProvider, retainNull);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IndexSearchPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IndexSearchPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IndexSearchPOperator.java
index ec59dae..ce43480 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IndexSearchPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/IndexSearchPOperator.java
@@ -20,7 +20,7 @@ package org.apache.asterix.algebra.operators.physical;
 
 import java.util.List;
 
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
@@ -42,11 +42,11 @@ import org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertie
  */
 public abstract class IndexSearchPOperator extends AbstractScanPOperator {
 
-    protected final IDataSourceIndex<String, AqlSourceId> idx;
+    protected final IDataSourceIndex<String, DataSourceId> idx;
     protected final boolean requiresBroadcast;
     protected final INodeDomain domain;
 
-    public IndexSearchPOperator(IDataSourceIndex<String, AqlSourceId> idx, INodeDomain domain,
+    public IndexSearchPOperator(IDataSourceIndex<String, DataSourceId> idx, INodeDomain domain,
             boolean requiresBroadcast) {
         this.idx = idx;
         this.requiresBroadcast = requiresBroadcast;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/InvertedIndexPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/InvertedIndexPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/InvertedIndexPOperator.java
index ec2b41e..4a00ce1 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/InvertedIndexPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/InvertedIndexPOperator.java
@@ -26,11 +26,10 @@ import org.apache.asterix.common.config.AsterixStorageProperties;
 import org.apache.asterix.common.context.AsterixVirtualBufferCacheProvider;
 import org.apache.asterix.common.dataflow.IAsterixApplicationContextInfo;
 import org.apache.asterix.common.ioopcallbacks.LSMInvertedIndexIOOperationCallbackFactory;
-import org.apache.asterix.runtime.util.AsterixRuntimeComponentsProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataManager;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.utils.DatasetUtils;
@@ -43,8 +42,9 @@ import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.optimizer.rules.am.InvertedIndexAccessMethod;
 import org.apache.asterix.optimizer.rules.am.InvertedIndexAccessMethod.SearchModifierType;
-import org.apache.asterix.runtime.util.AsterixAppContextInfo;
 import org.apache.asterix.optimizer.rules.am.InvertedIndexJobGenParams;
+import org.apache.asterix.runtime.util.AsterixAppContextInfo;
+import org.apache.asterix.runtime.util.AsterixRuntimeComponentsProvider;
 import org.apache.asterix.transaction.management.opcallbacks.SecondaryIndexOperationTrackerProvider;
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -90,7 +90,7 @@ import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokeniz
 public class InvertedIndexPOperator extends IndexSearchPOperator {
     private final boolean isPartitioned;
 
-    public InvertedIndexPOperator(IDataSourceIndex<String, AqlSourceId> idx, INodeDomain domain,
+    public InvertedIndexPOperator(IDataSourceIndex<String, DataSourceId> idx, INodeDomain domain,
             boolean requiresBroadcast, boolean isPartitioned) {
         super(idx, domain, requiresBroadcast);
         this.isPartitioned = isPartitioned;
@@ -121,7 +121,7 @@ public class InvertedIndexPOperator extends IndexSearchPOperator {
         InvertedIndexJobGenParams jobGenParams = new InvertedIndexJobGenParams();
         jobGenParams.readFromFuncArgs(unnestFuncExpr.getArguments());
 
-        AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
         Dataset dataset;
         try {
             dataset = MetadataManager.INSTANCE.getDataset(metadataProvider.getMetadataTxnContext(),
@@ -153,7 +153,7 @@ public class InvertedIndexPOperator extends IndexSearchPOperator {
     }
 
     public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> buildInvertedIndexRuntime(
-            AqlMetadataProvider metadataProvider, JobGenContext context, JobSpecification jobSpec,
+            MetadataProvider metadataProvider, JobGenContext context, JobSpecification jobSpec,
             AbstractUnnestMapOperator unnestMap, IOperatorSchema opSchema, boolean retainInput, boolean retainMissing,
             String datasetName, Dataset dataset, String indexName, ATypeTag searchKeyType, int[] keyFields,
             SearchModifierType searchModifierType, IAlgebricksConstantValue similarityThreshold,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/RTreeSearchPOperator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/RTreeSearchPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/RTreeSearchPOperator.java
index 5d714ea..ca915c0 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/RTreeSearchPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/RTreeSearchPOperator.java
@@ -21,8 +21,8 @@ package org.apache.asterix.algebra.operators.physical;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.optimizer.rules.am.RTreeJobGenParams;
@@ -53,7 +53,7 @@ import org.apache.hyracks.api.dataflow.IOperatorDescriptor;
  */
 public class RTreeSearchPOperator extends IndexSearchPOperator {
 
-    public RTreeSearchPOperator(IDataSourceIndex<String, AqlSourceId> idx, INodeDomain domain,
+    public RTreeSearchPOperator(IDataSourceIndex<String, DataSourceId> idx, INodeDomain domain,
             boolean requiresBroadcast) {
         super(idx, domain, requiresBroadcast);
     }
@@ -84,7 +84,7 @@ public class RTreeSearchPOperator extends IndexSearchPOperator {
         int[] minFilterFieldIndexes = getKeyIndexes(unnestMap.getMinFilterVars(), inputSchemas);
         int[] maxFilterFieldIndexes = getKeyIndexes(unnestMap.getMaxFilterVars(), inputSchemas);
 
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
         Dataset dataset = mp.findDataset(jobGenParams.getDataverseName(), jobGenParams.getDatasetName());
         IVariableTypeEnvironment typeEnv = context.getTypeEnvironment(unnestMap);
         List<LogicalVariable> outputVars = unnestMap.getVariables();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/AnalysisUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/AnalysisUtil.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/AnalysisUtil.java
index beefc46..902da21 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/AnalysisUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/AnalysisUtil.java
@@ -21,7 +21,7 @@ package org.apache.asterix.optimizer.base;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.optimizer.rules.am.AccessMethodUtils;
 import org.apache.commons.lang3.mutable.Mutable;
@@ -128,7 +128,7 @@ public class AnalysisUtil {
     }
 
     public static Pair<String, String> getDatasetInfo(AbstractDataSourceOperator op) throws AlgebricksException {
-        AqlSourceId srcId = (AqlSourceId) op.getDataSource().getId();
+        DataSourceId srcId = (DataSourceId) op.getDataSource().getId();
         return new Pair<String, String>(srcId.getDataverseName(), srcId.getDatasourceName());
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
index b548218..f8182d3 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
@@ -21,7 +21,7 @@ package org.apache.asterix.optimizer.base;
 import java.util.ArrayList;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.base.AFloat;
 import org.apache.asterix.om.base.AInt32;
 import org.apache.asterix.om.base.IAObject;
@@ -59,7 +59,7 @@ public class FuzzyUtils {
         }
     }
 
-    public static IAObject getSimThreshold(AqlMetadataProvider metadata, String simFuncName) {
+    public static IAObject getSimThreshold(MetadataProvider metadata, String simFuncName) {
         String simThresholValue = metadata.getPropertyValue(SIM_THRESHOLD_PROP_NAME);
         IAObject ret = null;
         if (simFuncName.equals(JACCARD_FUNCTION_NAME)) {
@@ -101,7 +101,7 @@ public class FuzzyUtils {
         return null;
     }
 
-    public static float getSimThreshold(AqlMetadataProvider metadata) {
+    public static float getSimThreshold(MetadataProvider metadata) {
         float simThreshold = JACCARD_DEFAULT_SIM_THRESHOLD;
         String simThresholValue = metadata.getPropertyValue(SIM_THRESHOLD_PROP_NAME);
         if (simThresholValue != null) {
@@ -111,7 +111,7 @@ public class FuzzyUtils {
     }
 
     // TODO: The default function depend on the input types.
-    public static String getSimFunction(AqlMetadataProvider metadata) {
+    public static String getSimFunction(MetadataProvider metadata) {
         String simFunction = metadata.getPropertyValue(SIM_FUNCTION_PROP_NAME);
         if (simFunction == null) {
             simFunction = DEFAULT_SIM_FUNCTION;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
index ae31780..8a65ae5 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
@@ -24,7 +24,7 @@ import java.nio.ByteBuffer;
 import java.util.List;
 
 import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer;
+import org.apache.asterix.dataflow.data.common.ExpressionTypeComputer;
 import org.apache.asterix.dataflow.data.nontagged.AqlMissingWriterFactory;
 import org.apache.asterix.formats.nontagged.AqlADMPrinterFactoryProvider;
 import org.apache.asterix.formats.nontagged.AqlBinaryBooleanInspectorImpl;
@@ -117,7 +117,7 @@ public class ConstantFoldingRule implements IAlgebraicRewriteRule {
 
         @Override
         public Object getType(ILogicalExpression expr) throws AlgebricksException {
-            return AqlExpressionTypeComputer.INSTANCE.getType(expr, null, this);
+            return ExpressionTypeComputer.INSTANCE.getType(expr, null, this);
         }
     };
 
@@ -127,7 +127,7 @@ public class ConstantFoldingRule implements IAlgebraicRewriteRule {
             AqlTypeTraitProvider.INSTANCE, AqlBinaryBooleanInspectorImpl.FACTORY, AqlBinaryIntegerInspector.FACTORY,
             AqlADMPrinterFactoryProvider.INSTANCE, AqlMissingWriterFactory.INSTANCE, null,
             new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter(QueryLogicalExpressionJobGen.INSTANCE),
-            AqlExpressionTypeComputer.INSTANCE, null, null, null, null, GlobalConfig.DEFAULT_FRAME_SIZE, null);
+            ExpressionTypeComputer.INSTANCE, null, null, null, null, GlobalConfig.DEFAULT_FRAME_SIZE, null);
 
     private static final IOperatorSchema[] _emptySchemas = new IOperatorSchema[] {};
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
index 02386af..db5c14a 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyEqRule.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -66,7 +66,7 @@ public class FuzzyEqRule implements IAlgebraicRewriteRule {
             return false;
         }
 
-        AqlMetadataProvider metadataProvider = ((AqlMetadataProvider) context.getMetadataProvider());
+        MetadataProvider metadataProvider = ((MetadataProvider) context.getMetadataProvider());
 
         IVariableTypeEnvironment env = context.getOutputTypeEnvironment(op);
         if (expandFuzzyEq(expRef, context, env, metadataProvider)) {
@@ -77,7 +77,7 @@ public class FuzzyEqRule implements IAlgebraicRewriteRule {
     }
 
     private boolean expandFuzzyEq(Mutable<ILogicalExpression> expRef, IOptimizationContext context,
-            IVariableTypeEnvironment env, AqlMetadataProvider metadataProvider) throws AlgebricksException {
+            IVariableTypeEnvironment env, MetadataProvider metadataProvider) throws AlgebricksException {
         ILogicalExpression exp = expRef.getValue();
 
         if (exp.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
index 406d4ee..67302ba 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/FuzzyJoinRule.java
@@ -29,7 +29,7 @@ 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.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
 import org.apache.asterix.om.types.IAType;
@@ -205,7 +205,7 @@ public class FuzzyJoinRule implements IAlgebraicRewriteRule {
         //
         // -- - FIRE - --
         //
-        AqlMetadataProvider metadataProvider = ((AqlMetadataProvider) context.getMetadataProvider());
+        MetadataProvider metadataProvider = ((MetadataProvider) context.getMetadataProvider());
         FunctionIdentifier funcId = FuzzyUtils.getTokenizer(leftType.getTypeTag());
         String tokenizer;
         if (funcId == null) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
index c8d2760..db2ec2b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceAutogenerateIDRule.java
@@ -24,8 +24,8 @@ import java.util.List;
 
 import org.apache.asterix.algebra.operators.CommitOperator;
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSource.Type;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
 import org.apache.asterix.om.base.AString;
@@ -109,7 +109,7 @@ public class IntroduceAutogenerateIDRule implements IAlgebraicRewriteRule {
             return false;
         }
 
-        if (((AqlDataSource) insertOp.getDataSource()).getDatasourceType() != AqlDataSourceType.INTERNAL_DATASET) {
+        if (((DataSource) insertOp.getDataSource()).getDatasourceType() != Type.INTERNAL_DATASET) {
             return false;
         }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
index 28bcc7f..e7e0d20 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
@@ -24,7 +24,7 @@ import java.util.List;
 
 import org.apache.asterix.algebra.operators.CommitOperator;
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlDataSource;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.ARecordType;
@@ -116,9 +116,9 @@ public class IntroduceDynamicTypeCastRule implements IAlgebraicRewriteRule {
                     // Remember this is the operator we need to modify
                     op = insertDeleteOp;
 
-                    // Derive the required ARecordType based on the schema of the AqlDataSource
+                    // Derive the required ARecordType based on the schema of the DataSource
                     InsertDeleteUpsertOperator insertDeleteOperator = (InsertDeleteUpsertOperator) op2;
-                    AqlDataSource dataSource = (AqlDataSource) insertDeleteOperator.getDataSource();
+                    DataSource dataSource = (DataSource) insertDeleteOperator.getDataSource();
                     requiredRecordType = (ARecordType) dataSource.getItemType();
 
                     // Derive the Variable which we will potentially wrap with cast/null functions

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceMaterializationForInsertWithSelfScanRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceMaterializationForInsertWithSelfScanRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceMaterializationForInsertWithSelfScanRule.java
index a574711..67de414 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceMaterializationForInsertWithSelfScanRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceMaterializationForInsertWithSelfScanRule.java
@@ -18,8 +18,8 @@
  */
 package org.apache.asterix.optimizer.rules;
 
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSource.Type;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.optimizer.rules.am.AccessMethodJobGenParams;
@@ -104,9 +104,9 @@ public class IntroduceMaterializationForInsertWithSelfScanRule implements IAlgeb
                 }
             } else if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
                 DataSourceScanOperator dataSourceScanOp = (DataSourceScanOperator) descendantOp;
-                AqlDataSource ds = (AqlDataSource) dataSourceScanOp.getDataSource();
-                if ((ds.getDatasourceType() == AqlDataSourceType.INTERNAL_DATASET
-                        || ds.getDatasourceType() == AqlDataSourceType.EXTERNAL_DATASET)
+                DataSource ds = (DataSource) dataSourceScanOp.getDataSource();
+                if ((ds.getDatasourceType() == Type.INTERNAL_DATASET
+                        || ds.getDatasourceType() == Type.EXTERNAL_DATASET)
                         && ((DatasetDataSource) ds).getDataset().getDatasetName().compareTo(insertDatasetName) == 0) {
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java
index 815bd93..6ff8a56 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceRandomPartitioningFeedComputationRule.java
@@ -18,8 +18,7 @@
  */
 package org.apache.asterix.optimizer.rules;
 
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.metadata.declared.FeedDataSource;
 import org.apache.asterix.metadata.entities.Feed;
 import org.apache.commons.lang3.mutable.Mutable;
@@ -54,8 +53,8 @@ public class IntroduceRandomPartitioningFeedComputationRule implements IAlgebrai
         }
 
         DataSourceScanOperator scanOp = (DataSourceScanOperator) opChild;
-        AqlDataSource dataSource = (AqlDataSource) scanOp.getDataSource();
-        if (dataSource.getDatasourceType() != AqlDataSourceType.FEED) {
+        DataSource dataSource = (DataSource) scanOp.getDataSource();
+        if (dataSource.getDatasourceType() != DataSource.Type.FEED) {
             return false;
         }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index 8362dd7..b1b80e5 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -29,9 +29,9 @@ 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.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlIndex;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSourceIndex;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
@@ -141,8 +141,8 @@ public class IntroduceSecondaryIndexInsertDeleteRule implements IAlgebraicRewrit
          * The current primaryIndexModificationOp is of the first type
          */
 
-        AqlDataSource datasetSource = (AqlDataSource) primaryIndexModificationOp.getDataSource();
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
+        DataSource datasetSource = (DataSource) primaryIndexModificationOp.getDataSource();
+        MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
         String dataverseName = datasetSource.getId().getDataverseName();
         String datasetName = datasetSource.getId().getDatasourceName();
         Dataset dataset = mp.findDataset(dataverseName, datasetName);
@@ -290,7 +290,7 @@ public class IntroduceSecondaryIndexInsertDeleteRule implements IAlgebraicRewrit
                         .getOperation() == Kind.UPSERT) ? null
                                 : createFilterExpression(secondaryKeyVars, context.getOutputTypeEnvironment(currentTop),
                                         index.isEnforcingKeyFileds());
-                AqlIndex dataSourceIndex = new AqlIndex(index, dataverseName, datasetName, mp);
+                DataSourceIndex dataSourceIndex = new DataSourceIndex(index, dataverseName, datasetName, mp);
 
                 // Introduce the TokenizeOperator only when doing bulk-load,
                 // and index type is keyword or n-gram.
@@ -448,7 +448,7 @@ public class IntroduceSecondaryIndexInsertDeleteRule implements IAlgebraicRewrit
                     filterExpression = createFilterExpression(keyVarList,
                             context.getOutputTypeEnvironment(assignCoordinates), forceFilter);
                 }
-                AqlIndex dataSourceIndex = new AqlIndex(index, dataverseName, datasetName, mp);
+                DataSourceIndex dataSourceIndex = new DataSourceIndex(index, dataverseName, datasetName, mp);
                 indexUpdate = new IndexInsertDeleteUpsertOperator(dataSourceIndex,
                         primaryIndexModificationOp.getPrimaryKeyExpressions(), secondaryExpressions, filterExpression,
                         primaryIndexModificationOp.getOperation(), primaryIndexModificationOp.isBulkload(),

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceStaticTypeCastForInsertRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceStaticTypeCastForInsertRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceStaticTypeCastForInsertRule.java
index 2eaad98..ad93800 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceStaticTypeCastForInsertRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceStaticTypeCastForInsertRule.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.algebra.operators.CommitOperator;
-import org.apache.asterix.metadata.declared.AqlDataSource;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.optimizer.rules.typecast.StaticTypeCastUtil;
@@ -111,7 +111,7 @@ public class IntroduceStaticTypeCastForInsertRule implements IAlgebraicRewriteRu
          * get required record type
          */
         InsertDeleteUpsertOperator insertDeleteOperator = (InsertDeleteUpsertOperator) op2;
-        AqlDataSource dataSource = (AqlDataSource) insertDeleteOperator.getDataSource();
+        DataSource dataSource = (DataSource) insertDeleteOperator.getDataSource();
         IAType requiredRecordType = dataSource.getItemType();
 
         List<LogicalVariable> usedVariables = new ArrayList<LogicalVariable>();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
index 4fd8d75..a8e0d1c 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/MetaFunctionToMetaVariableRule.java
@@ -22,8 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.metadata.declared.IMutationDataSource;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -79,16 +78,16 @@ public class MetaFunctionToMetaVariableRule implements IAlgebraicRewriteRule {
         if (op.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
             DataSourceScanOperator scanOp = (DataSourceScanOperator) op;
             ILogicalExpressionReferenceTransformWithCondition inputTransfomer = visit(op.getInputs().get(0));
-            AqlDataSource dataSource = (AqlDataSource) scanOp.getDataSource();
+            DataSource dataSource = (DataSource) scanOp.getDataSource();
             List<ILogicalExpressionReferenceTransformWithCondition> transformers = null;
             List<LogicalVariable> allVars = scanOp.getVariables();
             LogicalVariable dataVar = dataSource.getDataRecordVariable(allVars);
             LogicalVariable metaVar = dataSource.getMetaVariable(allVars);
             LogicalExpressionReferenceTransform currentTransformer = null;
             // https://issues.apache.org/jira/browse/ASTERIXDB-1618
-            if (dataSource.getDatasourceType() != AqlDataSourceType.EXTERNAL_DATASET
-                    && dataSource.getDatasourceType() != AqlDataSourceType.INTERNAL_DATASET
-                    && dataSource.getDatasourceType() != AqlDataSourceType.LOADABLE) {
+            if (dataSource.getDatasourceType() != DataSource.Type.EXTERNAL_DATASET
+                    && dataSource.getDatasourceType() != DataSource.Type.INTERNAL_DATASET
+                    && dataSource.getDatasourceType() != DataSource.Type.LOADABLE) {
                 IMutationDataSource mds = (IMutationDataSource) dataSource;
                 if (mds.isChange()) {
                     transformers = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushFieldAccessRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushFieldAccessRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushFieldAccessRule.java
index 7af3c1a..e68ad02 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushFieldAccessRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushFieldAccessRule.java
@@ -25,10 +25,9 @@ import java.util.List;
 
 import org.apache.asterix.algebra.base.AsterixOperatorAnnotations;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.utils.DatasetUtils;
@@ -122,8 +121,8 @@ public class PushFieldAccessRule implements IAlgebraicRewriteRule {
         if (recVar != var) {
             return false;
         }
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-        AqlSourceId asid = ((IDataSource<AqlSourceId>) scan.getDataSource()).getId();
+        MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
+        DataSourceId asid = ((IDataSource<DataSourceId>) scan.getDataSource()).getId();
 
         Dataset dataset = mp.findDataset(asid.getDataverseName(), asid.getDatasourceName());
         if (dataset == null) {
@@ -297,13 +296,13 @@ public class PushFieldAccessRule implements IAlgebraicRewriteRule {
                     if (varRef.getVariableReference() == scanRecordVar) {
                         ILogicalExpression e1 = accessFun.getArguments().get(1).getValue();
                         if (e1.getExpressionTag() == LogicalExpressionTag.CONSTANT) {
-                            IDataSource<AqlSourceId> dataSource = (IDataSource<AqlSourceId>) scan.getDataSource();
-                            byte dsType = ((AqlDataSource) dataSource).getDatasourceType();
-                            if (dsType == AqlDataSourceType.FEED || dsType == AqlDataSourceType.LOADABLE) {
+                            IDataSource<DataSourceId> dataSource = (IDataSource<DataSourceId>) scan.getDataSource();
+                            byte dsType = ((DataSource) dataSource).getDatasourceType();
+                            if (dsType == DataSource.Type.FEED || dsType == DataSource.Type.LOADABLE) {
                                 return false;
                             }
-                            AqlSourceId asid = dataSource.getId();
-                            AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
+                            DataSourceId asid = dataSource.getId();
+                            MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
                             Dataset dataset = mp.findDataset(asid.getDataverseName(), asid.getDatasourceName());
                             if (dataset == null) {
                                 throw new AlgebricksException("Dataset " + asid.getDatasourceName() + " not found.");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveSortInFeedIngestionRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveSortInFeedIngestionRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveSortInFeedIngestionRule.java
index 25dcf35..e95fc3e 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveSortInFeedIngestionRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveSortInFeedIngestionRule.java
@@ -18,8 +18,7 @@
  */
 package org.apache.asterix.optimizer.rules;
 
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
@@ -50,8 +49,8 @@ public class RemoveSortInFeedIngestionRule implements IAlgebraicRewriteRule {
         boolean isSourceAFeed = false;
         while (descendantOp != null) {
             if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
-                AqlDataSource dataSource = (AqlDataSource) ((DataSourceScanOperator) descendantOp).getDataSource();
-                if (dataSource.getDatasourceType() == AqlDataSourceType.FEED) {
+                DataSource dataSource = (DataSource) ((DataSourceScanOperator) descendantOp).getDataSource();
+                if (dataSource.getDatasourceType() == DataSource.Type.FEED) {
                     isSourceAFeed = true;
                 }
                 break;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
index 2cce9b0..79133bf 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ResolveVariableRule.java
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -168,7 +168,7 @@ public class ResolveVariableRule implements IAlgebraicRewriteRule {
         } else if (numVarCandidates == 1) {
             resolveAsFieldAccess(funcRef, varAccessCandidates.iterator().next());
         } else {
-            AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+            MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
             // Cannot find any resolution.
             throw new AlgebricksException("Cannot find dataset " + unresolvedVarName + " in dataverse "
                     + metadataProvider.getDefaultDataverseName() + " nor an alias with name " + unresolvedVarName);
@@ -282,14 +282,14 @@ public class ResolveVariableRule implements IAlgebraicRewriteRule {
     // Checks whether the dataverse name and dataset name matche a dataset.
     private boolean hasMatchedDataverseDataset(String dataverseName, String datasetName, IOptimizationContext context)
             throws AlgebricksException {
-        AqlMetadataProvider mdp = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider mdp = (MetadataProvider) context.getMetadataProvider();
         return mdp.findDataset(dataverseName, datasetName) != null;
     }
 
     // Checks whether the name matches a dataset.
     private boolean hasMatchedDatasetForVariableName(String varName, IOptimizationContext context)
             throws AlgebricksException {
-        AqlMetadataProvider mdp = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider mdp = (MetadataProvider) context.getMetadataProvider();
         if (mdp.findDataset(mdp.getDefaultDataverseName(), varName) != null) {
             return true;
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
index 473a2a5..d3ca7b0 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetAsterixPhysicalOperatorsRule.java
@@ -25,8 +25,8 @@ import org.apache.asterix.algebra.operators.physical.BTreeSearchPOperator;
 import org.apache.asterix.algebra.operators.physical.InvertedIndexPOperator;
 import org.apache.asterix.algebra.operators.physical.RTreeSearchPOperator;
 import org.apache.asterix.common.config.DatasetConfig.IndexType;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.optimizer.rules.am.AccessMethodJobGenParams;
@@ -227,12 +227,12 @@ public class SetAsterixPhysicalOperatorsRule implements IAlgebraicRewriteRule {
                         }
                         AccessMethodJobGenParams jobGenParams = new AccessMethodJobGenParams();
                         jobGenParams.readFromFuncArgs(f.getArguments());
-                        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-                        AqlSourceId dataSourceId = new AqlSourceId(jobGenParams.getDataverseName(),
+                        MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
+                        DataSourceId dataSourceId = new DataSourceId(jobGenParams.getDataverseName(),
                                 jobGenParams.getDatasetName());
                         Dataset dataset = mp.findDataset(jobGenParams.getDataverseName(),
                                 jobGenParams.getDatasetName());
-                        IDataSourceIndex<String, AqlSourceId> dsi = mp.findDataSourceIndex(jobGenParams.getIndexName(),
+                        IDataSourceIndex<String, DataSourceId> dsi = mp.findDataSourceIndex(jobGenParams.getIndexName(),
                                 dataSourceId);
                         INodeDomain storageDomain = mp.findNodeDomain(dataset.getNodeGroupName());
                         if (dsi == null) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetupCommitExtensionOpRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetupCommitExtensionOpRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetupCommitExtensionOpRule.java
index 4bbfce0..d6f9c15 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetupCommitExtensionOpRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/SetupCommitExtensionOpRule.java
@@ -25,8 +25,8 @@ import org.apache.asterix.algebra.operators.CommitOperator;
 import org.apache.asterix.algebra.operators.physical.CommitPOperator;
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
@@ -146,7 +146,7 @@ public class SetupCommitExtensionOpRule implements IAlgebraicRewriteRule {
         }
 
         //get JobId(TransactorId)
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider mp = (MetadataProvider) context.getMetadataProvider();
         JobId jobId = mp.getJobId();
 
         //create the logical and physical operator

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/UnnestToDataScanRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/UnnestToDataScanRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/UnnestToDataScanRule.java
index 3503f56..496a64f 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/UnnestToDataScanRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/UnnestToDataScanRule.java
@@ -26,10 +26,10 @@ import org.apache.asterix.external.feed.watch.FeedActivityDetails;
 import org.apache.asterix.external.util.ExternalDataUtils;
 import org.apache.asterix.external.util.FeedUtils;
 import org.apache.asterix.external.util.FeedUtils.FeedRuntimeType;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSource;
+import org.apache.asterix.metadata.declared.DataSourceId;
 import org.apache.asterix.metadata.declared.FeedDataSource;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Dataverse;
 import org.apache.asterix.metadata.entities.Feed;
@@ -111,7 +111,7 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
                 return false;
             }
             String datasetArg = ((AString) acv2.getObject()).getStringValue();
-            AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+            MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
             Pair<String, String> datasetReference = parseDatasetReference(metadataProvider, datasetArg);
             String dataverseName = datasetReference.first;
             String datasetName = datasetReference.second;
@@ -120,7 +120,7 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
                 throw new AlgebricksException(
                         "Could not find dataset " + datasetName + " in dataverse " + dataverseName);
             }
-            AqlSourceId asid = new AqlSourceId(dataverseName, datasetName);
+            DataSourceId asid = new DataSourceId(dataverseName, datasetName);
             List<LogicalVariable> variables = new ArrayList<>();
             if (dataset.getDatasetType() == DatasetType.INTERNAL) {
                 int numPrimaryKeys = DatasetUtils.getPartitioningKeys(dataset).size();
@@ -129,7 +129,7 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
                 }
             }
             variables.add(unnest.getVariable());
-            AqlDataSource dataSource = metadataProvider.findDataSource(asid);
+            DataSource dataSource = metadataProvider.findDataSource(asid);
             boolean hasMeta = dataSource.hasMeta();
             if (hasMeta) {
                 variables.add(context.newVar());
@@ -159,8 +159,8 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
             String subscriptionLocation = ConstantExpressionUtil.getStringArgument(f, 3);
             String targetDataset = ConstantExpressionUtil.getStringArgument(f, 4);
             String outputType = ConstantExpressionUtil.getStringArgument(f, 5);
-            AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
-            AqlSourceId asid = new AqlSourceId(dataverse, getTargetFeed);
+            MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
+            DataSourceId asid = new DataSourceId(dataverse, getTargetFeed);
             String policyName = metadataProvider.getConfig().get(FeedActivityDetails.FEED_POLICY_NAME);
             FeedPolicyEntity policy = metadataProvider.findFeedPolicy(dataverse, policyName);
             if (policy == null) {
@@ -194,7 +194,7 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
         return false;
     }
 
-    private void addPrimaryKey(List<LogicalVariable> scanVariables, AqlDataSource dataSource,
+    private void addPrimaryKey(List<LogicalVariable> scanVariables, DataSource dataSource,
             IOptimizationContext context) {
         List<LogicalVariable> primaryKey = dataSource.getPrimaryKeyVariables(scanVariables);
         List<LogicalVariable> tail = new ArrayList<LogicalVariable>();
@@ -203,8 +203,8 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
         context.addPrimaryKey(pk);
     }
 
-    private FeedDataSource createFeedDataSource(AqlSourceId aqlId, String targetDataset, String sourceFeedName,
-            String subscriptionLocation, AqlMetadataProvider metadataProvider, FeedPolicyEntity feedPolicy,
+    private FeedDataSource createFeedDataSource(DataSourceId aqlId, String targetDataset, String sourceFeedName,
+            String subscriptionLocation, MetadataProvider metadataProvider, FeedPolicyEntity feedPolicy,
             String outputType, String locations, LogicalVariable recordVar, IOptimizationContext context,
             List<LogicalVariable> pkVars) throws AlgebricksException {
         if (!aqlId.getDataverseName().equals(metadataProvider.getDefaultDataverse() == null ? null
@@ -266,7 +266,7 @@ public class UnnestToDataScanRule implements IAlgebraicRewriteRule {
         return feedDataSource;
     }
 
-    private Pair<String, String> parseDatasetReference(AqlMetadataProvider metadataProvider, String datasetArg)
+    private Pair<String, String> parseDatasetReference(MetadataProvider metadataProvider, String datasetArg)
             throws AlgebricksException {
         String[] datasetNameComponents = datasetArg.split("\\.");
         String dataverseName;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
index 8e78d1a..3c79009 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java
@@ -26,9 +26,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.asterix.common.config.DatasetConfig.IndexType;
-import org.apache.asterix.dataflow.data.common.AqlExpressionTypeComputer;
+import org.apache.asterix.dataflow.data.common.ExpressionTypeComputer;
 import org.apache.asterix.metadata.api.IMetadataEntity;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.utils.DatasetUtils;
 import org.apache.asterix.om.base.AOrderedList;
@@ -70,7 +70,7 @@ import com.google.common.collect.ImmutableSet;
  */
 public abstract class AbstractIntroduceAccessMethodRule implements IAlgebraicRewriteRule {
 
-    private AqlMetadataProvider metadataProvider;
+    private MetadataProvider metadataProvider;
 
     // Function Identifier sets that retain the original field variable through each function's arguments
     private final ImmutableSet<FunctionIdentifier> funcIDSetThatRetainFieldName = ImmutableSet.of(
@@ -104,7 +104,7 @@ public abstract class AbstractIntroduceAccessMethodRule implements IAlgebraicRew
     }
 
     protected void setMetadataDeclarations(IOptimizationContext context) {
-        metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        metadataProvider = (MetadataProvider) context.getMetadataProvider();
     }
 
     protected void fillSubTreeIndexExprs(OptimizableOperatorSubTree subTree,
@@ -246,13 +246,13 @@ public abstract class AbstractIntroduceAccessMethodRule implements IAlgebraicRew
                     }
 
                     if (matchedTypes.size() < 2 && optFuncExpr.getNumLogicalVars() == 1) {
-                        matchedTypes.add((IAType) AqlExpressionTypeComputer.INSTANCE.getType(
+                        matchedTypes.add((IAType) ExpressionTypeComputer.INSTANCE.getType(
                                 optFuncExpr.getConstantAtRuntimeExpr(0), context.getMetadataProvider(),
                                 typeEnvironment));
                     }
 
                     //infer type of logicalExpr based on index keyType
-                    matchedTypes.add((IAType) AqlExpressionTypeComputer.INSTANCE.getType(
+                    matchedTypes.add((IAType) ExpressionTypeComputer.INSTANCE.getType(
                             optFuncExpr.getLogicalExpr(exprAndVarIdx.second), null, new IVariableTypeEnvironment() {
 
                                 @Override
@@ -280,7 +280,7 @@ public abstract class AbstractIntroduceAccessMethodRule implements IAlgebraicRew
 
                                 @Override
                                 public Object getType(ILogicalExpression expr) throws AlgebricksException {
-                                    return AqlExpressionTypeComputer.INSTANCE.getType(expr, null, this);
+                                    return ExpressionTypeComputer.INSTANCE.getType(expr, null, this);
                                 }
 
                                 @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
index 5b7146f..2d46a0b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
@@ -30,7 +30,7 @@ import org.apache.asterix.common.config.DatasetConfig.IndexType;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.external.indexing.IndexingConstants;
 import org.apache.asterix.lang.common.util.FunctionUtil;
-import org.apache.asterix.metadata.declared.AqlSourceId;
+import org.apache.asterix.metadata.declared.DataSourceId;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.ExternalDatasetDetails;
 import org.apache.asterix.metadata.entities.Index;
@@ -639,7 +639,7 @@ public class AccessMethodUtils {
         unnestOp.setExecutionMode(ExecutionMode.PARTITIONED);
 
         //set the physical operator
-        AqlSourceId dataSourceId = new AqlSourceId(dataset.getDataverseName(), dataset.getDatasetName());
+        DataSourceId dataSourceId = new DataSourceId(dataset.getDataverseName(), dataset.getDatasetName());
         unnestOp.setPhysicalOperator(new ExternalDataLookupPOperator(dataSourceId, dataset, recordType, secondaryIndex,
                 primaryKeyVars, false, retainInput, retainNull));
         return unnestOp;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
index ff4d219..73bbbfc 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceJoinAccessMethodRule.java
@@ -23,7 +23,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -120,7 +120,7 @@ public class IntroduceJoinAccessMethodRule extends AbstractIntroduceAccessMethod
         }
 
         // Set dataset and type metadata.
-        AqlMetadataProvider metadataProvider = (AqlMetadataProvider) context.getMetadataProvider();
+        MetadataProvider metadataProvider = (MetadataProvider) context.getMetadataProvider();
         boolean checkLeftSubTreeMetadata = false;
         boolean checkRightSubTreeMetadata = false;
         if (matchInLeftSubTree) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
index 9b568b9..02fb2a5 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceLSMComponentFilterRule.java
@@ -24,10 +24,9 @@ import java.util.List;
 import java.util.Queue;
 
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
-import org.apache.asterix.metadata.declared.AqlDataSource;
-import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.utils.DatasetUtils;
@@ -93,7 +92,7 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
         ARecordType recType = null;
         if (dataset != null && dataset.getDatasetType() == DatasetType.INTERNAL) {
             filterFieldName = DatasetUtils.getFilterField(dataset);
-            IAType itemType = ((AqlMetadataProvider) context.getMetadataProvider())
+            IAType itemType = ((MetadataProvider) context.getMetadataProvider())
                     .findType(dataset.getItemTypeDataverseName(), dataset.getItemTypeName());
             if (itemType.getTypeTag() == ATypeTag.RECORD) {
                 recType = (ARecordType) itemType;
@@ -102,7 +101,7 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
         if (filterFieldName == null || recType == null) {
             return false;
         }
-        List<Index> datasetIndexes = ((AqlMetadataProvider) context.getMetadataProvider())
+        List<Index> datasetIndexes = ((MetadataProvider) context.getMetadataProvider())
                 .getDatasetIndexes(dataset.getDataverseName(), dataset.getDatasetName());
 
         List<IOptimizableFuncExpr> optFuncExprs = new ArrayList<>();
@@ -159,7 +158,7 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
             }
             if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
                 DataSourceScanOperator dataSourceScanOp = (DataSourceScanOperator) descendantOp;
-                AqlDataSource ds = (AqlDataSource) dataSourceScanOp.getDataSource();
+                DataSource ds = (DataSource) dataSourceScanOp.getDataSource();
                 if (dataset.getDatasetName().compareTo(((DatasetDataSource) ds).getDataset().getDatasetName()) == 0) {
                     List<LogicalVariable> minFilterVars = new ArrayList<>();
                     List<LogicalVariable> maxFilterVars = new ArrayList<>();
@@ -223,8 +222,8 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
         while (descendantOp != null) {
             if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN) {
                 DataSourceScanOperator dataSourceScanOp = (DataSourceScanOperator) descendantOp;
-                AqlDataSource ds = (AqlDataSource) dataSourceScanOp.getDataSource();
-                if (ds.getDatasourceType() != AqlDataSourceType.INTERNAL_DATASET) {
+                DataSource ds = (DataSource) dataSourceScanOp.getDataSource();
+                if (ds.getDatasourceType() != DataSource.Type.INTERNAL_DATASET) {
                     return null;
                 }
                 return ((DatasetDataSource) ds).getDataset();
@@ -247,7 +246,7 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
                     } else {
                         throw new AlgebricksException("Unexpected function for Unnest Map: " + fid);
                     }
-                    return ((AqlMetadataProvider) context.getMetadataProvider()).findDataset(dataverseName,
+                    return ((MetadataProvider) context.getMetadataProvider()).findDataset(dataverseName,
                             datasetName);
                 }
             }
@@ -373,7 +372,7 @@ public class IntroduceLSMComponentFilterRule implements IAlgebraicRewriteRule {
                         }
                     }
 
-                    IAType metaItemType = ((AqlMetadataProvider) context.getMetadataProvider())
+                    IAType metaItemType = ((MetadataProvider) context.getMetadataProvider())
                             .findType(dataset.getMetaItemTypeDataverseName(), dataset.getMetaItemTypeName());
                     ARecordType metaRecType = (ARecordType) metaItemType;
                     int numSecondaryKeys = KeyFieldTypeUtils.getNumSecondaryKeys(index, recType, metaRecType);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/42600592/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
index 2464c06..434b961 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/IntroduceSelectAccessMethodRule.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.TreeMap;
 
-import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
@@ -111,7 +111,7 @@ public class IntroduceSelectAccessMethodRule extends AbstractIntroduceAccessMeth
         }
 
         // Set dataset and type metadata.
-        if (!subTree.setDatasetAndTypeMetadata((AqlMetadataProvider) context.getMetadataProvider())) {
+        if (!subTree.setDatasetAndTypeMetadata((MetadataProvider) context.getMetadataProvider())) {
             return false;
         }
 


Mime
View raw message