Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#460][MINOR] docs: clarify deleteColumn doc (#497)

mchades4bcbfda34573
diff --git a/api/src/main/java/com/datastrato/graviton/rel/TableChange.java b/api/src/main/java/com/datastrato/graviton/rel/TableChange.java
index 88eb97e985..a775d03183 100644
--- a/api/src/main/java/com/datastrato/graviton/rel/TableChange.java
+++ b/api/src/main/java/com/datastrato/graviton/rel/TableChange.java
@@ -184,10 +184,12 @@ public interface TableChange {
/**
* 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, silence the error if column does not exist during drop. Otherwise, an
+ * {@link IllegalArgumentException} will be thrown.
* @return A TableChange for the delete.
*/
static TableChange deleteColumn(String[] fieldNames, Boolean ifExists) {
diff --git a/catalogs/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java b/catalogs/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java
index c67ecc95f1..3b819c5aaf 100644
--- a/catalogs/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java
+++ b/catalogs/catalog-hive/src/test/java/com/datastrato/graviton/catalog/hive/TestHiveTable.java
@@ -472,6 +472,12 @@ public class TestHiveTable extends MiniHiveMetastoreService {
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(