private void writeMTableColumnStatistics(Table table, MTableColumnStatistics mStatsObj, MTableColumnStatistics oldStats) throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException { String colName = mStatsObj.getColName(); QueryWrapper queryWrapper = new QueryWrapper(); try { LOG.info("Updating table level column statistics for table={}" + " colName={}", Warehouse.getCatalogQualifiedTableName(table), colName); validateTableCols(table, Lists.newArrayList(colName)); if (oldStats != null) { StatObjectConverter.setFieldsIntoOldStats(mStatsObj, oldStats); } else { if (sqlGenerator.getDbProduct().equals(DatabaseProduct.POSTGRES) && mStatsObj.getBitVector() == null) { // workaround for DN bug in persisting nulls in pg bytea column // instead set empty bit vector with header. mStatsObj.setBitVector(new byte[] {'H','L'}); } pm.makePersistent(mStatsObj); } } finally { queryWrapper.close(); } }
oldStatsObj.setBitVector(mStatsObj.getBitVector());
private void writeMTableColumnStatistics(Table table, MTableColumnStatistics mStatsObj, MTableColumnStatistics oldStats) throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException { String colName = mStatsObj.getColName(); QueryWrapper queryWrapper = new QueryWrapper(); try { LOG.info("Updating table level column statistics for table={}" + " colName={}", getCatalogQualifiedTableName(table), colName); validateTableCols(table, Lists.newArrayList(colName)); if (oldStats != null) { StatObjectConverter.setFieldsIntoOldStats(mStatsObj, oldStats); } else { if (sqlGenerator.getDbProduct().equals(DatabaseProduct.POSTGRES) && mStatsObj.getBitVector() == null) { // workaround for DN bug in persisting nulls in pg bytea column // instead set empty bit vector with header. mStatsObj.setBitVector(new byte[] {'H','L'}); } pm.makePersistent(mStatsObj); } } finally { queryWrapper.close(); } }