Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ abstract class DeltaProviderBase extends DeltaIOProvider {
dvFilterInput.copy(projectList = inputList.filterNot(_.name == "_metadata"))
.withNewChildren(Seq(
fsse.copy(
originalOutput =
fsse.originalOutput.filterNot(_.name == "_tmp_metadata_row_index"),
requiredSchema = StructType(
fsse.requiredSchema.filterNot(_.name == "_tmp_metadata_row_index")
))(fsse.rapidsConf)))))))
Expand Down
34 changes: 34 additions & 0 deletions integration_tests/src/main/python/delta_lake_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,37 @@ def convert_and_setup_name_mapping(spark):
with_cpu_session(setup_parquet_table, {"spark.sql.parquet.fieldId.write.enabled": str(enable_deletion_vectors).lower()})
with_cpu_session(convert_and_setup_name_mapping, conf={"spark.databricks.delta.properties.defaults.enableDeletionVectors": "false"})
assert_gpu_and_cpu_are_equal_collect(lambda spark: spark.read.format("delta").load(data_path))

@allow_non_gpu(*delta_meta_allow)
@delta_lake
@ignore_order(local=True)
@pytest.mark.skipif(not is_spark_340_or_later(), reason="Deletion Vectors only supported on Spark 3.4.0+")
def test_delta_partition_col_pruning(spark_tmp_path):
data_path = spark_tmp_path + "/DELTA_DATA"
from delta import DeltaTable
table_name = "pruning_test"
def setup_table(spark):
spark.sql(f"""
CREATE TABLE {table_name}
USING DELTA
LOCATION '{data_path}'
PARTITIONED BY (region)
TBLPROPERTIES ('delta.enableDeletionVectors' = 'true')

@gerashegalov gerashegalov Dec 11, 2025

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 is an internal example that is prone to a single record per file where DVs are not necessary upon delete since the whole file can be dropped.

Please use the more robust example for regression test. You can rewrite in SQL if you like

from delta import DeltaTable
spark.range(1000).withColumnRenamed('id', 'l_id').join(spark.range(10)).write.partitionBy('l_id').format('delta').option('delta.enableDeletionVectors', True).save('/tmp/range_dvp4')
dt = DeltaTable.forPath(spark, '/tmp/range_dvp4')
dt.delete('id = 1')
dt.toDF().explain()

AS SELECT id, city, temperature, region FROM VALUES
(1L, 'New York', 25.5D, 'AMER'),
(2L, 'Los Angeles', 28.0D, 'AMER'),
(3L, 'Chicago', 22.3D, 'AMER'),
(4L, 'Tokyo', 18.2D, 'APAC'),
(5L, 'Sydney', 24.1D, 'APAC'),
(6L, 'Seoul', 15.8D, 'APAC'),
(7L, 'Berlin', 12.8D, 'EMEA'),
(8L, 'Paris', 14.5D, 'EMEA'),
(9L, 'London', 11.2D, 'EMEA')
AS t(id, city, temperature, region)
""")
spark.sql(f"DELETE FROM {table_name} WHERE city IN ('Los Angeles', 'Sydney', 'Paris')")

def read_table(spark):
return spark.sql(f"SELECT * FROM {table_name} ORDER BY region, id")
with_cpu_session(setup_table)
assert_gpu_and_cpu_are_equal_collect(read_table)