kabhishek4 commented on code in PR #1409:
URL: https://github.com/apache/phoenix/pull/1409#discussion_r2613654231


##########
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -3303,6 +3304,30 @@ private static void throwIfInsufficientColumns(String 
schemaName, String tableNa
         }
     }
 
+    public MutationState truncateTable(TruncateTableStatement statement) 
throws SQLException {
+        String schemaName = connection.getSchema() != null && 
statement.getTableName().getSchemaName() == null
+            ? connection.getSchema() : 
statement.getTableName().getSchemaName();
+        String tableName = statement.getTableName().getTableName();
+        boolean isNamespaceMapped = 
SchemaUtil.isNamespaceMappingEnabled(statement.getTableType(), 
connection.getQueryServices().getProps());
+        boolean wasAutoCommit = connection.getAutoCommit();
+        try {
+            PTable ptable = connection.getTable(
+                new PTableKey(connection.getTenantId(), 
SchemaUtil.getTableName(schemaName, tableName)));
+        } catch (TableNotFoundException e) {
+            throw e;
+        }
+        try {
+            connection.getQueryServices().truncateTable(schemaName, tableName, 
isNamespaceMapped);

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to