asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AsterixDB Code Review <do-not-re...@asterix-gerrit.ics.uci.edu>
Subject Change in asterixdb[master]: [NO ISSUE] Remove unused code from asterix-algebra
Date Tue, 15 Jun 2021 20:12:39 GMT
>From Cameron Samak <csamak@apache.org>:

Cameron Samak has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/11964
)


Change subject: [NO ISSUE] Remove unused code from asterix-algebra
......................................................................

[NO ISSUE] Remove unused code from asterix-algebra

- user model changes: no
- storage format changes: no
- interface changes: yes

Change-Id: Idca8535331a9c15df0ccd73ae340f86b96424ee4
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/base/FuzzyUtils.java
D asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldIndexAndTypeHandle.java
D asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldNameHandle.java
D asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/IHandle.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
7 files changed, 5 insertions(+), 425 deletions(-)



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

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 1e64c91..036e5f4 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
@@ -26,9 +26,7 @@
 import org.apache.asterix.om.base.AInt32;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.types.ATypeTag;
 import org.apache.commons.lang3.mutable.Mutable;
-import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
@@ -46,20 +44,6 @@
     public final static String JACCARD_FUNCTION_NAME = "jaccard";
     public final static String EDIT_DISTANCE_FUNCTION_NAME = "edit-distance";
 
-    public static FunctionIdentifier getTokenizer(ATypeTag inputTag) {
-        switch (inputTag) {
-            case STRING:
-                return BuiltinFunctions.COUNTHASHED_WORD_TOKENS;
-            case MULTISET:
-            case ARRAY:
-            case UNION:
-            case ANY:
-                return null;
-            default:
-                throw new NotImplementedException("No tokenizer for type " + inputTag);
-        }
-    }
-
     public static IAObject getSimThreshold(MetadataProvider metadata, String simFuncName)
{
         String simThresholValue = metadata.getProperty(SIM_THRESHOLD_PROP_NAME);
         IAObject ret = null;
@@ -102,15 +86,6 @@
         return null;
     }
 
-    public static float getSimThreshold(MetadataProvider metadata) {
-        float simThreshold = JACCARD_DEFAULT_SIM_THRESHOLD;
-        String simThresholValue = metadata.getProperty(SIM_THRESHOLD_PROP_NAME);
-        if (simThresholValue != null) {
-            simThreshold = Float.parseFloat(simThresholValue);
-        }
-        return simThreshold;
-    }
-
     // TODO: The default function depend on the input types.
     public static String getSimFunction(MetadataProvider metadata) {
         String simFunction = metadata.getProperty(SIM_FUNCTION_PROP_NAME);
@@ -120,15 +95,4 @@
         simFunction = simFunction.toLowerCase();
         return simFunction;
     }
-
-    public static String getSimFunction(FunctionIdentifier simFuncId) {
-        if (simFuncId.equals(BuiltinFunctions.SIMILARITY_JACCARD)
-                || simFuncId.equals(BuiltinFunctions.SIMILARITY_JACCARD_CHECK)) {
-            return JACCARD_FUNCTION_NAME;
-        } else if (simFuncId.equals(BuiltinFunctions.EDIT_DISTANCE)
-                || simFuncId.equals(BuiltinFunctions.EDIT_DISTANCE_CHECK)) {
-            return EDIT_DISTANCE_FUNCTION_NAME;
-        }
-        return null;
-    }
 }
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldIndexAndTypeHandle.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldIndexAndTypeHandle.java
deleted file mode 100644
index 7601675..0000000
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldIndexAndTypeHandle.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.optimizer.handle;
-
-import org.apache.asterix.om.types.IAType;
-
-public class FieldIndexAndTypeHandle implements IHandle {
-
-    private int fieldIndex;
-    private IAType fieldType;
-
-    public FieldIndexAndTypeHandle(int fieldIndex, IAType fieldType) {
-        this.fieldIndex = fieldIndex;
-        this.fieldType = fieldType;
-    }
-
-    @Override
-    public HandleType getHandleType() {
-        return HandleType.FIELD_INDEX_AND_TYPE;
-    }
-
-    public int getFieldIndex() {
-        return fieldIndex;
-    }
-
-    public IAType getFieldType() {
-        return fieldType;
-    }
-}
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldNameHandle.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldNameHandle.java
deleted file mode 100644
index 889e65b..0000000
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/FieldNameHandle.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.optimizer.handle;
-
-import org.apache.asterix.om.types.IAType;
-
-public class FieldNameHandle implements IHandle {
-
-    private String fieldName;
-    private IAType fieldType;
-
-    public FieldNameHandle(String fieldName) {
-        this.fieldName = fieldName;
-    }
-
-    public IAType getFieldType() {
-        return fieldType;
-    }
-
-    public void setFieldType(IAType fieldType) {
-        this.fieldType = fieldType;
-    }
-
-    @Override
-    public HandleType getHandleType() {
-        return HandleType.FIELD_NAME;
-    }
-
-    public String getFieldName() {
-        return fieldName;
-    }
-}
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/IHandle.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/IHandle.java
deleted file mode 100644
index 43b321f..0000000
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/handle/IHandle.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.optimizer.handle;
-
-/**
- * A handle is a way of accessing an ADM instance or a collection of ADM
- * instances nested within another ADM instance.
- *
- * @author Nicola
- */
-
-public interface IHandle {
-    public enum HandleType {
-        FIELD_INDEX_AND_TYPE,
-        FIELD_NAME
-    }
-
-    public HandleType getHandleType();
-}
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
index e85fec8..d28a6d0 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/CompiledStatements.java
@@ -21,18 +21,15 @@
 import java.util.Map;
 
 import org.apache.asterix.common.metadata.DataverseName;
