PHOENIX-2655 In MetadataClient creatTableInternal if NEWER_TABLE_FOUND swallow 
NewerTableAlreadyExistsException if the ifNotExists flag is true


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

Branch: refs/heads/calcite
Commit: 1c3a86d3139804c5c2e8a51a8e02bd3ecbd59515
Parents: e5e9144
Author: Thomas D'Silva <tdsi...@salesforce.com>
Authored: Mon Feb 8 13:29:55 2016 -0800
Committer: Thomas D'Silva <tdsi...@salesforce.com>
Committed: Mon Feb 8 14:38:47 2016 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/phoenix/schema/MetaDataClient.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1c3a86d3/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index ac2062a..0456335 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -2158,7 +2158,9 @@ public class MetaDataClient {
             case NEWER_TABLE_FOUND:
                 // Add table to ConnectionQueryServices so it's cached, but 
don't add
                 // it to this connection as we can't see it.
-                throw new NewerTableAlreadyExistsException(schemaName, 
tableName, result.getTable());
+                if (!statement.ifNotExists()) {
+                    throw new NewerTableAlreadyExistsException(schemaName, 
tableName, result.getTable());
+                }
             case UNALLOWED_TABLE_MUTATION:
                 throw new 
SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_MUTATE_TABLE)
                     
.setSchemaName(schemaName).setTableName(tableName).build().buildException();

Reply via email to