This is an automated email from the ASF dual-hosted git repository.

stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/5.1 by this push:
     new 04da3c6c47 PHOENIX-6973 Add option to CREATE TABLE to skip 
verification of HBase table
04da3c6c47 is described below

commit 04da3c6c476f050d3635c94cb040d4dfcacc2046
Author: Tamas Payer <pay...@apache.org>
AuthorDate: Wed Jun 7 10:03:39 2023 +0200

    PHOENIX-6973 Add option to CREATE TABLE to skip verification of HBase table
---
 .../org/apache/phoenix/end2end/CreateTableIT.java  | 89 ++++++++++++++++++++++
 phoenix-core/src/main/antlr3/PhoenixSQL.g          |  6 +-
 .../org/apache/phoenix/jdbc/PhoenixStatement.java  | 26 +++++--
 .../apache/phoenix/parse/CreateTableStatement.java | 11 ++-
 .../org/apache/phoenix/parse/ParseNodeFactory.java | 54 +++++++++----
 .../org/apache/phoenix/schema/MetaDataClient.java  |  4 +-
 .../phoenix/compile/CreateTableCompilerTest.java   | 27 ++++++-
 .../phoenix/compile/PostIndexDDLCompilerTest.java  | 15 ++++
 .../phoenix/jdbc/PhoenixPreparedStatementTest.java |  1 -
 9 files changed, 200 insertions(+), 33 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
index f05e6c8a49..50b5e69c79 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -40,19 +41,28 @@ import java.util.Properties;
 import java.util.UUID;
 
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.KeepDeletedCells;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Row;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
 import org.apache.hadoop.hbase.ipc.PhoenixRpcSchedulerFactory;
 import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.mapreduce.index.IndexUpgradeTool;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConnectionQueryServices;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
@@ -66,6 +76,7 @@ import org.apache.phoenix.schema.PTableType;
 import org.apache.phoenix.schema.SchemaNotFoundException;
 import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.schema.TableNotFoundException;
+import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.EnvironmentEdgeManager;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -1609,6 +1620,84 @@ public class CreateTableIT extends 
ParallelStatsDisabledIT {
         }
     }
 
