asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject asterixdb git commit: fix NPE in ValidateUtil
Date Sat, 03 Sep 2016 07:18:09 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 6c63834dc -> b975100c9


fix NPE in ValidateUtil

Change-Id: I8f623441a3f5b72a9a0621d32d9d1a6aa5567d66
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1139
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>


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

Branch: refs/heads/master
Commit: b975100c9001b8b86f976c592f7ab7863111d659
Parents: 6c63834
Author: Till Westmann <tillw@apache.org>
Authored: Thu Sep 1 15:21:57 2016 -0700
Committer: Till Westmann <tillw@apache.org>
Committed: Sat Sep 3 00:17:48 2016 -0700

----------------------------------------------------------------------
 .../org/apache/asterix/translator/util/ValidateUtil.java  | 10 +++++++---
 .../asterix-app/src/test/resources/metadata/testsuite.xml |  8 ++++----
 .../src/test/resources/runtimets/testsuite.xml            |  2 +-
 .../src/test/resources/runtimets/testsuite_sqlpp.xml      |  6 +++---
 4 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b975100c/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
index 13153c2..065b1b0 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java
@@ -107,6 +107,10 @@ public class ValidateUtil {
                     keySourceIndicators);
             for (int fidx = 0; fidx < partitioningExprTypes.size(); ++fidx) {
                 IAType fieldType = partitioningExprTypes.get(fidx);
+                if (fieldType == null) {
+                    throw new AsterixException(
+                            "Type not found for partitioning key " + partitioningExprs.get(fidx));
+                }
                 switch (fieldType.getTypeTag()) {
                     case INT8:
                     case INT16:
@@ -125,10 +129,10 @@ public class ValidateUtil {
                         break;
                     case UNION:
                         throw new AsterixException(
-                                "The partitioning key \"" + partitioningExprs.get(fidx) +
"\" cannot be nullable");
+                                "The partitioning key " + partitioningExprs.get(fidx) + "
cannot be nullable");
                     default:
-                        throw new AsterixException("The partitioning key \"" + partitioningExprs.get(fidx)
-                                + "\" cannot be of type " + fieldType.getTypeTag() + ".");
+                        throw new AsterixException("The partitioning key " + partitioningExprs.get(fidx)
+                                + " cannot be of type " + fieldType.getTypeTag() + ".");
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b975100c/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
index 8f35293..251e2e4 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -412,13 +412,13 @@
     <test-case FilePath="exception">
       <compilation-unit name="issue_255_create_dataset_error_1">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>java.lang.NullPointerException</expected-error>
+        <expected-error>Type not found for partitioning key [name]</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_255_create_dataset_error_2">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The partitioning key "[open-type]" cannot be of type
RECORD.</expected-error>
+        <expected-error>Error: The partitioning key [open-type] cannot be of type RECORD.</expected-error>
       </compilation-unit>
     </test-case>
     <!-- Feed datasets are not supported anymore
@@ -432,13 +432,13 @@
     <test-case FilePath="exception">
       <compilation-unit name="issue_266_create_dataset_error_1">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>java.lang.NullPointerException</expected-error>
+        <expected-error>Type not found for partitioning key [point]</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">
       <compilation-unit name="issue_266_create_dataset_error_2">
         <output-dir compare="Text">none</output-dir>
-        <expected-error>Error: The partitioning key "[id]" cannot be nullable</expected-error>
+        <expected-error>Error: The partitioning key [id] cannot be nullable</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="exception">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b975100c/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 9e4a3c4..6c65a62 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -3179,7 +3179,7 @@
     <test-case FilePath="misc">
       <compilation-unit name="partition-by-nonexistent-field"> <!-- Seriously??
3 expected errors -->
         <output-dir compare="Text">partition-by-nonexistent-field</output-dir>
-        <expected-error>java.lang.NullPointerException</expected-error>
+        <expected-error>Type not found for partitioning key [id]</expected-error>
         <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
Cannot find dataset</expected-error>
         <expected-error>org.apache.hyracks.algebricks.common.exceptions.AlgebricksException:
Could not find dataset</expected-error>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/b975100c/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index a074df9..a89808e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -3034,9 +3034,9 @@
     <test-case FilePath="misc">
       <compilation-unit name="partition-by-nonexistent-field">
         <output-dir compare="Text">partition-by-nonexistent-field</output-dir>
-        <expected-error>java.lang.NullPointerException</expected-error>
-        <expected-error>Cannot find dataset</expected-error>
-        <expected-error>Cannot find dataset testds in dataverse test nor an alias with
name testds</expected-error>
+        <expected-error>Type not found for partitioning key [id]</expected-error>
+        <expected-error>Cannot find dataset testds in dataverse test</expected-error>
+        <expected-error>Cannot find dataset testds in dataverse test nor an alias with
name testds!</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="misc">


Mime
View raw message