gaborkaszab commented on code in PR #6006:
URL: https://github.com/apache/iceberg/pull/6006#discussion_r1000814200
##########
core/src/main/java/org/apache/iceberg/RowLevelOperationMode.java:
##########
@@ -38,17 +38,28 @@
* during reads.
*/
public enum RowLevelOperationMode {
- COPY_ON_WRITE,
- MERGE_ON_READ;
+ COPY_ON_WRITE("copy-on-write"),
+ MERGE_ON_READ("merge-on-read");
+
+ private final String modeName;
+
+ RowLevelOperationMode(String modeName) {
+ this.modeName = modeName;
+ }
public static RowLevelOperationMode fromName(String modeName) {
Preconditions.checkArgument(modeName != null, "Mode name is null");
- if ("copy-on-write".equalsIgnoreCase(modeName)) {
+ if (COPY_ON_WRITE.toString().equalsIgnoreCase(modeName)) {
return COPY_ON_WRITE;
- } else if ("merge-on-read".equalsIgnoreCase(modeName)) {
+ } else if (MERGE_ON_READ.toString().equalsIgnoreCase(modeName)) {
return MERGE_ON_READ;
} else {
throw new IllegalArgumentException("Unknown row-level operation mode: "
+ modeName);
}
}
+
+ @Override
+ public String toString() {
Review Comment:
Thanks for the explanation! Sure, I added a modeName() function and dropped
toString().
##########
core/src/main/java/org/apache/iceberg/RowLevelOperationMode.java:
##########
@@ -38,17 +38,28 @@
* during reads.
*/
public enum RowLevelOperationMode {
- COPY_ON_WRITE,
- MERGE_ON_READ;
+ COPY_ON_WRITE("copy-on-write"),
+ MERGE_ON_READ("merge-on-read");
+
+ private final String modeName;
+
+ RowLevelOperationMode(String modeName) {
+ this.modeName = modeName;
+ }
public static RowLevelOperationMode fromName(String modeName) {
Preconditions.checkArgument(modeName != null, "Mode name is null");
- if ("copy-on-write".equalsIgnoreCase(modeName)) {
+ if (COPY_ON_WRITE.toString().equalsIgnoreCase(modeName)) {
return COPY_ON_WRITE;
- } else if ("merge-on-read".equalsIgnoreCase(modeName)) {
+ } else if (MERGE_ON_READ.toString().equalsIgnoreCase(modeName)) {
return MERGE_ON_READ;
} else {
throw new IllegalArgumentException("Unknown row-level operation mode: "
+ modeName);
}
}
+
+ @Override
+ public String toString() {
+ return this.modeName;
Review Comment:
sure, done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]