kbendick commented on a change in pull request #1427:
URL: https://github.com/apache/iceberg/pull/1427#discussion_r483928807
##########
File path: api/src/main/java/org/apache/iceberg/Files.java
##########
@@ -76,7 +75,7 @@ public PositionOutputStream create() {
public PositionOutputStream createOrOverwrite() {
if (file.exists()) {
if (!file.delete()) {
- throw new RuntimeIOException("Failed to delete: " + file);
+ throw new RuntimeIOException("Failed to delete: %s", file);
Review comment:
I believe that this is technically more performant as it does not
generate as many additional intermediary strings like the previous version,
which generated `"Failed to delete: "`, the string for `file` and then another
string for the final result (without using StringBuilder).
This case should generate one less string at runtime: the `file` string and
then the templated `Failed to delete: $file`. The format string would be a
compile time template if I'm not mistaken. Additionally, I believe the use of
the format string is lazily evaluated (so the string won't be created if the
exception is not thrown), but I might be mistaken on that part.
Probably the best answer / tldr is that it's better because the linting
automation enforces it currently and it brings standardization to the code base.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]