+    @Test
+    public void testCreateTableWithNoVerify() throws SQLException, 
IOException, InterruptedException {
+        final String tableName = SchemaUtil.getTableName(generateUniqueName(), 
generateUniqueName());
+        final byte[] tableBytes = tableName.getBytes();
+        final byte[] familyName = 
Bytes.toBytes(SchemaUtil.normalizeIdentifier("0"));
+        final byte[][] splits = new byte[][] {Bytes.toBytes(20), 
Bytes.toBytes(30)};
+
+        try (Admin admin = driver.getConnectionQueryServices(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES)).getAdmin()) {
+            
admin.createTable(TableDescriptorBuilder.newBuilder(TableName.valueOf(tableBytes))
+                    
.addColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(familyName)
+                            
.setKeepDeletedCells(KeepDeletedCells.TRUE).build())
+                    .build(), splits);
+        }
+
+        final byte[] uintCol = Bytes.toBytes("UINT_COL");
+        final byte[] ulongCol = Bytes.toBytes("ULONG_COL");
+        final byte[] key_1 = ByteUtil.concat(Bytes.toBytes(20), 
Bytes.toBytes(200L), Bytes.toBytes("b"));
+        final byte[] key_2 = ByteUtil.concat(Bytes.toBytes(40), 
Bytes.toBytes(400L), Bytes.toBytes("d"));
+        final byte[] emptyColumnQualifier = Bytes.toBytes("_0");
+
+        ConnectionQueryServices services = 
driver.getConnectionQueryServices(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
+        try (Table hTable = services.getTable(tableBytes)) {
+            // Insert rows using standard HBase mechanism with standard HBase 
"types"
+            List<Row> mutations = new ArrayList<>();
+
+            Put put = new Put(key_1);
+            put.addColumn(familyName, uintCol, HConstants.LATEST_TIMESTAMP, 
Bytes.toBytes(5000));
+            put.addColumn(familyName, ulongCol, HConstants.LATEST_TIMESTAMP, 
Bytes.toBytes(50000L));
+            mutations.add(put);
+
+            put = new Put(key_2);
+            put.addColumn(familyName, uintCol, HConstants.LATEST_TIMESTAMP, 
Bytes.toBytes(4000));
+            put.addColumn(familyName, ulongCol, HConstants.LATEST_TIMESTAMP, 
Bytes.toBytes(40000L));
+            mutations.add(put);
+
+            hTable.batch(mutations, null);
+
+            Result result = hTable.get(new Get(key_1));
+            assertFalse(result.isEmpty());
+
+            result = hTable.get(new Get(key_2));
+            assertFalse(result.isEmpty());
+        }
+
+        String ddl = "create table " + tableName +
+                "   (uint_key unsigned_int not null," +
+                "    ulong_key unsigned_long not null," +
+                "    string_key varchar not null,\n" +
+                "    uint_col unsigned_int," +
+                "    ulong_col unsigned_long" +
+                "    CONSTRAINT pk PRIMARY KEY (uint_key, ulong_key, 
string_key)) noverify COLUMN_ENCODED_BYTES=NONE";
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            conn.createStatement().execute(ddl);
+        }
+
+        try (Table hTable = services.getTable(tableBytes)) {
+            Result result = hTable.get(new Get(key_1));
+
+            byte[] value = result.getValue(familyName, uintCol);
+            assertEquals(5000, Bytes.toInt(value));
+            value = result.getValue(familyName, ulongCol);
+            assertEquals(50000L, Bytes.toLong(value));
+
+            value = result.getValue(familyName, emptyColumnQualifier);
+            assertNull(value);
+
+            result = hTable.get(new Get(key_2));
+            value = result.getValue(familyName, uintCol);
+            assertEquals(4000, Bytes.toInt(value));
+            value = result.getValue(familyName, ulongCol);
+            assertEquals(40000L, Bytes.toLong(value));
+
+            value = result.getValue(familyName, emptyColumnQualifier);
+            assertNull(value);
+        }
+    }
+
     public static long verifyLastDDLTimestamp(String dataTableFullName, long 
startTS, Connection conn) throws SQLException {
         long endTS = EnvironmentEdgeManager.currentTimeMillis();
         //Now try the PTable API
diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g 
b/phoenix-core/src/main/antlr3/PhoenixSQL.g
index 56b2408228..5bc75a1216 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -152,6 +152,7 @@ tokens
     REVOKE = 'revoke';
     SHOW = 'show';
     REGIONS = 'regions';
+    NOVERIFY = 'noverify';
 }
 
 
@@ -285,7 +286,7 @@ package org.apache.phoenix.parse;
     public void resetBindCount() {
         anonBindNum = 0;
     }
-    
+
     public String nextBind() {
         return Integer.toString(++anonBindNum);
     }
@@ -467,10 +468,11 @@ explain_node returns [BindableStatement ret]
 create_table_node returns [CreateTableStatement ret]
     :   CREATE (im=IMMUTABLE)? TABLE (IF NOT ex=EXISTS)? t=from_table_name 
         (LPAREN c=column_defs (pk=pk_constraint)? RPAREN)
+        (noverify=NOVERIFY)?
         (p=fam_properties)?
         (SPLIT ON s=value_expression_list)?
         (COLUMN_QUALIFIER_COUNTER LPAREN cqc=initializiation_list RPAREN)?
-        {ret = factory.createTable(t, p, c, pk, s, PTableType.TABLE, ex!=null, 
null, null, getBindCount(), im!=null ? true : null,  cqc); }
+        {ret = factory.createTable(t, p, c, pk, s, PTableType.TABLE, ex!=null, 
null, null, getBindCount(), im!=null ? true : null, cqc, noverify!=null); }
     ;
    
 // Parse a create schema statement.
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 8fa4b1ee98..82dd4ceff7 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -247,7 +247,7 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
         public String toString() {
             return toString;
         }
-    };
+    }
 
     protected final PhoenixConnection connection;
     private static final int NO_UPDATE = -1;
