-
Notifications
You must be signed in to change notification settings - Fork 277
BloomFilter v2 support #14406
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
base: main
Are you sure you want to change the base?
BloomFilter v2 support #14406
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * Copyright (c) 2026, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /*** spark-rapids-shim-json-lines | ||
| {"spark": "330"} | ||
| {"spark": "330db"} | ||
| {"spark": "331"} | ||
| {"spark": "332"} | ||
| {"spark": "332db"} | ||
| {"spark": "333"} | ||
| {"spark": "334"} | ||
| {"spark": "340"} | ||
| {"spark": "341"} | ||
| {"spark": "341db"} | ||
| {"spark": "342"} | ||
| {"spark": "343"} | ||
| {"spark": "344"} | ||
| {"spark": "350"} | ||
| {"spark": "350db143"} | ||
| {"spark": "351"} | ||
| {"spark": "352"} | ||
| {"spark": "353"} | ||
| {"spark": "354"} | ||
| {"spark": "355"} | ||
| {"spark": "356"} | ||
| {"spark": "357"} | ||
| {"spark": "358"} | ||
| {"spark": "400"} | ||
| {"spark": "401"} | ||
| {"spark": "402"} | ||
| spark-rapids-shim-json-lines ***/ | ||
| package com.nvidia.spark.rapids.shims | ||
|
|
||
| object BloomFilterConstantsShims { | ||
| val BLOOM_FILTER_FORMAT_VERSION: Int = 1 | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,7 +59,9 @@ import org.apache.spark.sql.types.{BinaryType, DataType} | |||||||||
| case class GpuBloomFilterAggregate( | ||||||||||
| child: Expression, | ||||||||||
| estimatedNumItemsRequested: Long, | ||||||||||
| numBitsRequested: Long) extends GpuAggregateFunction { | ||||||||||
| numBitsRequested: Long, | ||||||||||
| version: Int = BloomFilter.VERSION_2, | ||||||||||
| seed: Int = BloomFilter.DEFAULT_SEED) extends GpuAggregateFunction { | ||||||||||
|
Comment on lines
+63
to
+64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default version parameter targets wrong format for pre-4.11 shims The default value for While all current production paths go through
Suggested change
|
||||||||||
|
|
||||||||||
| override def nullable: Boolean = true | ||||||||||
|
|
||||||||||
|
|
@@ -81,7 +83,8 @@ case class GpuBloomFilterAggregate( | |||||||||
|
|
||||||||||
| override val inputProjection: Seq[Expression] = Seq(child) | ||||||||||
|
|
||||||||||
| override val updateAggregates: Seq[CudfAggregate] = Seq(GpuBloomFilterUpdate(numHashes, numBits)) | ||||||||||
| override val updateAggregates: Seq[CudfAggregate] = | ||||||||||
| Seq(GpuBloomFilterUpdate(numHashes, numBits, version, seed)) | ||||||||||
|
|
||||||||||
| override val mergeAggregates: Seq[CudfAggregate] = Seq(GpuBloomFilterMerge()) | ||||||||||
|
|
||||||||||
|
|
@@ -110,9 +113,13 @@ object GpuBloomFilterAggregate { | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| case class GpuBloomFilterUpdate(numHashes: Int, numBits: Long) extends CudfAggregate { | ||||||||||
| case class GpuBloomFilterUpdate( | ||||||||||
| numHashes: Int, | ||||||||||
| numBits: Long, | ||||||||||
| version: Int, | ||||||||||
| seed: Int) extends CudfAggregate { | ||||||||||
| override val reductionAggregate: ColumnVector => Scalar = (col: ColumnVector) => { | ||||||||||
| closeOnExcept(BloomFilter.create(numHashes, numBits)) { bloomFilter => | ||||||||||
| closeOnExcept(BloomFilter.create(version, numHashes, numBits, seed)) { bloomFilter => | ||||||||||
| BloomFilter.put(bloomFilter, col) | ||||||||||
| bloomFilter | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * Copyright (c) 2026, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /*** spark-rapids-shim-json-lines | ||
| {"spark": "411"} | ||
| spark-rapids-shim-json-lines ***/ | ||
| package com.nvidia.spark.rapids.shims | ||
|
|
||
| object BloomFilterConstantsShims { | ||
| val BLOOM_FILTER_FORMAT_VERSION: Int = 2 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at end of file
Both new
BloomFilterConstantsShims.scalafiles (spark330 and spark411) are missing a trailing newline. This can cause issues with certain tools and doesn't follow standard POSIX text file convention. Please add a newline after the closing brace.The same applies to
sql-plugin/src/main/spark411/scala/com/nvidia/spark/rapids/shims/BloomFilterConstantsShims.scalaat line 24.