public ColumnStatistics deepCopy() { return new ColumnStatistics(this); }
@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); }
/** * Performs a deep copy on <i>other</i>. */ public SetPartitionsStatsRequest(SetPartitionsStatsRequest other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetColStats()) { List<ColumnStatistics> __this__colStats = new ArrayList<ColumnStatistics>(other.colStats.size()); for (ColumnStatistics other_element : other.colStats) { __this__colStats.add(new ColumnStatistics(other_element)); } this.colStats = __this__colStats; } this.needMerge = other.needMerge; this.writeId = other.writeId; if (other.isSetValidWriteIdList()) { this.validWriteIdList = other.validWriteIdList; } }
@Override public void setPartitionColumnStatistics(String databaseName, String tableName, String partitionName, List<ColumnStatisticsObj> statistics) throws TException { ColumnStatisticsDesc statisticsDescription = new ColumnStatisticsDesc(false, databaseName, tableName); statisticsDescription.setPartName(partitionName); ColumnStatistics request = new ColumnStatistics(statisticsDescription, statistics); client.update_partition_column_statistics(request); }
if (isLast || !partName.equals(lastPartName)) { if (i != 0) { result.add(new ColumnStatistics(csd, curList));
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); }
for (int _i294 = 0; _i294 < _list292.size; ++_i294) _elem293 = new ColumnStatistics(); _elem293.read(iprot); struct.colStats.add(_elem293);
ColumnStatistics colStats = new ColumnStatistics(); colStats.setStatsDesc(statsDesc); colStats.setStatsObj(statsObjs);
private ColumnStatistics makeColumnStats( List<Object[]> list, ColumnStatisticsDesc csd, int offset) throws MetaException { ColumnStatistics result = new ColumnStatistics(); result.setStatsDesc(csd); List<ColumnStatisticsObj> csos = new ArrayList<ColumnStatisticsObj>(list.size()); for (Object[] row : list) { // LastAnalyzed is stored per column but thrift has it per several; // get the lowest for now as nobody actually uses this field. Object laObj = row[offset + 15]; if (laObj != null && (!csd.isSetLastAnalyzed() || csd.getLastAnalyzed() > MetastoreDirectSqlUtils .extractSqlLong(laObj))) { csd.setLastAnalyzed(MetastoreDirectSqlUtils.extractSqlLong(laObj)); } csos.add(prepareCSObj(row, offset)); Deadline.checkTimeout(); } result.setStatsObj(csos); return result; }
@Override protected ColumnStatistics getJdoResult( GetHelper<ColumnStatistics> ctx) throws MetaException { QueryWrapper queryWrapper = new QueryWrapper(); try { List<MTableColumnStatistics> mStats = getMTableColumnStatistics(getTable(), colNames, queryWrapper); if (mStats.isEmpty()) { return null; } // LastAnalyzed is stored per column, but thrift object has it per multiple columns. // Luckily, nobody actually uses it, so we will set to lowest value of all columns for now. ColumnStatisticsDesc desc = StatObjectConverter.getTableColumnStatisticsDesc(mStats.get(0)); List<ColumnStatisticsObj> statObjs = new ArrayList<>(mStats.size()); for (MTableColumnStatistics mStat : mStats) { if (desc.getLastAnalyzed() > mStat.getLastAnalyzed()) { desc.setLastAnalyzed(mStat.getLastAnalyzed()); } statObjs.add(StatObjectConverter.getTableColumnStatisticsObj(mStat, enableBitVector)); Deadline.checkTimeout(); } return new ColumnStatistics(desc, statObjs); } finally { queryWrapper.close(); } } }.run(true);
@Override public void read(org.apache.thrift.protocol.TProtocol prot, SetPartitionsStatsRequest struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { org.apache.thrift.protocol.TList _list297 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.colStats = new ArrayList<ColumnStatistics>(_list297.size); ColumnStatistics _elem298; for (int _i299 = 0; _i299 < _list297.size; ++_i299) { _elem298 = new ColumnStatistics(); _elem298.read(iprot); struct.colStats.add(_elem298); } } struct.setColStatsIsSet(true); BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.needMerge = iprot.readBool(); struct.setNeedMergeIsSet(true); } if (incoming.get(1)) { struct.writeId = iprot.readI64(); struct.setWriteIdIsSet(true); } if (incoming.get(2)) { struct.validWriteIdList = iprot.readString(); struct.setValidWriteIdListIsSet(true); } } }
ColumnStatistics colStats = new ColumnStatistics(); colStats.setStatsDesc(statsDesc); colStats.setStatsObj(statsObjs);
struct.colStats = new ColumnStatistics(); struct.colStats.read(iprot); struct.setColStatsIsSet(true);
@Override public ColumnStatistics getTableColumnStatistics( String catName, String dbName, String tblName, List<String> colNames, String validWriteIds) throws MetaException, NoSuchObjectException { catName = StringUtils.normalizeIdentifier(catName); dbName = StringUtils.normalizeIdentifier(dbName); tblName = StringUtils.normalizeIdentifier(tblName); if (!shouldCacheTable(catName, dbName, tblName)) { return rawStore.getTableColumnStatistics( catName, dbName, tblName, colNames, validWriteIds); } Table table = sharedCache.getTableFromCache(catName, dbName, tblName); if (table == null) { // The table is not yet loaded in cache return rawStore.getTableColumnStatistics( catName, dbName, tblName, colNames, validWriteIds); } ColumnStatisticsDesc csd = new ColumnStatisticsDesc(true, dbName, tblName); List<ColumnStatisticsObj> colStatObjs = sharedCache.getTableColStatsFromCache(catName, dbName, tblName, colNames); return adjustColStatForGet(table.getParameters(), table.getParameters(), new ColumnStatistics(csd, colStatObjs), table.getWriteId(), validWriteIds); }
cachedStore.addPartition(ptn2); ColumnStatistics stats = new ColumnStatistics(); ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(true, dbName, tblName); statsDesc.setPartName("col");
cachedStore.addPartition(ptn2); ColumnStatistics stats = new ColumnStatistics(); ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(true, dbName, tblName); statsDesc.setPartName("col");
part.setCatName(DEFAULT_CATALOG_NAME); store.addPartition(part); ColumnStatistics cs = new ColumnStatistics(); ColumnStatisticsDesc desc = new ColumnStatisticsDesc(false, dbName, tableName); desc.setLastAnalyzed(now);
cachedStore.addPartition(ptn2); ColumnStatistics stats = new ColumnStatistics(); ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(true, dbName, tblName); statsDesc.setPartName("col");
colStatsDesc.setTableName(tblDesc.getTableName()); colStatsDesc.setDbName(tblDesc.getDatabaseName()); partDesc.setColStats(new ColumnStatistics(colStatsDesc, colStats.getStatsObj()));
ColumnStatistics stats = new ColumnStatistics(); ColumnStatisticsDesc desc = new ColumnStatisticsDesc(); desc.setCatName(tbl1.getCatName());