Skip to content

feat: add ICEBERG format options #2662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.12.0')
implementation platform('com.google.cloud:libraries-bom:26.13.0')

implementation 'com.google.cloud:google-cloud-bigquery'
```
Expand Down
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());
}
}