@@ -888,8 +888,10 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
         ExecutableCreateTableStatement(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columnDefs,
                                        PrimaryKeyConstraint pkConstraint, 
List<ParseNode> splitNodes, PTableType tableType, boolean ifNotExists,
                                        TableName baseTableName, ParseNode 
tableTypeIdNode, int bindCount, Boolean immutableRows,
-                                       Map<String, Integer> familyCounters) {
-            super(tableName, props, columnDefs, pkConstraint, splitNodes, 
tableType, ifNotExists, baseTableName, tableTypeIdNode, bindCount, 
immutableRows, familyCounters);
+                                       Map<String, Integer> familyCounters, 
boolean noVerify) {
+            super(tableName, props, columnDefs, pkConstraint, splitNodes, 
tableType, ifNotExists,
+                    baseTableName, tableTypeIdNode, bindCount, immutableRows, 
familyCounters,
+                    noVerify);
         }
 
         @SuppressWarnings("unchecked")
@@ -1661,14 +1663,22 @@ public class PhoenixStatement implements Statement, 
SQLCloseable {
         }
 
         @Override
-        public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits, PTableType 
tableType, boolean ifNotExists, TableName baseTableName, ParseNode 
tableTypeIdNode, int bindCount, Boolean immutableRows, Map<String, Integer> 
cqCounters) {
-            return new ExecutableCreateTableStatement(tableName, props, 
columns, pkConstraint, splits, tableType, ifNotExists, baseTableName, 
tableTypeIdNode, bindCount, immutableRows, cqCounters);
+        public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits,
+                                                PTableType tableType, boolean 
ifNotExists, TableName baseTableName, ParseNode tableTypeIdNode, int bindCount, 
Boolean immutableRows,
+                                                Map<String, Integer> 
cqCounters, boolean noVerify) {
+            return new ExecutableCreateTableStatement(tableName, props, 
columns, pkConstraint, splits, tableType, ifNotExists, baseTableName, 
tableTypeIdNode, bindCount, immutableRows, cqCounters, noVerify);
+        }
+
+        @Override
+        public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits,
+                                                PTableType tableType, boolean 
ifNotExists, TableName baseTableName, ParseNode tableTypeIdNode, int bindCount, 
Boolean immutableRows, Map<String, Integer> cqCounters) {
+            return createTable(tableName, props, columns, pkConstraint, 
splits, tableType, ifNotExists, baseTableName, tableTypeIdNode, bindCount, 
immutableRows, cqCounters, false);
         }
 
         @Override
