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: remove AsterixRuntimeException
Date Wed, 18 May 2016 02:46:44 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 40d36c604 -> 6097a38e2


remove AsterixRuntimeException

Change-Id: Ica9d828bffceabe3b614f68886bc860e34f593b4
Reviewed-on: https://asterix-gerrit.ics.uci.edu/856
Tested-by: Michael Blow <michael.blow@couchbase.com>
Reviewed-by: Michael Blow <michael.blow@couchbase.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/6097a38e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/6097a38e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/6097a38e

Branch: refs/heads/master
Commit: 6097a38e26ea03538920b37926b1aaec8e85e8b8
Parents: 40d36c6
Author: Till Westmann <tillw@apache.org>
Authored: Tue May 17 15:28:19 2016 -0700
Committer: Till Westmann <tillw@apache.org>
Committed: Tue May 17 19:02:07 2016 -0700

----------------------------------------------------------------------
 .../optimizer/rules/LoadRecordFieldsRule.java   |  3 +-
 .../optimizer/rules/PushFieldAccessRule.java    |  3 +-
 .../exceptions/AsterixRuntimeException.java     | 37 --------------------
 .../fuzzyjoin/similarity/IListIterator.java     |  4 +--
 .../metadata/bootstrap/MetadataIndex.java       |  8 ++---
 .../common/AbstractAsterixListIterator.java     | 11 +++---
 .../common/EditDistanceContainsEvaluator.java   |  4 +--
 .../common/SimilarityJaccardEvaluator.java      |  8 +++--
 .../runtime/formats/NonTaggedDataFormat.java    |  3 +-
 9 files changed, 22 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/LoadRecordFieldsRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/LoadRecordFieldsRule.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/LoadRecordFieldsRule.java
index 598c775..9039097 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/LoadRecordFieldsRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/LoadRecordFieldsRule.java
@@ -28,7 +28,6 @@ import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
 
 import org.apache.asterix.algebra.base.AsterixOperatorAnnotations;
-import org.apache.asterix.common.exceptions.AsterixRuntimeException;
 import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -215,7 +214,7 @@ public class LoadRecordFieldsRule implements IAlgebraicRewriteRule {
                         }
                     }
                 }
-                throw new AsterixRuntimeException("Field access " + getFirstExpr(a2)
+                throw new AlgebricksException("Field access " + getFirstExpr(a2)
                         + " does not correspond to any input of operator " + topOp);
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/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 58921b4..165d749 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,7 +25,6 @@ import java.util.List;
 
 import org.apache.asterix.algebra.base.AsterixOperatorAnnotations;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
-import org.apache.asterix.common.exceptions.AsterixRuntimeException;
 import org.apache.asterix.metadata.declared.AqlDataSource;
 import org.apache.asterix.metadata.declared.AqlDataSource.AqlDataSourceType;
 import org.apache.asterix.metadata.declared.AqlMetadataProvider;
@@ -284,7 +283,7 @@ public class PushFieldAccessRule implements IAlgebraicRewriteRule {
                     }
                 }
             }
