Skip to content
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
5 changes: 5 additions & 0 deletions docs/src/main/sphinx/connector/hive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ Property Name Description
Set to ``false`` to disable statistics. Disabling statistics
means that :doc:`/optimizer/cost-based-optimizations` can
not make smart decisions about the query plan.

``hive.auto-purge`` Set the default value for the auto_purge table property for ``false``
managed tables.
See the :ref:`hive_table_properties` for more information
on auto_purge.
================================================== ============================================================ ============

ORC format configuration properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public class HiveConfig

private boolean sizeBasedSplitWeightsEnabled = true;
private double minimumAssignedSplitWeight = 0.05;
private boolean autoPurge;

public boolean isSingleStatementWritesOnly()
{
Expand Down Expand Up @@ -1195,4 +1196,16 @@ public HiveConfig setDeltaLakeCatalogName(String deltaLakeCatalogName)
this.deltaLakeCatalogName = Optional.ofNullable(deltaLakeCatalogName);
return this;
}

public boolean isAutoPurge()
{
return this.autoPurge;
}

@Config("hive.auto-purge")
public HiveConfig setAutoPurge(boolean autoPurge)
{
this.autoPurge = autoPurge;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public HiveTableProperties(
stringProperty(CSV_QUOTE, "CSV quote character", null, false),
stringProperty(CSV_ESCAPE, "CSV escape character", null, false),
booleanProperty(TRANSACTIONAL, "Table is transactional", null, false),
booleanProperty(AUTO_PURGE, "Skip trash when table or partition is deleted", null, false));
booleanProperty(AUTO_PURGE, "Skip trash when table or partition is deleted", config.isAutoPurge(), false));
}

public List<PropertyMetadata<?>> getTableProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public void testDefaults()
.setIcebergCatalogName(null)
.setSizeBasedSplitWeightsEnabled(true)
.setMinimumAssignedSplitWeight(0.05)
.setDeltaLakeCatalogName(null));
.setDeltaLakeCatalogName(null)
.setAutoPurge(false));
}

@Test
Expand Down Expand Up @@ -194,6 +195,7 @@ public void testExplicitPropertyMappings()
.put("hive.size-based-split-weights-enabled", "false")
.put("hive.minimum-assigned-split-weight", "1.0")
.put("hive.delta-lake-catalog-name", "delta")
.put("hive.auto-purge", "true")
.buildOrThrow();

HiveConfig expected = new HiveConfig()
Expand Down Expand Up @@ -272,7 +274,8 @@ public void testExplicitPropertyMappings()
.setIcebergCatalogName("iceberg")
.setSizeBasedSplitWeightsEnabled(false)
.setMinimumAssignedSplitWeight(1.0)
.setDeltaLakeCatalogName("delta");
.setDeltaLakeCatalogName("delta")
.setAutoPurge(true);

assertFullMapping(properties, expected);
}
Expand Down