private void setColumnStatistics(TableName tableName, TableStatistics tableStatistics, Table table, Predicate<FieldSchema> fieldsPredicate) throws TException { ColumnStatisticsDesc hiveColumnStatisticsDesc = new ColumnStatisticsDesc(); hiveColumnStatisticsDesc.setIsTblLevel(false); hiveColumnStatisticsDesc.setDbName(getSchema(tableName)); hiveColumnStatisticsDesc.setTableName(tableName.getSchemalessNameInDatabase()); List<ColumnStatisticsObj> hiveColumnStatisticsObjs = table.getSd().getCols().stream() .filter(fieldsPredicate) .map(fieldSchema -> toHiveColumnStatistics(fieldSchema, tableStatistics.getColumns().get(fieldSchema.getName()))) .collect(toList()); org.apache.hadoop.hive.metastore.api.ColumnStatistics hiveColumnStatistics = new org.apache.hadoop.hive.metastore.api.ColumnStatistics(); hiveColumnStatistics.setStatsDesc(hiveColumnStatisticsDesc); hiveColumnStatistics.setStatsObj(hiveColumnStatisticsObjs); client.update_table_column_statistics(hiveColumnStatistics); }
private void setColumnStatistics(TableName tableName, TableStatistics tableStatistics, Table table, Predicate<FieldSchema> fieldsPredicate) throws TException { ColumnStatisticsDesc hiveColumnStatisticsDesc = new ColumnStatisticsDesc(); hiveColumnStatisticsDesc.setIsTblLevel(false); hiveColumnStatisticsDesc.setDbName(getSchema(tableName)); hiveColumnStatisticsDesc.setTableName(tableName.getSchemalessNameInDatabase()); List<ColumnStatisticsObj> hiveColumnStatisticsObjs = table.getSd().getCols().stream() .filter(fieldsPredicate) .map(fieldSchema -> toHiveColumnStatistics(fieldSchema, tableStatistics.getColumns().get(fieldSchema.getName()))) .collect(toList()); org.apache.hadoop.hive.metastore.api.ColumnStatistics hiveColumnStatistics = new org.apache.hadoop.hive.metastore.api.ColumnStatistics(); hiveColumnStatistics.setStatsDesc(hiveColumnStatisticsDesc); hiveColumnStatistics.setStatsObj(hiveColumnStatisticsObjs); client.update_table_column_statistics(hiveColumnStatistics); }
@Override public void setTableColumnStatistics(String databaseName, String tableName, List<ColumnStatisticsObj> statistics) throws TException { ColumnStatisticsDesc statisticsDescription = new ColumnStatisticsDesc(true, databaseName, tableName); ColumnStatistics request = new ColumnStatistics(statisticsDescription, statistics); client.update_table_column_statistics(request); }
@Override public void setTableColumnStatistics(String databaseName, String tableName, List<ColumnStatisticsObj> statistics) throws TException { ColumnStatisticsDesc statisticsDescription = new ColumnStatisticsDesc(true, databaseName, tableName); ColumnStatistics request = new ColumnStatistics(statisticsDescription, statistics); client.update_table_column_statistics(request); }