-import org.apache.asterix.external.feed.management.FeedConnectionRequest;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.lang.common.expression.VariableExpr;
 import org.apache.asterix.lang.common.statement.Query;
-import org.apache.asterix.metadata.entities.Dataset;
-import org.apache.asterix.metadata.entities.Index;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.exceptions.SourceLocation;
 
 /**
- * An AQL statement instance is translated into an instance of type CompileX
+ * A statement instance that is translated into an instance of type CompileX
  * that has additional fields for use by the AqlTranslator.
  */
 public class CompiledStatements {
@@ -55,139 +52,6 @@
         }
     }
 
-    public static class CompiledDatasetDropStatement extends AbstractCompiledStatement {
-        private final String dataverseName;
-        private final String datasetName;
-
-        public CompiledDatasetDropStatement(String dataverseName, String datasetName) {
-            this.dataverseName = dataverseName;
-            this.datasetName = datasetName;
-        }
-
-        public String getDataverseName() {
-            return dataverseName;
-        }
-
-        public String getDatasetName() {
-            return datasetName;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.DATASET_DROP;
-        }
-    }
-
-    // added by yasser
-    public static class CompiledCreateDataverseStatement extends AbstractCompiledStatement
{
-        private final String dataverseName;
-        private final String format;
-
-        public CompiledCreateDataverseStatement(String dataverseName, String format) {
-            this.dataverseName = dataverseName;
-            this.format = format;
-        }
-
-        public String getDataverseName() {
-            return dataverseName;
-        }
-
-        public String getFormat() {
-            return format;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.CREATE_DATAVERSE;
-        }
-    }
-
-    public static class CompiledNodeGroupDropStatement extends AbstractCompiledStatement
{
-        private final String nodeGroupName;
-
-        public CompiledNodeGroupDropStatement(String nodeGroupName) {
-            this.nodeGroupName = nodeGroupName;
-        }
-
-        public String getNodeGroupName() {
-            return nodeGroupName;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.NODEGROUP_DROP;
-        }
-    }
-
-    public static class CompiledIndexDropStatement extends AbstractCompiledStatement {
-        private final String dataverseName;
-        private final String datasetName;
-        private final String indexName;
-
-        public CompiledIndexDropStatement(String dataverseName, String datasetName, String
indexName) {
-            this.dataverseName = dataverseName;
-            this.datasetName = datasetName;
-            this.indexName = indexName;
-        }
-
-        public String getDataverseName() {
-            return dataverseName;
-        }
-
-        public String getDatasetName() {
-            return datasetName;
-        }
-
-        public String getIndexName() {
-            return indexName;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.INDEX_DROP;
-        }
-    }
-
-    public static class CompiledDataverseDropStatement extends AbstractCompiledStatement
{
-        private final String dataverseName;
-        private final boolean ifExists;
-
-        public CompiledDataverseDropStatement(String dataverseName, boolean ifExists) {
-            this.dataverseName = dataverseName;
-            this.ifExists = ifExists;
-        }
-
-        public String getDataverseName() {
-            return dataverseName;
-        }
-
-        public boolean getIfExists() {
-            return ifExists;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.DATAVERSE_DROP;
-        }
-    }
-
-    public static class CompiledTypeDropStatement extends AbstractCompiledStatement {
-        private final String typeName;
-
-        public CompiledTypeDropStatement(String nodeGroupName) {
-            this.typeName = nodeGroupName;
-        }
-
-        public String getTypeName() {
-            return typeName;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.TYPE_DROP;
-        }
-    }
-
     public interface ICompiledDmlStatement extends ICompiledStatement {
 
         DataverseName getDataverseName();
@@ -195,40 +59,6 @@
         String getDatasetName();
     }
 
-    public static class CompiledCreateIndexStatement extends AbstractCompiledStatement
-            implements ICompiledDmlStatement {
-        private final Dataset dataset;
-        private final Index index;
-
-        public CompiledCreateIndexStatement(Dataset dataset, Index index) {
-            this.dataset = dataset;
-            this.index = index;
-        }
-
-        @Override
-        public String getDatasetName() {
-            return index.getDatasetName();
-        }
-
-        @Override
-        public DataverseName getDataverseName() {
-            return index.getDataverseName();
-        }
-
-        public Index getIndex() {
-            return index;
-        }
-
-        public Dataset getDataset() {
-            return dataset;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.CREATE_INDEX;
-        }
-    }
-
     public static class CompiledLoadFromFileStatement extends AbstractCompiledStatement
             implements ICompiledDmlStatement {
         private final DataverseName dataverseName;
@@ -337,41 +167,6 @@
         }
     }
 
