Skip to content

Commit 8cf5362

Browse files
authored
[auto-merge] release/26.08 to main [skip ci] [bot] (NVIDIA#15482)
auto-merge triggered by github actions on `release/26.08` to create a PR keeping `main` up-to-date. If this PR is unable to be merged due to conflicts, it will remain open until manually fix.
2 parents 6e4f046 + a2c2b6a commit 8cf5362

2 files changed

Lines changed: 54 additions & 17 deletions

File tree

integration_tests/src/main/python/delta_lake_test.py

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from parquet_test_utils import parquet_row_group_midpoints
2424
from spark_session import with_cpu_session, with_gpu_session, is_databricks_runtime, \
2525
is_spark_320_or_later, is_spark_340_or_later, supports_delta_lake_deletion_vectors, is_spark_401_or_later, \
26-
is_before_spark_353, is_databricks173_or_later
26+
gpu_supports_delta_dv_scan, is_before_spark_353, is_databricks173_or_later
2727

2828
_conf = {'spark.rapids.sql.explain': 'ALL'}
2929

@@ -198,15 +198,8 @@ def test_delta_deletion_vector_read(spark_tmp_path, chunk_size, use_cdf, dv_pred
198198
cdf_fallback = ["RowDataSourceScanExec"]
199199

200200

201-
@allow_non_gpu(*cdf_fallback, *delta_meta_allow)
202-
@delta_lake
203-
@ignore_order(local=True)
204-
@pytest.mark.parametrize("chunk_size", ["2000", "4000", None], ids=idfn)
205-
@pytest.mark.parametrize("parquet_reader_type", ["PERFILE", "COALESCING", "MULTITHREADED"], ids=idfn)
206-
@pytest.mark.skipif(not supports_delta_lake_deletion_vectors(),
207-
reason="Delta Lake deletion vector support is required")
208-
@pytest.mark.skipif(is_databricks_runtime(), reason="https://github.com/NVIDIA/cudf-spark/issues/15365")
209-
def test_delta_deletion_vector_read_with_cdf(spark_tmp_path, chunk_size, parquet_reader_type):
201+
def _test_delta_deletion_vector_read_with_cdf(
202+
spark_tmp_path, chunk_size, parquet_reader_type, expect_fallback):
210203
data_path = spark_tmp_path + "/DELTA_DATA"
211204
conf = {"spark.databricks.delta.delete.deletionVectors.persistent": "true",
212205
"spark.rapids.sql.reader.chunked": f"{chunk_size is not None}",
@@ -220,10 +213,46 @@ def test_delta_deletion_vector_read_with_cdf(spark_tmp_path, chunk_size, parquet
220213
"DELETE FROM delta.`{}` WHERE a = 1".format(data_path)
221214
])
222215

223-
assert_gpu_and_cpu_are_equal_collect(
224-
lambda spark: read_delta_path_with_cdf(spark, data_path),
225-
conf=conf
226-
)
216+
def read_cdf(spark):
217+
return read_delta_path_with_cdf(spark, data_path)
218+
219+
if expect_fallback:
220+
# DeltaCDFRelation hides its internal file scan behind this V1 CPU scan.
221+
assert_gpu_fallback_collect(
222+
read_cdf,
223+
"RowDataSourceScanExec",
224+
conf=conf)
225+
else:
226+
assert_gpu_and_cpu_are_equal_collect(read_cdf, conf=conf)
227+
228+
229+
@allow_non_gpu(*cdf_fallback, *delta_meta_allow)
230+
@delta_lake
231+
@ignore_order(local=True)
232+
@pytest.mark.parametrize("chunk_size", ["2000", "4000", None], ids=idfn)
233+
@pytest.mark.parametrize("parquet_reader_type", ["PERFILE", "COALESCING", "MULTITHREADED"], ids=idfn)
234+
@pytest.mark.skipif(not gpu_supports_delta_dv_scan(),
235+
reason="GPU Delta deletion vector scan support is required")
236+
@pytest.mark.skipif(is_databricks_runtime(), reason="https://github.com/NVIDIA/cudf-spark/issues/15365")
237+
def test_delta_deletion_vector_read_with_cdf(spark_tmp_path, chunk_size, parquet_reader_type):
238+
_test_delta_deletion_vector_read_with_cdf(
239+
spark_tmp_path, chunk_size, parquet_reader_type, expect_fallback=False)
240+
241+
242+
@allow_non_gpu("ColumnarToRowExec", *cdf_fallback, *delta_meta_allow)
243+
@delta_lake
244+
@ignore_order(local=True)
245+
@pytest.mark.parametrize("chunk_size", ["2000", "4000", None], ids=idfn)
246+
@pytest.mark.parametrize("parquet_reader_type", ["PERFILE", "COALESCING", "MULTITHREADED"], ids=idfn)
247+
@pytest.mark.skipif(not supports_delta_lake_deletion_vectors(),
248+
reason="Delta Lake deletion vector feature is required")
249+
@pytest.mark.skipif(gpu_supports_delta_dv_scan(),
250+
reason="GPU Delta deletion vector scans are supported")
251+
@pytest.mark.skipif(is_databricks_runtime(), reason="https://github.com/NVIDIA/cudf-spark/issues/15365")
252+
def test_delta_deletion_vector_read_with_cdf_fallback(
253+
spark_tmp_path, chunk_size, parquet_reader_type):
254+
_test_delta_deletion_vector_read_with_cdf(
255+
spark_tmp_path, chunk_size, parquet_reader_type, expect_fallback=True)
227256

228257

229258
def _create_delta_cdf_mixed_filter_files(spark, data_path, second_file_partition):
@@ -591,10 +620,10 @@ def setup_tables(spark):
591620
conf=conf)
592621

593622

594-
@allow_non_gpu("FileSourceScanExec", "ColumnarToRowExec", *delta_meta_allow)
623+
@allow_non_gpu(*delta_meta_allow)
595624
@delta_lake
596-
@pytest.mark.skipif(not supports_delta_lake_deletion_vectors(),
597-
reason="Delta Lake deletion vector support is required")
625+
@pytest.mark.skipif(not gpu_supports_delta_dv_scan(),
626+
reason="GPU Delta deletion vector scan support is required")
598627
@pytest.mark.skipif(is_databricks_runtime(),
599628
reason="This test targets the OSS multithreaded Delta reader")
600629
def test_delta_deletion_vector_multithreaded_combine_count_star_mixed_dv_no_dv(

integration_tests/src/main/python/spark_session.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,19 @@ def is_databricks173_or_later():
335335
return is_databricks_version_or_later(17, 3)
336336

337337
def supports_delta_lake_deletion_vectors():
338+
"""Whether the current Delta Lake runtime provides the deletion-vector feature."""
338339
if is_databricks_runtime():
339340
return is_databricks122_or_later()
340341
else:
341342
return is_spark_340_or_later()
342343

344+
def gpu_supports_delta_dv_scan():
345+
"""Whether RAPIDS supports scanning Delta deletion vectors on the GPU."""
346+
if is_databricks_runtime():
347+
return is_databricks173_or_later()
348+
else:
349+
return is_spark_353_or_later()
350+
343351
def is_support_default_values_in_schema():
344352
# Spark 340 + and Databricks 330 + support
345353
return is_spark_340_or_later() or is_databricks113_or_later()

0 commit comments

Comments
 (0)