Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 79cf833e7 -> ca4febbd2


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index d12e961..b0d0e25 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@ -813,7 +813,10 @@ public class PTableImpl implements PTable {
         List<PColumn> columns = columnsByName.get(name);
         int size = columns.size();
         if (size == 0) {
-            throw new ColumnNotFoundException(name);
+            String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+            String tableNameStr = tableName==null?null:tableName.getString();
+            throw new ColumnNotFoundException(schemaNameStr, tableNameStr, 
null, name);
+
         }
         if (size > 1) {
             for (PColumn column : columns) {
@@ -839,7 +842,10 @@ public class PTableImpl implements PTable {
             String family = (String)PVarchar.INSTANCE.toObject(cf);
             PColumn col = kvColumnsByQualifiers.get(new 
KVColumnFamilyQualifier(family, cq));
             if (col == null) {
-                throw new ColumnNotFoundException("No column found for column 
qualifier " + qualifierEncodingScheme.decode(cq));
+                String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+                String tableNameStr = 
tableName==null?null:tableName.getString();
+                throw new ColumnNotFoundException(schemaNameStr, tableNameStr, 
null,
+                    "No column found for column qualifier " + 
qualifierEncodingScheme.decode(cq));
             }
             return col;
         }
@@ -1054,7 +1060,9 @@ public class PTableImpl implements PTable {
     public PColumnFamily getColumnFamily(String familyName) throws 
ColumnFamilyNotFoundException {
         PColumnFamily family = familyByString.get(familyName);
         if (family == null) {
-            throw new ColumnFamilyNotFoundException(familyName);
+            String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+            String tableNameStr = tableName==null?null:tableName.getString();
+            throw new ColumnFamilyNotFoundException(schemaNameStr, 
tableNameStr, familyName);
         }
         return family;
     }
@@ -1064,7 +1072,9 @@ public class PTableImpl implements PTable {
         PColumnFamily family = familyByBytes.get(familyBytes);
         if (family == null) {
             String familyName = Bytes.toString(familyBytes);
-            throw new ColumnFamilyNotFoundException(familyName);
+            String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+            String tableNameStr = tableName==null?null:tableName.getString();
+            throw new ColumnFamilyNotFoundException(schemaNameStr, 
tableNameStr, familyName);
         }
         return family;
     }
@@ -1094,7 +1104,9 @@ public class PTableImpl implements PTable {
         List<PColumn> columns = columnsByName.get(name);
         int size = columns.size();
         if (size == 0) {
-            throw new ColumnNotFoundException(name);
+            String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+            String tableNameStr = tableName==null?null:tableName.getString();
+            throw new ColumnNotFoundException(schemaNameStr, tableNameStr, 
null, name);
         }
         if (size > 1) {
             do {
@@ -1103,7 +1115,9 @@ public class PTableImpl implements PTable {
                     return column;
                 }
             } while (size > 0);
-            throw new ColumnNotFoundException(name);
+            String schemaNameStr = 
schemaName==null?null:schemaName.getString();
+            String tableNameStr = tableName==null?null:tableName.getString();
+            throw new ColumnNotFoundException(schemaNameStr, tableNameStr, 
null, name);
         }
         return columns.get(0);
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/schema/SchemaNotFoundException.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SchemaNotFoundException.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SchemaNotFoundException.java
index b7313d8..32541c1 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SchemaNotFoundException.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SchemaNotFoundException.java
@@ -24,11 +24,10 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 public class SchemaNotFoundException extends MetaDataEntityNotFoundException {
     private static final long serialVersionUID = 1L;
     private static SQLExceptionCode code = SQLExceptionCode.SCHEMA_NOT_FOUND;
-    private final String schemaName;
     private final long timestamp;
 
     public SchemaNotFoundException(SchemaNotFoundException e, long timestamp) {
-        this(e.schemaName, timestamp);
+        this(e.getSchemaName(), timestamp);
     }
 
     public SchemaNotFoundException(String schemaName) {
@@ -37,15 +36,10 @@ public class SchemaNotFoundException extends 
MetaDataEntityNotFoundException {
 
     public SchemaNotFoundException(String schemaName, long timestamp) {
         super(new 
SQLExceptionInfo.Builder(code).setSchemaName(schemaName).build().toString(), 
code.getSQLState(),
-                code.getErrorCode(), null);
-        this.schemaName = schemaName;
+                code.getErrorCode(), schemaName, null, null);
         this.timestamp = timestamp;
     }
 
-    public String getSchemaName() {
-        return schemaName;
-    }
-
     public long getTimeStamp() {
         return timestamp;
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceNotFoundException.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceNotFoundException.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceNotFoundException.java
index e739c17..29ff87b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceNotFoundException.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceNotFoundException.java
@@ -24,8 +24,6 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 public class SequenceNotFoundException extends MetaDataEntityNotFoundException 
{
        private static final long serialVersionUID = 1L;
        private static SQLExceptionCode code = 
SQLExceptionCode.SEQUENCE_UNDEFINED;
-       private final String schemaName;
-       private final String tableName;
 
        public SequenceNotFoundException(String tableName) {
                this(null, tableName);
@@ -33,16 +31,6 @@ public class SequenceNotFoundException extends 
MetaDataEntityNotFoundException {
 
        public SequenceNotFoundException(String schemaName, String tableName) {
                super(new 
SQLExceptionInfo.Builder(code).setSchemaName(schemaName).setTableName(tableName).build().toString(),
-                               code.getSQLState(), code.getErrorCode(), null);
-               this.tableName = tableName;
-               this.schemaName = schemaName;
-       }
-
-       public String getTableName() {
-               return tableName;
-       }
-
-       public String getSchemaName() {
-               return schemaName;
+                               code.getSQLState(), code.getErrorCode(), 
schemaName, tableName, null);
        }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/schema/TableNotFoundException.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableNotFoundException.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableNotFoundException.java
index 202f452..298a288 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableNotFoundException.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableNotFoundException.java
@@ -21,6 +21,7 @@ import org.apache.hadoop.hbase.HConstants;
 
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.exception.SQLExceptionInfo;
+import org.apache.phoenix.util.SchemaUtil;
 
 
 /**
@@ -33,16 +34,14 @@ import org.apache.phoenix.exception.SQLExceptionInfo;
 public class TableNotFoundException extends MetaDataEntityNotFoundException {
     private static final long serialVersionUID = 1L;
     private static SQLExceptionCode code = SQLExceptionCode.TABLE_UNDEFINED;
-    private final String schemaName;
-    private final String tableName;
     private final long timestamp;
 
     public TableNotFoundException(TableNotFoundException e, long timestamp) {
-        this(e.schemaName,e.tableName, timestamp);
+        this(e.getSchemaName(),e.getTableName(), timestamp);
     }
 
     public TableNotFoundException(String tableName) {
-        this(null, tableName);
+        this(SchemaUtil.getSchemaNameFromFullName(tableName), 
SchemaUtil.getTableNameFromFullName(tableName));
     }
 
     public TableNotFoundException(String schemaName, String tableName) {
@@ -51,20 +50,10 @@ public class TableNotFoundException extends 
MetaDataEntityNotFoundException {
     
     public TableNotFoundException(String schemaName, String tableName, long 
timestamp) {
         super(new 
SQLExceptionInfo.Builder(code).setSchemaName(schemaName).setTableName(tableName).build().toString(),
-                code.getSQLState(), code.getErrorCode(), null);
-        this.tableName = tableName;
-        this.schemaName = schemaName;
+                code.getSQLState(), code.getErrorCode(), schemaName, 
tableName, null);
         this.timestamp = timestamp;
     }
 
-    public String getTableName() {
-        return tableName;
-    }
-
-    public String getSchemaName() {
-        return schemaName;
-    }
-
     public long getTimeStamp() {
         return timestamp;
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/schema/UpsertColumnsValuesMismatchException.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/UpsertColumnsValuesMismatchException.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/UpsertColumnsValuesMismatchException.java
new file mode 100644
index 0000000..f63fab1
--- /dev/null
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/UpsertColumnsValuesMismatchException.java
@@ -0,0 +1,41 @@
+/*
+ * 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.phoenix.schema;
+
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.exception.SQLExceptionInfo;
+
+public class UpsertColumnsValuesMismatchException extends 
MetaDataEntityNotFoundException {
+    private static final long serialVersionUID = 1L;
+    private static SQLExceptionCode code = 
SQLExceptionCode.UPSERT_COLUMN_NUMBERS_MISMATCH;
+    private final long timestamp;
+    public UpsertColumnsValuesMismatchException(String schemaName, String 
tableName, String message) {
+        this(schemaName, tableName, message, HConstants.LATEST_TIMESTAMP);
+    }
+    public UpsertColumnsValuesMismatchException(String schemaName, String 
tableName, String message, long timestamp) {
+        super(new SQLExceptionInfo.Builder(code).setSchemaName(schemaName).
+          setTableName(tableName).setMessage(message).build().toString(), 
code.getSQLState(),
+                code.getErrorCode(), schemaName, tableName, null);
+        this.timestamp = timestamp;
+    }
+
+    public long getTimeStamp() {
+        return timestamp;
+    }
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/dd18d043/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
index e770f63..d402c38 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
@@ -1832,7 +1832,7 @@ public class UpgradeUtil {
             MetaDataMutationResult result = new 
MetaDataClient(conn).updateCache(conn.getTenantId(),schemaName,
                     SchemaUtil.getTableNameFromFullName(tableName),true);
             if (result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) 
{ throw new TableNotFoundException(
-                    tableName); }
+              schemaName, tableName); }
             table = result.getTable();
             
             // check whether table is properly upgraded before upgrading 
indexes

Reply via email to