simhadri-g commented on code in PR #4431: URL: https://github.com/apache/hive/pull/4431#discussion_r1245089193
########## iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java: ########## @@ -429,45 +434,50 @@ public boolean setColStatistics(org.apache.hadoop.hive.ql.metadata.Table hmsTabl ImmutableMap.of())); writer.finish(); } catch (IOException e) { - LOG.error(String.valueOf(e)); + LOG.error("Unable to write stats to puffin file", e.getMessage()); } return false; } @Override public boolean canProvideColStatistics(org.apache.hadoop.hive.ql.metadata.Table hmsTable) { Table table = IcebergTableUtil.getTable(conf, hmsTable.getTTable()); - if (canSetColStatistics(hmsTable)) { - Path statsPath = getStatsPath(table); - try { - FileSystem fs = statsPath.getFileSystem(conf); - if (fs.exists(statsPath)) { - return true; - } - } catch (IOException e) { - LOG.warn("Exception when trying to find Iceberg column stats for table:{} , snapshot:{} , " + - "statsPath: {} , stack trace: {}", table.name(), table.currentSnapshot(), statsPath, e); + return canSetColStatistics(hmsTable) && canProvideColStatistics(table, table.currentSnapshot().snapshotId()); + } + + private boolean canProvideColStatistics(Table table, long snapshotId) { + Path statsPath = getStatsPath(table, snapshotId); + try { + FileSystem fs = statsPath.getFileSystem(conf); + if (fs.exists(statsPath)) { Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org