Skip to content

feat: Upgrade iceberg-java to 1.9.2 and support adding required columns#145

Open
subkanthi wants to merge 17 commits into
masterfrom
iceberg_update_alter_table_null_default
Open

feat: Upgrade iceberg-java to 1.9.2 and support adding required columns#145
subkanthi wants to merge 17 commits into
masterfrom
iceberg_update_alter_table_null_default

Conversation

@subkanthi
Copy link
Copy Markdown
Collaborator

@subkanthi subkanthi commented Apr 23, 2026

  • Upgraded iceberg-java
  • Added support for nullable.

closes: #144

@subkanthi subkanthi marked this pull request as ready for review April 28, 2026 20:32
@subkanthi subkanthi requested a review from xieandrew May 8, 2026 19:29
@xieandrew xieandrew changed the title Upgraded iceberg-java to 1.9.2, upgrade overridden classes, added sup… feat: Upgrade iceberg-java to 1.9.2 and support adding required columns May 8, 2026
@xieandrew xieandrew added the ice Relates to ice label May 8, 2026
Copy link
Copy Markdown
Collaborator

@xieandrew xieandrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to address how to handle adding a required column on a table with existing data in AlterTable. Currently this leads to an invalid table.

}

String valuesSql =
"SELECT b_int, b_string, toString(b_date), formatDateTime(b_ts, '%Y-%m-%d %H:%m:%S') FROM `"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatDateTime is using the month %m twice instead of %M for the minute. It passes because the expected value below also has the month as the incorrect minute value.

if (!"2024-06-15".equals(cells[2])) {
throw new AssertionError("b_date: expected 2024-06-15, got " + cells[2]);
}
if (!"2024-06-15 12:06:45".equals(cells[3])) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After changing the formatDateTime in the SQL above, the time should be 12:30:45 to match the parquet input.

// primitives (date/time/timestamp/decimal/uuid/binary) we accept a string form and let
// Iceberg parse it via Literal<CharSequence>.to(type).
@Nullable
private static Literal<?> coerceDefault(Type type, @Nullable Object jsonValue) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method isn't called anywhere. What is its use?

Comment on lines +225 to +227
// Iceberg rejects required adds without an initial default unless incompatible
// changes are explicitly allowed (even for empty tables with a snapshot).
us.allowIncompatibleChanges();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this leads to an invalid state when you add a required column when the table is not empty. There's no initial default value being used, so this violates the required constraint. Doing ice scan on the table results in java.lang.IllegalArgumentException: Missing required field: extra at org.apache.iceberg.data.parquet.BaseParquetReaders$ReadBuilder.defaultReader(BaseParquetReaders.java:271) for the iris table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ice Relates to ice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ice add-column - ability to pass default values and set null/not-null

2 participants