} else if (from != i) { ColumnStatisticsDesc csd = new ColumnStatisticsDesc(false, dbName, tableName); csd.setCatName(catName); csd.setPartName(lastPartName); result.add(makeColumnStats(list.subList(from, i), csd, 1));
csd.setCatName(catName); ColumnStatistics result = makeColumnStats(list, csd, 0); b.closeAllQueries();
private ColumnStatistics buildStatsForOneTableOrPartition(String catName, String dbName, String tableName, String partName, Collection<Column> cols) { ColumnStatisticsDesc desc = new ColumnStatisticsDesc(partName == null, dbName, tableName); if (!NO_CAT.equals(catName)) desc.setCatName(catName); if (partName != null) desc.setPartName(partName); List<ColumnStatisticsObj> objs = new ArrayList<>(cols.size()); for (Column col : cols) objs.add(col.generate()); return new ColumnStatistics(desc, objs); }
@Override public boolean setPartitionColumnStatistics(SetPartitionsStatsRequest request) throws TException { String defaultCat = getDefaultCatalog(conf); for (ColumnStatistics stats : request.getColStats()) { if (!stats.getStatsDesc().isSetCatName()) { stats.getStatsDesc().setCatName(defaultCat); } } return client.set_aggr_stats_for(request); }
private void normalizeColStatsInput(ColumnStatistics colStats) throws MetaException { // TODO: is this really needed? this code is propagated from HIVE-1362 but most of it is useless. ColumnStatisticsDesc statsDesc = colStats.getStatsDesc(); statsDesc.setCatName(statsDesc.isSetCatName() ? statsDesc.getCatName().toLowerCase() : getDefaultCatalog(conf)); statsDesc.setDbName(statsDesc.getDbName().toLowerCase()); statsDesc.setTableName(statsDesc.getTableName().toLowerCase()); statsDesc.setPartName(lowerCaseConvertPartName(statsDesc.getPartName())); long time = System.currentTimeMillis() / 1000; statsDesc.setLastAnalyzed(time); for (ColumnStatisticsObj statsObj : colStats.getStatsObj()) { statsObj.setColName(statsObj.getColName().toLowerCase()); statsObj.setColType(statsObj.getColType().toLowerCase()); } colStats.setStatsDesc(statsDesc); colStats.setStatsObj(colStats.getStatsObj()); }
public static ColumnStatisticsDesc getTableColumnStatisticsDesc( MTableColumnStatistics mStatsObj) { ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(); statsDesc.setIsTblLevel(true); statsDesc.setCatName(mStatsObj.getCatName()); statsDesc.setDbName(mStatsObj.getDbName()); statsDesc.setTableName(mStatsObj.getTableName()); statsDesc.setLastAnalyzed(mStatsObj.getLastAnalyzed()); return statsDesc; }
/** {@inheritDoc} */ @Override public boolean updateTableColumnStatistics(ColumnStatistics statsObj) throws TException { if (!statsObj.getStatsDesc().isSetCatName()) { statsObj.getStatsDesc().setCatName(getDefaultCatalog(conf)); } // Note: currently this method doesn't set txn properties and thus won't work on txn tables. SetPartitionsStatsRequest req = new SetPartitionsStatsRequest(); req.addToColStats(statsObj); req.setNeedMerge(false); return client.update_table_column_statistics_req(req).isResult(); }
@Override public boolean updatePartitionColumnStatistics(ColumnStatistics statsObj) throws TException { if (!statsObj.getStatsDesc().isSetCatName()) { statsObj.getStatsDesc().setCatName(getDefaultCatalog(conf)); } // Note: currently this method doesn't set txn properties and thus won't work on txn tables. SetPartitionsStatsRequest req = new SetPartitionsStatsRequest(); req.addToColStats(statsObj); req.setNeedMerge(false); return client.update_partition_column_statistics_req(req).isResult(); }
public static ColumnStatisticsDesc getPartitionColumnStatisticsDesc( MPartitionColumnStatistics mStatsObj) { ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(); statsDesc.setIsTblLevel(false); statsDesc.setCatName(mStatsObj.getCatName()); statsDesc.setDbName(mStatsObj.getDbName()); statsDesc.setTableName(mStatsObj.getTableName()); statsDesc.setPartName(mStatsObj.getPartitionName()); statsDesc.setLastAnalyzed(mStatsObj.getLastAnalyzed()); return statsDesc; }
unsetCatName(); } else { setCatName((String)value);
colStatsDesc.setCatName(tbl.getCatName()); colStatsDesc.setDbName(getTableName()); colStatsDesc.setDbName(getDatabaseName());
ColumnStatistics stats = new ColumnStatistics(); ColumnStatisticsDesc desc = new ColumnStatisticsDesc(); desc.setCatName(tbl1.getCatName()); desc.setDbName(tbl1.getDbName()); desc.setTableName(tbl1.getTableName());
tableName = statsDesc.getTableName().toLowerCase(); statsDesc.setCatName(catName); statsDesc.setDbName(dbName); statsDesc.setTableName(tableName);
partName = lowerCaseConvertPartName(statsDesc.getPartName()); statsDesc.setCatName(catName); statsDesc.setDbName(dbName); statsDesc.setTableName(tableName);