Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to decompress snappy and zstd Parquet files via CPU [databricks] #11752

Merged
merged 9 commits into from
Nov 26, 2024
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
9 changes: 8 additions & 1 deletion integration_tests/src/main/python/parquet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,19 @@ def test_parquet_read_round_trip_binary_as_string(std_input_path, read_func, rea
@pytest.mark.parametrize('compress', parquet_compress_options)
@pytest.mark.parametrize('reader_confs', reader_opt_confs)
@pytest.mark.parametrize('v1_enabled_list', ["", "parquet"])
def test_parquet_compress_read_round_trip(spark_tmp_path, compress, v1_enabled_list, reader_confs):
@pytest.mark.parametrize('cpu_decompress', [True, False])
def test_parquet_compress_read_round_trip(spark_tmp_path, compress, v1_enabled_list, reader_confs, cpu_decompress):
data_path = spark_tmp_path + '/PARQUET_DATA'
with_cpu_session(
lambda spark : binary_op_df(spark, long_gen).write.parquet(data_path),
conf={'spark.sql.parquet.compression.codec': compress})
all_confs = copy_and_update(reader_confs, {'spark.sql.sources.useV1SourceList': v1_enabled_list})
if cpu_decompress:
all_confs = copy_and_update(all_confs, {
'spark.rapids.sql.format.parquet.decompressCpu' : 'true',
'spark.rapids.sql.format.parquet.decompressCpu.snappy' : 'true',
'spark.rapids.sql.format.parquet.decompressCpu.zstd' : 'true'
})
assert_gpu_and_cpu_are_equal_collect(
lambda spark : spark.read.parquet(data_path),
conf=all_confs)
Expand Down
2 changes: 2 additions & 0 deletions jenkins/databricks/install_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def define_deps(spark_version, scala_version):
f'{prefix_ws_sp_mvn_hadoop}--org.apache.avro--avro-mapred--org.apache.avro__avro-mapred__*.jar'),
Artifact('org.apache.avro', 'avro',
f'{prefix_ws_sp_mvn_hadoop}--org.apache.avro--avro--org.apache.avro__avro__*.jar'),
Artifact('com.github.luben', 'zstd-jni',
f'{prefix_ws_sp_mvn_hadoop}--com.github.luben--zstd-jni--com.github.luben__zstd-jni__*.jar'),
]

# Parquet
Expand Down
6 changes: 6 additions & 0 deletions scala2.13/shim-deps/databricks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@
<version>${spark.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>${spark.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-format</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions shim-deps/databricks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@
<version>${spark.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
<version>${spark.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-format</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import scala.collection.Seq;

import com.nvidia.spark.rapids.CpuCompressionConfig$;
import com.nvidia.spark.rapids.DateTimeRebaseCorrected$;
import com.nvidia.spark.rapids.GpuMetric;
import com.nvidia.spark.rapids.GpuParquetUtils;
Expand Down Expand Up @@ -144,6 +145,7 @@ public org.apache.iceberg.io.CloseableIterator<ColumnarBatch> iterator() {
partReaderSparkSchema, debugDumpPrefix, debugDumpAlways,
maxBatchSizeRows, maxBatchSizeBytes, targetBatchSizeBytes, useChunkedReader,
maxChunkedReaderMemoryUsageSizeBytes,
CpuCompressionConfig$.MODULE$.disabled(),
metrics,
DateTimeRebaseCorrected$.MODULE$, // dateRebaseMode
DateTimeRebaseCorrected$.MODULE$, // timestampRebaseMode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,8 @@ protected FilePartitionReaderBase createRapidsReader(PartitionedFile[] pFiles,
return new MultiFileCloudParquetPartitionReader(conf, pFiles,
this::filterParquetBlocks, caseSensitive, parquetDebugDumpPrefix, parquetDebugDumpAlways,
maxBatchSizeRows, maxBatchSizeBytes, targetBatchSizeBytes, maxGpuColumnSizeBytes,
useChunkedReader, maxChunkedReaderMemoryUsageSizeBytes, metrics, partitionSchema,
useChunkedReader, maxChunkedReaderMemoryUsageSizeBytes,
CpuCompressionConfig$.MODULE$.disabled(), metrics, partitionSchema,
numThreads, maxNumFileProcessed,
false, // ignoreMissingFiles
false, // ignoreCorruptFiles
Expand Down Expand Up @@ -411,7 +412,7 @@ protected FilePartitionReaderBase createRapidsReader(PartitionedFile[] pFiles,
JavaConverters.asJavaCollection(filteredInfo.parquetBlockMeta.blocks()).stream()
.map(b -> ParquetSingleDataBlockMeta.apply(
filteredInfo.parquetBlockMeta.filePath(),
ParquetDataBlock.apply(b),
ParquetDataBlock.apply(b, CpuCompressionConfig$.MODULE$.disabled()),
InternalRow.empty(),
ParquetSchemaWrapper.apply(filteredInfo.parquetBlockMeta.schema()),
filteredInfo.parquetBlockMeta.readSchema(),
Expand All @@ -431,6 +432,7 @@ protected FilePartitionReaderBase createRapidsReader(PartitionedFile[] pFiles,
caseSensitive, parquetDebugDumpPrefix, parquetDebugDumpAlways,
maxBatchSizeRows, maxBatchSizeBytes, targetBatchSizeBytes, maxGpuColumnSizeBytes,
useChunkedReader, maxChunkedReaderMemoryUsageSizeBytes,
CpuCompressionConfig$.MODULE$.disabled(),
metrics, partitionSchema, numThreads,
false, // ignoreMissingFiles
false, // ignoreCorruptFiles
Expand Down
Loading