@@ -10234,30 +10234,47 @@ protected Integer getJdoResult(GetHelper<Integer> ctx) throws MetaException, NoS
10234
10234
public boolean deletePartitionColumnStatistics(String catName, String dbName, String tableName,
10235
10235
String partName, List<String> partVals, String colName, String engine)
10236
10236
throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
10237
- boolean ret = false;
10238
- Query query = null;
10239
10237
dbName = org.apache.commons.lang3.StringUtils.defaultString(dbName,
10240
10238
Warehouse.DEFAULT_DATABASE_NAME);
10241
10239
catName = normalizeIdentifier(catName);
10242
10240
if (tableName == null) {
10243
10241
throw new InvalidInputException("Table name is null.");
10244
10242
}
10243
+ // Note: this does not verify ACID state; called internally when removing cols/etc.
10244
+ // Also called via an unused metastore API that checks for ACID tables.
10245
+ MPartition mPartition = getMPartition(catName, dbName, tableName, partName);
10246
+ if (mPartition == null) {
10247
+ throw new NoSuchObjectException("Partition " + partName
10248
+ + " for which stats deletion is requested doesn't exist");
10249
+ }
10250
+
10251
+ return new GetHelper<Boolean>(catName, dbName, tableName, true, true) {
10252
+ @Override
10253
+ protected String describeResult() {
10254
+ return "delete prtition column stats";
10255
+ }
10256
+
10257
+ @Override
10258
+ protected Boolean getSqlResult(GetHelper<Boolean> ctx) throws MetaException {
10259
+ return directSql.deletePartitionColumnStats(catName, dbName, tableName, partName, colName, engine);
10260
+ }
10261
+
10262
+ @Override
10263
+ protected Boolean getJdoResult(GetHelper<Boolean> ctx)
10264
+ throws MetaException, NoSuchObjectException, InvalidObjectException {
10265
+ return deletePartitionColumnStatisticsVisJDO(catName, dbName, tableName, partName, colName, engine);
10266
+ }
10267
+ }.run(false);
10268
+ }
10269
+
10270
+ private boolean deletePartitionColumnStatisticsVisJDO(String catName, String dbName, String tableName,
10271
+ String partName, String colName, String engine) throws NoSuchObjectException {
10272
+ boolean ret = false;
10273
+ Query query = null;
10245
10274
try {
10246
10275
openTransaction();
10247
- MTable mTable = getMTable(catName, dbName, tableName);
10248
10276
MPartitionColumnStatistics mStatsObj;
10249
10277
List<MPartitionColumnStatistics> mStatsObjColl;
10250
- if (mTable == null) {
10251
- throw new NoSuchObjectException("Table " + tableName
10252
- + " for which stats deletion is requested doesn't exist");
10253
- }
10254
- // Note: this does not verify ACID state; called internally when removing cols/etc.
10255
- // Also called via an unused metastore API that checks for ACID tables.
10256
- MPartition mPartition = getMPartition(catName, dbName, tableName, partVals, mTable);
10257
- if (mPartition == null) {
10258
- throw new NoSuchObjectException("Partition " + partName
10259
- + " for which stats deletion is requested doesn't exist");
10260
- }
10261
10278
query = pm.newQuery(MPartitionColumnStatistics.class);
10262
10279
String filter;
10263
10280
String parameters;
@@ -10334,25 +10351,42 @@ public boolean deletePartitionColumnStatistics(String catName, String dbName, St
10334
10351
public boolean deleteTableColumnStatistics(String catName, String dbName, String tableName,
10335
10352
String colName, String engine)
10336
10353
throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
10337
- boolean ret = false;
10338
- Query query = null;
10339
10354
dbName = org.apache.commons.lang3.StringUtils.defaultString(dbName,
10340
10355
Warehouse.DEFAULT_DATABASE_NAME);
10341
10356
if (tableName == null) {
10342
10357
throw new InvalidInputException("Table name is null.");
10343
10358
}
10359
+
10360
+ // Note: this does not verify ACID state; called internally when removing cols/etc.
10361
+ // Also called via an unused metastore API that checks for ACID tables.
10362
+ return new GetHelper<Boolean>(catName, dbName, tableName, true, true) {
10363
+
10364
+ @Override
10365
+ protected String describeResult() {
10366
+ return "delete table column stats";
10367
+ }
10368
+
10369
+ @Override
10370
+ protected Boolean getSqlResult(GetHelper<Boolean> ctx) throws MetaException {
10371
+ return directSql.deleteTableColumnStatistics(getTable().getId(), colName, engine);
10372
+ }
10373
+
10374
+ @Override
10375
+ protected Boolean getJdoResult(GetHelper<Boolean> ctx)
10376
+ throws MetaException, NoSuchObjectException, InvalidObjectException {
10377
+ return deleteTableColumnStatisticsViaJdo(catName, dbName, tableName, colName, engine);
10378
+ }
10379
+ }.run(true);
10380
+ }
10381
+
10382
+ private boolean deleteTableColumnStatisticsViaJdo(String catName, String dbName, String tableName,
10383
+ String colName, String engine) throws NoSuchObjectException {
10384
+ boolean ret = false;
10385
+ Query query = null;
10344
10386
try {
10345
10387
openTransaction();
10346
- MTable mTable = getMTable(catName, dbName, tableName);
10347
10388
MTableColumnStatistics mStatsObj;
10348
10389
List<MTableColumnStatistics> mStatsObjColl;
10349
- if (mTable == null) {
10350
- throw new NoSuchObjectException("Table " +
10351
- TableName.getQualified(catName, dbName, tableName)
10352
- + " for which stats deletion is requested doesn't exist");
10353
- }
10354
- // Note: this does not verify ACID state; called internally when removing cols/etc.
10355
- // Also called via an unused metastore API that checks for ACID tables.
10356
10390
query = pm.newQuery(MTableColumnStatistics.class);
10357
10391
String filter;
10358
10392
String parameters;
0 commit comments