Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIVE-28655: Implement HMS Related Drop Stats Changes #5578

Merged
merged 4 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,13 @@ public boolean deleteTableColumnStatistics(String catName, String dbName, String
return objectStore.deleteTableColumnStatistics(catName, dbName, tableName, colName, engine);
}

@Override
public boolean deleteTableColumnStatistics(String catName, String dbName, String tableName,
List<String> colNames, String engine)
throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
return objectStore.deleteTableColumnStatistics(catName, dbName, tableName, colNames, engine);
}

@Override
public boolean deletePartitionColumnStatistics(String catName, String dbName, String tableName,
String partName, List<String> partVals, String colName, String engine)
Expand All @@ -886,6 +893,13 @@ public boolean deletePartitionColumnStatistics(String catName, String dbName, St
partVals, colName, engine);
}

@Override
public boolean deletePartitionColumnStatistics(String catName, String dbName, String tableName,
List<String> partNames, List<String> colNames, String engine)
throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
return objectStore.deletePartitionColumnStatistics(catName, dbName, tableName, partNames, colNames, engine);
}

@Override
public Map<String, String> updateTableColumnStatistics(ColumnStatistics statsObj, String validWriteIds, long writeId)
throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.apache.commons.lang3.tuple.Pair;

import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -60,6 +62,7 @@
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj;
import org.apache.hadoop.hive.metastore.api.CreateTableRequest;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.DeleteColumnStatisticsRequest;
import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.ForeignKeysRequest;
Expand Down Expand Up @@ -576,12 +579,26 @@ public List<ColumnStatisticsObj> getTableColumnStatistics(String dbName, String

/** {@inheritDoc} */
@Override
public boolean deleteTableColumnStatistics(String dbName, String tableName, String colName, String engine)
throws TException {
if (getTempTable(dbName, tableName) != null) {
return deleteTempTableColumnStats(dbName, tableName, colName);
public boolean deleteColumnStatistics(DeleteColumnStatisticsRequest req) throws TException {
String dbName = req.getDb_name();
String tableName = req.getTbl_name();
org.apache.hadoop.hive.metastore.api.Table table;
if ((table = getTempTable(dbName, tableName)) != null) {
List<String> colNames = req.getCol_names();
if (table.getPartitionKeysSize() == 0) {
if (colNames == null || colNames.isEmpty()) {
colNames = table.getSd().getCols().stream().map(FieldSchema::getName)
.collect(Collectors.toList());
}
for (String colName : colNames) {
deleteTempTableColumnStats(dbName, tableName, colName);
}
} else {
throw new UnsupportedOperationException("Not implemented yet");
}
return true;
}
return super.deleteTableColumnStatistics(dbName, tableName, colName, engine);
return super.deleteColumnStatistics(req);
}

private void createTempTable(org.apache.hadoop.hive.metastore.api.Table tbl) throws TException {
Expand Down
Loading
Loading