asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject incubator-asterixdb git commit: some cleanup
Date Tue, 12 Jan 2016 14:04:33 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master c614ce5cb -> 07c996279


some cleanup

- remove redundant code around DataSources
- fix typo in constant name

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


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

Branch: refs/heads/master
Commit: 07c99627917125a62aae8c79ddf6217987ed8d58
Parents: c614ce5
Author: Till Westmann <tillw@apache.org>
Authored: Mon Jan 11 13:56:10 2016 -0800
Committer: Till Westmann <tillw@apache.org>
Committed: Tue Jan 12 06:00:20 2016 -0800

----------------------------------------------------------------------
 .../IntroduceInstantLockSearchCallbackRule.java |  2 +-
 .../asterix/test/runtime/RepeatedTest.java      |  2 +-
 .../metadata/declared/AqlDataSource.java        | 28 ++++++-----------
 .../metadata/declared/DatasetDataSource.java    | 20 ++----------
 .../metadata/declared/FeedDataSource.java       | 14 ++-------
 .../metadata/declared/LoadableDataSource.java   | 32 +++-----------------
 .../testframework/context/TestCaseContext.java  |  2 +-
 7 files changed, 21 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
index 14f7cd8..54db5d3 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
@@ -85,7 +85,7 @@ public class IntroduceInstantLockSearchCallbackRule implements IAlgebraicRewrite
                 }
             } else if (descendantOp.getOperatorTag() == LogicalOperatorTag.DATASOURCESCAN)
{
                 DataSourceScanOperator dataSourceScanOp = (DataSourceScanOperator) descendantOp;
-                String datasourceName = ((AqlDataSource) dataSourceScanOp.getDataSource()).getDatasourceName();
+                String datasourceName = ((AqlDataSource) dataSourceScanOp.getDataSource()).getId().getDatasourceName();
                 if (dataSourcesMap.containsKey(datasourceName)) {
                     ++(dataSourcesMap.get(datasourceName).first);
                 } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
index 377dd69..860bac3 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
@@ -88,7 +88,7 @@ public class RepeatedTest extends ExecutionTest {
 
     @Parameters(name = "RepeatedTest {index}: {0}")
     public static Collection<Object[]> tests() throws Exception {
-        Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.DEFAULT_REPEADED_TESTSUITE_XML_NAME);
+        Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.DEFAULT_REPEATED_TESTSUITE_XML_NAME);
         return testArgs;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
index 26a5b94..5ad0c52 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
@@ -47,11 +47,11 @@ import org.apache.hyracks.algebricks.core.algebra.properties.UnorderedPartitione
 public abstract class AqlDataSource implements IDataSource<AqlSourceId> {
 
     private final AqlSourceId id;
-   private final IAType itemType;
+    private final IAType itemType;
     private final AqlDataSourceType datasourceType;
     protected IAType[] schemaTypes;
     protected INodeDomain domain;
-    private Map<String, Serializable> properties = new HashMap<String, Serializable>();
+    private Map<String, Serializable> properties = new HashMap<>();
 
     public enum AqlDataSourceType {
         INTERNAL_DATASET,
@@ -60,25 +60,16 @@ public abstract class AqlDataSource implements IDataSource<AqlSourceId>
{
         LOADABLE
     }
 
-    public AqlDataSource(AqlSourceId id, String datasourceDataverse, String datasourceName,
-            IAType itemType, AqlDataSourceType datasourceType) throws AlgebricksException
{
+    public AqlDataSource(AqlSourceId id, IAType itemType, AqlDataSourceType datasourceType)
throws AlgebricksException {
         this.id = id;
         this.itemType = itemType;
         this.datasourceType = datasourceType;
     }
 
-    public String getDatasourceDataverse() {
-        return id.getDataverseName();
-    }
-
-    public String getDatasourceName() {
-        return id.getDatasourceName();
-    }
-
     @Override
-    public abstract IAType[] getSchemaTypes();
-
-    public abstract INodeDomain getDomain();
+    public IAType[] getSchemaTypes() {
+        return schemaTypes;
+    }
 
     public void computeLocalStructuralProperties(List<ILocalStructuralProperty> localProps,
             List<LogicalVariable> variables) {
@@ -104,8 +95,8 @@ public abstract class AqlDataSource implements IDataSource<AqlSourceId>
{
     public void computeFDs(List<LogicalVariable> scanVariables, List<FunctionalDependency>
fdList) {
         int n = scanVariables.size();
         if (n > 1) {
-            List<LogicalVariable> head = new ArrayList<LogicalVariable>(scanVariables.subList(0,
n - 1));
-            List<LogicalVariable> tail = new ArrayList<LogicalVariable>(1);
+            List<LogicalVariable> head = new ArrayList<>(scanVariables.subList(0,
n - 1));
+            List<LogicalVariable> tail = new ArrayList<>(1);
             tail.addAll(scanVariables);
             FunctionalDependency fd = new FunctionalDependency(head, tail);
             fdList.add(fd);
@@ -198,10 +189,11 @@ public abstract class AqlDataSource implements IDataSource<AqlSourceId>
{
     public Map<String, Serializable> getProperties() {
         return properties;
     }
-    
+
     public IAType getItemType() {
         return itemType;
     }
+
     public void setProperties(Map<String, Serializable> properties) {
         this.properties = properties;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
index c0c91d9..3c76287 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
@@ -39,11 +39,11 @@ public class DatasetDataSource extends AqlDataSource {
 
     public DatasetDataSource(AqlSourceId id, String datasourceDataverse, String datasourceName,
IAType itemType,
             AqlDataSourceType datasourceType) throws AlgebricksException {
-        super(id, datasourceDataverse, datasourceName, itemType, datasourceType);
+        super(id, itemType, datasourceType);
         MetadataTransactionContext ctx = null;
         try {
             ctx = MetadataManager.INSTANCE.beginTransaction();
-            dataset = MetadataManager.INSTANCE.getDataset(ctx, datasourceDataverse, datasourceName);
+            dataset = MetadataManager.INSTANCE.getDataset(ctx, id.getDataverseName(), id.getDatasourceName());
             if (dataset == null) {
                 throw new AlgebricksException("Unknown dataset " + datasourceName + " in
dataverse "
                         + datasourceDataverse);
@@ -105,20 +105,4 @@ public class DatasetDataSource extends AqlDataSource {
         domain = domainForExternalData;
     }
 
-    @Override
-    public IAType[] getSchemaTypes() {
-        return schemaTypes;
-    }
-
-    @Override
-    public INodeDomain getDomain() {
-        return domain;
-    }
-
-    @Override
-    public void computeLocalStructuralProperties(List<ILocalStructuralProperty> localProps,
-            List<LogicalVariable> variables) {
-        // do nothing
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
index 0d173e8..2e603f1 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
@@ -41,8 +41,8 @@ public class FeedDataSource extends AqlDataSource {
 
     public FeedDataSource(AqlSourceId id, String targetDataset, IAType itemType, AqlDataSourceType
dataSourceType,
             FeedId sourceFeedId, FeedType sourceFeedType, ConnectionLocation location, String[]
locations)
-            throws AlgebricksException {
-        super(id, id.getDataverseName(), id.getDatasourceName(), itemType, dataSourceType);
+                    throws AlgebricksException {
+        super(id, itemType, dataSourceType);
         this.targetDataset = targetDataset;
         this.sourceFeedId = sourceFeedId;
         this.sourceFeedType = sourceFeedType;
@@ -75,16 +75,6 @@ public class FeedDataSource extends AqlDataSource {
         return feed;
     }
 
-    @Override
-    public IAType[] getSchemaTypes() {
-        return schemaTypes;
-    }
-
-    @Override
-    public INodeDomain getDomain() {
-        return domain;
-    }
-
     public String getTargetDataset() {
         return targetDataset;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
index d325918..74bd5e4 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
@@ -23,8 +23,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.lang.StringUtils;
-
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
@@ -32,6 +30,7 @@ import org.apache.asterix.metadata.utils.DatasetUtils;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.IAType;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import org.apache.hyracks.algebricks.core.algebra.properties.DefaultNodeGroupDomain;
@@ -41,27 +40,19 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class LoadableDataSource extends AqlDataSource {
 
-    private final INodeDomain domain;
-    private final IAType[] schemaTypes;
     private final Dataset targetDataset;
     private final List<List<String>> partitioningKeys;
     private final String adapter;
     private final Map<String, String> adapterProperties;
     private final boolean isPKAutoGenerated;
 
-    public boolean isPKAutoGenerated() {
-        return isPKAutoGenerated;
-    }
-
     public LoadableDataSource(Dataset targetDataset, IAType itemType, String adapter, Map<String,
String> properties)
             throws AlgebricksException, IOException {
-        super(new AqlSourceId("loadable_dv", "loadable_ds"), "loadable_dv", "loadable_source",
itemType,
-                AqlDataSourceType.LOADABLE);
+        super(new AqlSourceId("loadable_dv", "loadable_ds"), itemType, AqlDataSourceType.LOADABLE);
         this.targetDataset = targetDataset;
         this.adapter = adapter;
         this.adapterProperties = properties;
         partitioningKeys = DatasetUtils.getPartitioningKeys(targetDataset);
-        domain = new DefaultNodeGroupDomain(targetDataset.getNodeGroupName());
         ARecordType recType = (ARecordType) itemType;
         isPKAutoGenerated = ((InternalDatasetDetails) targetDataset.getDatasetDetails()).isAutogenerated();
         if (isPKAutoGenerated) {
@@ -76,8 +67,8 @@ public class LoadableDataSource extends AqlDataSource {
         schemaTypes = new IAType[] { recType };
     }
 
-    private ARecordType getStrippedPKType(List<String> partitioningKeys, ARecordType
recType) throws AsterixException,
-            HyracksDataException {
+    private ARecordType getStrippedPKType(List<String> partitioningKeys, ARecordType
recType)
+            throws AsterixException, HyracksDataException {
         List<String> fieldNames = new LinkedList<>();
         List<IAType> fieldTypes = new LinkedList<>();
         int j = 0;
@@ -105,21 +96,6 @@ public class LoadableDataSource extends AqlDataSource {
                 fieldTypes.toArray(new IAType[0]), recType.isOpen());
     }
 
-    @Override
-    public IAType[] getSchemaTypes() {
-        return schemaTypes;
-    }
-
-    @Override
-    public INodeDomain getDomain() {
-        return domain;
-    }
-
-    @Override
-    public void computeLocalStructuralProperties(List<ILocalStructuralProperty> localProps,
-            List<LogicalVariable> variables) {
-    }
-
     public List<List<String>> getPartitioningKeys() {
         return partitioningKeys;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/07c99627/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
----------------------------------------------------------------------
diff --git a/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
b/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
index e192806..8592286 100644
--- a/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
+++ b/asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
@@ -91,7 +91,7 @@ public class TestCaseContext {
 
     public static final String DEFAULT_TESTSUITE_XML_NAME = "testsuite.xml";
     public static final String ONLY_TESTSUITE_XML_NAME = "only.xml";
-    public static final String DEFAULT_REPEADED_TESTSUITE_XML_NAME = "repeatedtestsuite.xml";
+    public static final String DEFAULT_REPEATED_TESTSUITE_XML_NAME = "repeatedtestsuite.xml";
 
     private File tsRoot;
 


Mime
View raw message