Skip to content

Commit 5fe990c

Browse files
BloomFilterMightContain Predicate Expression
1 parent 4e0fb05 commit 5fe990c

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed
Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,83 @@
1-
# BloomFilterMightContain Expression
1+
---
2+
title: BloomFilterMightContain
3+
---
4+
5+
# BloomFilterMightContain Predicate Expression
6+
7+
`BloomFilterMightContain` is a [Predicate](Predicate.md) that uses [BloomFilter](#bloomFilter) when executed ([evaluate](#eval) and [doGenCode](#doGenCode)) to [mightContainLong](../bloom-filter-join/BloomFilter.md#mightContainLong).
28

39
`BloomFilterMightContain` is a [BinaryExpression](Expression.md#BinaryExpression).
410

11+
??? note "`null` Result"
12+
`BloomFilterMightContain` returns `null` when executed and there is neither [BloomFilter](#bloomFilter) nor [value](#valueExpression) (for an [InternalRow](../InternalRow.md)) defined.
13+
514
## Creating Instance
615

716
`BloomFilterMightContain` takes the following to be created:
817

9-
* <span id="bloomFilterExpression"> Bloom Filter [Expression](Expression.md)
10-
* <span id="valueExpression"> Value [Expression](Expression.md)
18+
* [Bloom Filter Expression](#bloomFilterExpression)
19+
* [Value Expression](#valueExpression)
1120

1221
`BloomFilterMightContain` is created when:
1322

1423
* [InjectRuntimeFilter](../logical-optimizations/InjectRuntimeFilter.md) logical optimization is executed (and [injects a BloomFilter](../logical-optimizations/InjectRuntimeFilter.md#injectBloomFilter))
24+
25+
### Bloom Filter Expression { #bloomFilterExpression }
26+
27+
`BloomFilterMightContain` is given a Bloom Filter [Expression](Expression.md) when [created](#creating-instance).
28+
29+
The Bloom Filter expression is always a [ScalarSubquery](ScalarSubquery.md) expression over an [Aggregate](../logical-operators/Aggregate.md) logical operator.
30+
31+
The `Aggregate` logical operator is created as follows:
32+
33+
* No grouping (all rows are in the same group)
34+
* [BloomFilterAggregate](BloomFilterAggregate.md) as the aggregate function (with `XxHash64` child expression)
35+
36+
### Value Expression { #valueExpression }
37+
38+
`BloomFilterMightContain` is given a Value [Expression](Expression.md) when [created](#creating-instance).
39+
40+
The Value expression is always an `XxHash64` expression (of type `Long`).
41+
42+
!!! note "`null` Value"
43+
If the value evaluates to `null`, `BloomFilterMightContain` evaluates to `null` (in [eval](#eval) and [doGenCode](#doGenCode)).
44+
45+
## BloomFilter { #bloomFilter }
46+
47+
```scala
48+
bloomFilter: BloomFilter
49+
```
50+
51+
??? note "Lazy Value"
52+
`bloomFilter` is a Scala **lazy value** to guarantee that the code to initialize it is executed once only (when accessed for the first time) and the computed value never changes afterwards.
53+
54+
Learn more in the [Scala Language Specification]({{ scala.spec }}/05-classes-and-objects.html#lazy).
55+
56+
`bloomFilter` requests the [Bloom Filter Expression](#bloomFilterExpression) to [evaluate](Expression.md#eval) (that gives an `Array[Byte]`).
57+
58+
In the end, `bloomFilter` [deserializes](#deserialize) the bytes (to re-create a [BloomFilter](../bloom-filter-join/BloomFilter.md)).
59+
60+
!!! note
61+
If the `Array[Byte]` is `null` (undefined), `bloomFilter` is `null`.
62+
63+
---
64+
65+
`bloomFilter` is used when:
66+
67+
* `BloomFilterMightContain` is requested to [evaluate](#eval) and [doGenCode](#doGenCode)
68+
69+
## Pretty Name { #prettyName }
70+
71+
??? note "Expression"
72+
73+
```scala
74+
prettyName: String
75+
```
76+
77+
`prettyName` is part of the [Expression](Expression.md#prettyName) abstraction.
78+
79+
`prettyName` is the following text:
80+
81+
```text
82+
might_contain
83+
```

0 commit comments

Comments
 (0)