Skip to content

Commit

Permalink
feat: add ICEBERG format options (#2662)
Browse files Browse the repository at this point in the history
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)
  • Loading branch information
emkornfield committed Apr 27, 2023
1 parent 5c10a48 commit 55048ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class FormatOptions implements Serializable {
static final String GOOGLE_SHEETS = "GOOGLE_SHEETS";
static final String PARQUET = "PARQUET";
static final String ORC = "ORC";
static final String ICEBERG = "ICEBERG";

private static final long serialVersionUID = -443376052020423691L;

Expand Down Expand Up @@ -115,6 +116,11 @@ public static FormatOptions orc() {
return new FormatOptions(ORC);
}

/** Default options for the Apache Iceberg table format. */
public static FormatOptions iceberg() {
return new FormatOptions(ICEBERG);
}

/** Default options for the provided format. */
public static FormatOptions of(String format) {
checkArgument(!isNullOrEmpty(format), "Provided format is null or empty");
Expand All @@ -130,6 +136,8 @@ public static FormatOptions of(String format) {
return bigtable();
} else if (format.equals(PARQUET)) {
return parquet();
} else if (format.equals(ICEBERG)) {
return iceberg();
}
return new FormatOptions(format);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void testFactoryMethods() {
assertEquals(FormatOptions.DATASTORE_BACKUP, FormatOptions.datastoreBackup().getType());
assertEquals(FormatOptions.AVRO, FormatOptions.avro().getType());
assertEquals(FormatOptions.GOOGLE_SHEETS, FormatOptions.googleSheets().getType());
assertEquals(FormatOptions.ICEBERG, FormatOptions.iceberg().getType());
}

@Test
Expand All @@ -53,5 +54,6 @@ public void testEquals() {
assertEquals(
FormatOptions.datastoreBackup().hashCode(), FormatOptions.datastoreBackup().hashCode());
assertEquals(FormatOptions.googleSheets(), FormatOptions.googleSheets());
assertEquals(FormatOptions.iceberg(), FormatOptions.iceberg());
}
}

0 comments on commit 55048ca

Please sign in to comment.