-            throw new AsterixRuntimeException("Field access " + access.getExpressions().get(0).getValue()
+            throw new AlgebricksException("Field access " + access.getExpressions().get(0).getValue()
                     + " does not correspond to any input of operator " + op2);
         } else {
             // Check if the accessed field is not one of the partitioning key

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixRuntimeException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixRuntimeException.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixRuntimeException.java
deleted file mode 100644
index f025097..0000000
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixRuntimeException.java
+++ /dev/null
@@ -1,37 +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.common.exceptions;
-
-public class AsterixRuntimeException extends RuntimeException {
-
-    private static final long serialVersionUID = 1L;
-
-    public AsterixRuntimeException() {
-        super();
-    }
-
-    public AsterixRuntimeException(String msg) {
-        super(msg);
-    }
-
-    public AsterixRuntimeException(Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/IListIterator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/IListIterator.java
b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/IListIterator.java
index 31f97a1..6c3d22e 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/IListIterator.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/IListIterator.java
@@ -30,9 +30,9 @@ public interface IListIterator {
 
     public boolean hasNext();
 
-    public void next();
+    public void next() throws HyracksDataException;
 
-    public void reset();
+    public void reset() throws HyracksDataException;
 
     public int size();
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
index b2dbb8c..0a3d622 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataIndex.java
@@ -25,12 +25,12 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.asterix.common.config.MetadataConstants;
-import org.apache.asterix.common.exceptions.AsterixRuntimeException;
 import org.apache.asterix.common.transactions.DatasetId;
 import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
 import org.apache.asterix.formats.nontagged.AqlBinaryHashFunctionFactoryProvider;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.formats.nontagged.AqlTypeTraitProvider;
+import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IMetadataIndex;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.IAType;
@@ -82,13 +82,13 @@ public final class MetadataIndex implements IMetadataIndex {
 
     public MetadataIndex(MetadataIndexImmutableProperties indexImmutableProperties, int numFields,
IAType[] keyTypes,
             List<List<String>> keyNames, int numSecondaryIndexKeys, ARecordType
payloadType, boolean isPrimaryIndex,
-            int[] primaryKeyIndexes) throws AsterixRuntimeException {
+            int[] primaryKeyIndexes) throws MetadataException {
         // Sanity checks.
         if (keyTypes.length != keyNames.size()) {
-            throw new AsterixRuntimeException("Unequal number of key types and names given.");
+            throw new MetadataException("Unequal number of key types and names given.");
         }
         if (keyTypes.length > numFields) {
-            throw new AsterixRuntimeException("Number of keys given is greater than total
number of fields.");
+            throw new MetadataException("Number of keys given is greater than total number
of fields.");
         }
         // Set simple fields.
         this.datasetName = indexImmutableProperties.getDatasetName();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
index 548f7c3..b293fc9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AbstractAsterixListIterator.java
@@ -19,7 +19,6 @@
 package org.apache.asterix.runtime.evaluators.common;
 
 import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.exceptions.AsterixRuntimeException;
 import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
 import org.apache.asterix.fuzzyjoin.similarity.IListIterator;
 import org.apache.asterix.om.types.ATypeTag;
@@ -72,7 +71,7 @@ public abstract class AbstractAsterixListIterator implements IListIterator
{
     }
 
     @Override
-    public void next() {
+    public void next() throws HyracksDataException {
         try {
             pos = nextPos;
             ++count;
@@ -82,12 +81,12 @@ public abstract class AbstractAsterixListIterator implements IListIterator
{
             }
             itemLen = nextPos - pos;
         } catch (AsterixException e) {
-            throw new AsterixRuntimeException(e);
+            throw new HyracksDataException(e);
         }
     }
 
     @Override
-    public void reset() {
+    public void reset() throws HyracksDataException {
         count = 0;
         try {
             pos = getItemOffset(data, startOff, count);
@@ -97,11 +96,11 @@ public abstract class AbstractAsterixListIterator implements IListIterator
{
             }
             itemLen = nextPos - pos;
         } catch (AsterixException e) {
-            throw new AsterixRuntimeException(e);
+            throw new HyracksDataException(e);
         }
     }
 
-    public void reset(byte[] data, int startOff) {
+    public void reset(byte[] data, int startOff) throws HyracksDataException {
         this.data = data;
         this.startOff = startOff;
         this.numberOfItems = getNumberOfItems(data, startOff);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
index 4ad06d8..23a01d8 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
@@ -46,9 +46,9 @@ public class EditDistanceContainsEvaluator extends EditDistanceCheckEvaluator
{
                         rightStartOffset + typeIndicatorSize, edThresh);
             }
             case ORDEREDLIST: {
-                firstOrdListIter.reset(leftBytes, leftStartOffset);
-                secondOrdListIter.reset(rightBytes, rightStartOffset);
                 try {
+                    firstOrdListIter.reset(leftBytes, leftStartOffset);
+                    secondOrdListIter.reset(rightBytes, rightStartOffset);
                     return ed.getSimilarityContains(firstOrdListIter, secondOrdListIter,
edThresh);
                 } catch (HyracksDataException e) {
                     throw new AlgebricksException(e);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
index e59c04f..92946c6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
@@ -141,8 +141,12 @@ public class SimilarityJaccardEvaluator implements IScalarEvaluator {
     }
 
     protected boolean prepareLists(IPointable left, IPointable right, ATypeTag argType) throws
AlgebricksException {
-        firstListIter.reset(left.getByteArray(), left.getStartOffset());
-        secondListIter.reset(right.getByteArray(), right.getStartOffset());
+        try {
+            firstListIter.reset(left.getByteArray(), left.getStartOffset());
+            secondListIter.reset(right.getByteArray(), right.getStartOffset());
+        } catch (HyracksDataException e) {
+            throw new AlgebricksException(e);
+        }
         // Check for special case where one of the lists is empty, since list
         // types won't match.
         if (firstListIter.size() == 0 || secondListIter.size() == 0) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6097a38e/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index 3e187a9..c151dbd 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.common.exceptions.AsterixRuntimeException;
 import org.apache.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
 import org.apache.asterix.formats.base.IDataFormat;
 import org.apache.asterix.formats.nontagged.AqlADMPrinterFactoryProvider;
@@ -365,7 +364,7 @@ public class NonTaggedDataFormat implements IDataFormat {
         IFunctionManager mgr = FunctionManagerHolder.getFunctionManager();
         IFunctionDescriptor fd = mgr.lookupFunction(fnId);
         if (fd == null) {
-            throw new AsterixRuntimeException("Unresolved function " + fnId);
+            throw new AlgebricksException("Unresolved function " + fnId);
         }
         final FunctionIdentifier fid = fd.getIdentifier();
         if (functionTypeInferers.containsKey(fid)) {


Mime
View raw message