-        public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint,
-                List<ParseNode> splits, PTableType tableType, boolean 
ifNotExists, TableName baseTableName, ParseNode tableTypeIdNode, int bindCount, 
Boolean immutableRows) {
-            return new ExecutableCreateTableStatement(tableName, props, 
columns, pkConstraint, splits, tableType, ifNotExists, baseTableName, 
tableTypeIdNode, bindCount, immutableRows, null);
+        public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits,
+                                                PTableType tableType, boolean 
ifNotExists, TableName baseTableName, ParseNode tableTypeIdNode, int bindCount, 
Boolean immutableRows) {
+            return createTable(tableName, props, columns, pkConstraint, 
splits, tableType, ifNotExists, baseTableName, tableTypeIdNode, bindCount, 
immutableRows, null);
         }
 
         @Override
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CreateTableStatement.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CreateTableStatement.java
index 2d9ea13e6e..37376c985e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/CreateTableStatement.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/CreateTableStatement.java
@@ -43,6 +43,7 @@ public class CreateTableStatement extends MutableStatement {
     // TODO change this to boolean at the next major release and remove 
TableProperty.IMMUTABLE_ROWS and QueryServiceOptions.IMMUTABLE_ROWS_ATTRIB
     private final Boolean immutableRows;
     private final Map<String, Integer> familyCQCounters;
+    private final boolean noVerify;
     
     public CreateTableStatement(CreateTableStatement createTable, 
List<ColumnDef> columns) {
         this.tableName = createTable.tableName;
@@ -57,6 +58,7 @@ public class CreateTableStatement extends MutableStatement {
         this.whereClause = createTable.whereClause;
         this.immutableRows = createTable.immutableRows;
         this.familyCQCounters = createTable.familyCQCounters;
+        this.noVerify = createTable.noVerify;
     }
 
     public CreateTableStatement(CreateTableStatement createTable, 
PrimaryKeyConstraint pkConstraint,
@@ -73,6 +75,7 @@ public class CreateTableStatement extends MutableStatement {
         this.whereClause = createTable.whereClause;
         this.immutableRows = createTable.immutableRows;
         this.familyCQCounters = createTable.familyCQCounters;
+        this.noVerify = createTable.noVerify;
     }
 
     public CreateTableStatement(CreateTableStatement createTable, 
ListMultimap<String,Pair<String,Object>>  props, List<ColumnDef> columns) {
@@ -88,12 +91,13 @@ public class CreateTableStatement extends MutableStatement {
         this.whereClause = createTable.whereClause;
         this.immutableRows = createTable.immutableRows;
         this.familyCQCounters = createTable.familyCQCounters;
+        this.noVerify = createTable.noVerify;
     }
 
     protected CreateTableStatement(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint,
                                    List<ParseNode> splitNodes, PTableType 
tableType, boolean ifNotExists,
                                    TableName baseTableName, ParseNode 
whereClause, int bindCount, Boolean immutableRows,
-                                   Map<String, Integer> familyCounters) {
+                                   Map<String, Integer> familyCounters, 
boolean noVerify) {
         this.tableName = tableName;
         this.props = props == null ? 
ImmutableListMultimap.<String,Pair<String,Object>>of() : props;
         this.tableType = 
PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA.equals(tableName.getSchemaName()) 
? PTableType.SYSTEM : tableType;
@@ -106,6 +110,7 @@ public class CreateTableStatement extends MutableStatement {
         this.whereClause = whereClause;
         this.immutableRows = immutableRows;
         this.familyCQCounters = familyCounters;
+        this.noVerify = noVerify;
     }
 
     public ParseNode getWhereClause() {
@@ -156,4 +161,8 @@ public class CreateTableStatement extends MutableStatement {
     public Map<String, Integer> getFamilyCQCounters() {
         return familyCQCounters;
     }
+
+    public boolean isNoVerify() {
+        return noVerify;
+    }
 }
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java 
b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
index 7763536c37..eb093069e4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/ParseNodeFactory.java
@@ -329,12 +329,34 @@ public class ParseNodeFactory {
         return new IndexKeyConstraint(parseNodeAndSortOrder);
     }
 
-    public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits, PTableType 
tableType, boolean ifNotExists, TableName baseTableName, ParseNode 
tableTypeIdNode, int bindCount, Boolean immutableRows, Map<String, Integer> 
cqCounters) {
-        return new CreateTableStatement(tableName, props, columns, 
pkConstraint, splits, tableType, ifNotExists, baseTableName, tableTypeIdNode, 
bindCount, immutableRows, cqCounters);
-    }
-
-    public CreateTableStatement createTable(TableName tableName, 
ListMultimap<String,Pair<String,Object>> props, List<ColumnDef> columns, 
PrimaryKeyConstraint pkConstraint, List<ParseNode> splits, PTableType 
tableType, boolean ifNotExists, TableName baseTableName, ParseNode 
tableTypeIdNode, int bindCount, Boolean immutableRows) {
-        return new CreateTableStatement(tableName, props, columns, 
pkConstraint, splits, tableType, ifNotExists, baseTableName, tableTypeIdNode, 
bindCount, immutableRows, null);
+    public CreateTableStatement createTable(
+            TableName tableName, ListMultimap<String,Pair<String,Object>> 
props,
+            List<ColumnDef> columns, PrimaryKeyConstraint pkConstraint,
+            List<ParseNode> splits, PTableType tableType, boolean ifNotExists,
+            TableName baseTableName, ParseNode tableTypeIdNode, int bindCount,
+            Boolean immutableRows, Map<String, Integer> cqCounters, boolean 
noVerify) {
+        return new CreateTableStatement(tableName, props, columns, 
pkConstraint, splits, tableType,
+                ifNotExists, baseTableName, tableTypeIdNode, bindCount, 
immutableRows, cqCounters,
+                noVerify);
+    }
+
+    public CreateTableStatement createTable(
+            TableName tableName, ListMultimap<String,Pair<String,Object>> 
props,
+            List<ColumnDef> columns, PrimaryKeyConstraint pkConstraint, 
List<ParseNode> splits,
+            PTableType tableType, boolean ifNotExists, TableName baseTableName,
+            ParseNode tableTypeIdNode, int bindCount, Boolean immutableRows,
+            Map<String, Integer> cqCounters) {
+        return createTable(tableName, props, columns, pkConstraint, splits, 
tableType, ifNotExists,
+                baseTableName, tableTypeIdNode, bindCount, immutableRows, 
cqCounters, false);
+    }
+
+    public CreateTableStatement createTable(
+            TableName tableName, ListMultimap<String,Pair<String,Object>> 
props,
+            List<ColumnDef> columns, PrimaryKeyConstraint pkConstraint, 
List<ParseNode> splits,
+            PTableType tableType, boolean ifNotExists, TableName baseTableName,
+            ParseNode tableTypeIdNode, int bindCount, Boolean immutableRows) {
+        return createTable(tableName, props, columns, pkConstraint, splits, 
tableType, ifNotExists,
+                baseTableName, tableTypeIdNode, bindCount, immutableRows, 
null, false);
     }
 
     public CreateSchemaStatement createSchema(String schemaName, boolean 
ifNotExists) {
@@ -443,15 +465,15 @@ public class ParseNodeFactory {
     }
     
     public NamedTableNode namedTable(String alias, TableName name, 
List<ColumnDef> dyn_columns, LiteralParseNode tableSampleNode) {
-       Double tableSamplingRate;
-       if(tableSampleNode==null||tableSampleNode.getValue()==null){
-               tableSamplingRate=ConcreteTableNode.DEFAULT_TABLE_SAMPLING_RATE;
-       }else if(tableSampleNode.getValue() instanceof Integer){
-               tableSamplingRate=(double)((int)tableSampleNode.getValue());
-       }else{
-               tableSamplingRate=((BigDecimal) 
tableSampleNode.getValue()).doubleValue();
-       }
-       return new NamedTableNode(alias, name, dyn_columns, tableSamplingRate);
+        Double tableSamplingRate;
+        if (tableSampleNode == null || tableSampleNode.getValue() == null) {
+            tableSamplingRate = ConcreteTableNode.DEFAULT_TABLE_SAMPLING_RATE;
+        } else if (tableSampleNode.getValue() instanceof Integer) {
+            tableSamplingRate = (double)((int)tableSampleNode.getValue());
+        } else {
+            tableSamplingRate=((BigDecimal) 
tableSampleNode.getValue()).doubleValue();
+        }
+        return new NamedTableNode(alias, name, dyn_columns, tableSamplingRate);
     }
 
     public BindTableNode bindTable(String alias, TableName name) {
@@ -517,7 +539,7 @@ public class ParseNodeFactory {
         args.addAll(valueNodes);
 
         BuiltInFunctionInfo info = getInfo(name, args);
-        if(info==null) {
+        if (info == null) {
             return new UDFParseNode(name,args,info);
         }
         Constructor<? extends FunctionParseNode> ctor = info.getNodeCtor();
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 7c4b27df91..1506e1ca79 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
@@ -274,7 +274,6 @@ import 
org.apache.phoenix.thirdparty.com.google.common.collect.Maps;
 import org.apache.phoenix.thirdparty.com.google.common.collect.Sets;
 import org.apache.phoenix.thirdparty.com.google.common.primitives.Ints;
 
-import edu.umd.cs.findbugs.annotations.SuppressWarnings;
 
 public class MetaDataClient {
     private static final Logger LOGGER = 
LoggerFactory.getLogger(MetaDataClient.class);
@@ -1116,7 +1115,8 @@ public class MetaDataClient {
         }
         table = createTableInternal(statement, splits, parent, viewStatement, 
viewType, viewIndexIdType, viewColumnConstants, isViewColumnReferenced, false, 
null, null, tableProps, commonFamilyProps);
 
-        if (table == null || table.getType() == PTableType.VIEW /*|| 
table.isTransactional()*/) {
+        if (table == null || table.getType() == PTableType.VIEW
+                || statement.isNoVerify() /*|| table.isTransactional()*/) {
             return new MutationState(0, 0, connection);
         }
         // Hack to get around the case when an SCN is specified on the 
connection.
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/CreateTableCompilerTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/CreateTableCompilerTest.java
index ed907c3938..54e52f2332 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/CreateTableCompilerTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/CreateTableCompilerTest.java
@@ -19,6 +19,8 @@ package org.apache.phoenix.compile;
 
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.sql.DriverManager;
@@ -26,6 +28,8 @@ import java.sql.SQLException;
 import java.util.Properties;
 
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.parse.CreateTableStatement;
+import org.apache.phoenix.parse.SQLParser;
 import org.apache.phoenix.query.BaseConnectionlessQueryTest;
 import org.apache.phoenix.schema.ColumnAlreadyExistsException;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -35,13 +39,30 @@ public class CreateTableCompilerTest extends 
BaseConnectionlessQueryTest {
     @Test
     public void testCreateTableWithDuplicateColumns() throws SQLException {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        PhoenixConnection conn = DriverManager.getConnection(getUrl(), 
props).unwrap(PhoenixConnection.class);
-        String ddl = "CREATE TABLE T (ID INTEGER PRIMARY KEY, DUPE INTEGER, 
DUPE INTEGER)";
-        try {
+        try (PhoenixConnection conn = DriverManager.getConnection(getUrl(), 
props).unwrap(PhoenixConnection.class)) {
+            String ddl = "CREATE TABLE T (ID INTEGER PRIMARY KEY, DUPE 
INTEGER, DUPE INTEGER)";
             conn.createStatement().execute(ddl);
             fail();
         } catch (ColumnAlreadyExistsException e) {
             assertEquals("DUPE", e.getColumnName());
         }
     }
+
+    @Test
+    public void testCreateTableWithNoVerify() throws SQLException {
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        try (PhoenixConnection conn = DriverManager.getConnection(getUrl(), 
props).unwrap(PhoenixConnection.class)) {
+            String ddl = "CREATE TABLE T (ID INTEGER PRIMARY KEY, A INTEGER, B 
INTEGER) NOVERIFY";
+            boolean result = conn.createStatement().execute(ddl);
+            assertFalse(result);
+        }
+    }
+
+    @Test
+    public void testCreateTableWithNoVerifyValidateStmt() throws SQLException {
+        String ddl = "CREATE TABLE A (K VARCHAR PRIMARY KEY DESC) NOVERIFY";
+        CreateTableStatement stmt = (CreateTableStatement)new 
SQLParser((ddl)).parseStatement();
+
+        assertTrue(stmt.isNoVerify());
+    }
 }
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/PostIndexDDLCompilerTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/PostIndexDDLCompilerTest.java
index 9df2fec5d1..9e99a7eb96 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/compile/PostIndexDDLCompilerTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/compile/PostIndexDDLCompilerTest.java
@@ -23,6 +23,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
+import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.query.BaseConnectionlessQueryTest;
@@ -60,6 +61,20 @@ public class PostIndexDDLCompilerTest extends 
BaseConnectionlessQueryTest {
         }
     }
 
+    @Test
+    public void testCreateTableWithNoVerify() throws SQLException {
+        String ddl = "CREATE TABLE A (K VARCHAR PRIMARY KEY DESC) NOVERIFY";
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            PhoenixStatement stmt = 
conn.createStatement().unwrap(PhoenixStatement.class);
+            MutationPlan plan = stmt.compileMutation(ddl);
+            MutationState state = plan.execute();
+
+            assertEquals("CREATE TABLE\n", plan.getExplainPlan().toString());
+            assertEquals(0, state.getMaxSize());
+            assertEquals(0, state.getMaxSizeBytes());
+        }
+    }
+
     private void setupTables(Connection conn) throws SQLException {
         conn.createStatement().execute("CREATE TABLE T (k VARCHAR NOT NULL 
PRIMARY KEY, v1 CHAR(15), v2 VARCHAR)");
         conn.createStatement().execute("CREATE INDEX IDX ON T(v1, v2)");
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
index 616e3a029a..5d1d09922c 100644
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
+++ 
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
@@ -25,7 +25,6 @@ import java.util.Properties;
 
 import org.apache.phoenix.exception.SQLExceptionCode;
 import org.apache.phoenix.query.BaseConnectionlessQueryTest;
-import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.junit.Test;

Reply via email to