Skip to content

Commit

Permalink
clarify deleteColumn doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mchades committed Oct 12, 2023
1 parent 7d87fd3 commit 6daf2cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,11 @@ static TableChange updateColumnPosition(String[] fieldNames, ColumnPosition newP
/**
* Create a TableChange for deleting a field.
*
* <p>If the field does not exist, the change will result in an {@link IllegalArgumentException}.
* <p>If the field does not exist, the change will result in an {@link IllegalArgumentException}
* unless {@code ifExists} is true.
*
* @param fieldNames Field names of the column to delete.
* @param ifExists Silence the error if column doesn't exist during drop.
* @param ifExists If true, the change will succeed even if the field does not exist.
* @return A TableChange for the delete.
*/
static TableChange deleteColumn(String[] fieldNames, Boolean ifExists) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ public void testAlterHiveTable() throws IOException {
Assertions.assertArrayEquals(expected, alteredTable.columns());

// test delete column change
hiveCatalog
.asTableCatalog()
.alterTable(
NameIdentifier.of(tableIdentifier.namespace(), "test_hive_table_new"),
TableChange.deleteColumn(new String[] {"not_exist_col"}, true));

hiveCatalog
.asTableCatalog()
.alterTable(
Expand Down

0 comments on commit 6daf2cc

Please sign in to comment.