-    public static class CompiledSubscribeFeedStatement extends AbstractCompiledStatement
-            implements ICompiledDmlStatement {
-
-        private FeedConnectionRequest request;
-        private final int varCounter;
-
-        public CompiledSubscribeFeedStatement(FeedConnectionRequest request, int varCounter)
{
-            this.request = request;
-            this.varCounter = varCounter;
-        }
-
-        @Override
-        public DataverseName getDataverseName() {
-            return request.getReceivingFeedId().getDataverseName();
-        }
-
-        public String getFeedName() {
-            return request.getReceivingFeedId().getEntityName();
-        }
-
-        @Override
-        public String getDatasetName() {
-            return request.getTargetDataset();
-        }
-
-        public int getVarCounter() {
-            return varCounter;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.SUBSCRIBE_FEED;
-        }
-    }
-
     public static class CompiledDeleteStatement extends AbstractCompiledStatement implements
ICompiledDmlStatement {
         private final DataverseName dataverseName;
         private final String datasetName;
@@ -379,8 +174,8 @@
         private final int varCounter;
         private final Query query;
 
-        public CompiledDeleteStatement(VariableExpr var, DataverseName dataverseName, String
datasetName,
-                Expression condition, int varCounter, Query query) {
+        public CompiledDeleteStatement(DataverseName dataverseName, String datasetName, Expression
condition,
+                int varCounter, Query query) {
             this.dataverseName = dataverseName;
             this.datasetName = datasetName;
             this.condition = condition;
@@ -416,46 +211,4 @@
         }
 
     }
-
-    public static class CompiledCompactStatement extends AbstractCompiledStatement {
-        private final DataverseName dataverseName;
-        private final String datasetName;
-
-        public CompiledCompactStatement(DataverseName dataverseName, String datasetName)
{
-            this.dataverseName = dataverseName;
-            this.datasetName = datasetName;
-        }
-
-        public DataverseName getDataverseName() {
-            return dataverseName;
-        }
-
-        public String getDatasetName() {
-            return datasetName;
-        }
-
-        @Override
-        public Statement.Kind getKind() {
-            return Statement.Kind.COMPACT;
-        }
-    }
-
-    public static class CompiledIndexCompactStatement extends CompiledCompactStatement {
-        private Dataset dataset;
-        private Index index;
-
-        public CompiledIndexCompactStatement(Dataset dataset, Index index) {
-            super(dataset.getDataverseName(), dataset.getDatasetName());
-            this.dataset = dataset;
-            this.index = index;
-        }
-
-        public Dataset getDataset() {
-            return dataset;
-        }
-
-        public Index getIndex() {
-            return index;
-        }
-    }
 }
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
index 33653ad..f27a3af 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TranslationContext.java
@@ -36,7 +36,6 @@
     /** The stack is the used to manage the scope of variables for group-by rebindings. */
     private Deque<Map<Integer, LogicalVariable>> stack = new ArrayDeque<>();
     private Map<Integer, LogicalVariable> currentVarMap = new HashMap<>();
-    private boolean topFlwor = true;
 
     public TranslationContext(Counter varCounter) {
         this.varCounter = varCounter;
@@ -66,14 +65,6 @@
         varCounter.set(count);
     }
 
-    public boolean isTopFlwor() {
-        return topFlwor;
-    }
-
-    public void setTopFlwor(boolean b) {
-        topFlwor = b;
-    }
-
     public LogicalVariable getVar(Integer varId) {
         return currentVarMap.get(varId);
     }
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 1d1466c..268ce34 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -3283,8 +3283,8 @@
         lockUtil.insertDeleteUpsertBegin(lockManager, metadataProvider.getLocks(), dataverseName,
datasetName);
         try {
             metadataProvider.setWriteTransaction(true);
-            CompiledDeleteStatement clfrqs = new CompiledDeleteStatement(stmtDelete.getVariableExpr(),
dataverseName,
-                    datasetName, stmtDelete.getCondition(), stmtDelete.getVarCounter(), stmtDelete.getQuery());
+            CompiledDeleteStatement clfrqs = new CompiledDeleteStatement(dataverseName, datasetName,
+                    stmtDelete.getCondition(), stmtDelete.getVarCounter(), stmtDelete.getQuery());
             clfrqs.setSourceLocation(stmt.getSourceLocation());
             JobSpecification jobSpec = rewriteCompileQuery(hcc, metadataProvider, clfrqs.getQuery(),
clfrqs, stmtParams,
                     stmtRewriter, null);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/11964
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Idca8535331a9c15df0ccd73ae340f86b96424ee4
Gerrit-Change-Number: 11964
Gerrit-PatchSet: 1
Gerrit-Owner: Cameron Samak <csamak@apache.org>
Gerrit-MessageType: newchange

Mime
View raw message