asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Westmann (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: cleanup
Date Mon, 11 Jan 2016 21:52:52 GMT
Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/583

Change subject: cleanup
......................................................................

cleanup

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

Change-Id: I48602e1acbbc22642d4467ab37f27f337de20c5e
---
M asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceInstantLockSearchCallbackRule.java
M asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
M asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlDataSource.java
M asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/DatasetDataSource.java
M asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
M asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/LoadableDataSource.java
M asterix-test-framework/src/main/java/org/apache/asterix/testframework/context/TestCaseContext.java
7 files changed, 21 insertions(+), 79 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/83/583/1

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 @@
                 }
             } 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 {
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 @@
 
     @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;
     }
 
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 @@
 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 @@
         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 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 Map<String, Serializable> getProperties() {
         return properties;
     }
-    
+
     public IAType getItemType() {
         return itemType;
     }
+
     public void setProperties(Map<String, Serializable> properties) {
         this.properties = properties;
     }
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 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);
@@ -103,22 +103,6 @@
             }
         };
         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
     }
 
 }
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 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;
@@ -73,16 +73,6 @@
 
     public Feed getFeed() {
         return feed;
-    }
-
-    @Override
-    public IAType[] getSchemaTypes() {
-        return schemaTypes;
-    }
-
-    @Override
-    public INodeDomain getDomain() {
-        return domain;
     }
 
     public String getTargetDataset() {
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.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.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 @@
 
 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 @@
         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;
@@ -103,21 +94,6 @@
         }
         return new ARecordType(recType.getTypeName(), fieldNames.toArray(new String[0]),
                 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() {
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 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;
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/583
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48602e1acbbc22642d4467ab37f27f337de20c5e
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <tillw@apache.org>

Mime
View raw message