Skip to content

Commit a837998

Browse files
xiaoxmengmeta-codesync[bot]
authored andcommitted
refactor: Minor index filter code cleanup (#403)
Summary: Pull Request resolved: #403 Reviewed By: zacw7 Differential Revision: D90066803 fbshipit-source-id: 6bc98411e93d5bffc5faf6a8497d2c98b1ccc39f
1 parent 843695b commit a837998

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

dwio/nimble/index/IndexFilter.cpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ struct FilterBoundInfo {
3535
// Point lookups allow continuing to the next index column.
3636
// Range scans must be the terminal column.
3737
bool pointLookup{false};
38-
39-
// Whether the filter can be removed after applying index filtering.
40-
bool canRemoveFilter{false};
4138
};
4239

4340
// Check if a filter is convertible and whether it's a point lookup.
@@ -52,7 +49,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
5249
const auto& range = *filter.as<BigintRange>();
5350
info.convertible = true;
5451
info.pointLookup = range.isSingleValue();
55-
info.canRemoveFilter = true;
5652
break;
5753
}
5854

@@ -69,7 +65,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
6965
info.pointLookup = !range.lowerUnbounded() && !range.upperUnbounded() &&
7066
range.lower() == range.upper() && !range.lowerExclusive() &&
7167
!range.upperExclusive();
72-
info.canRemoveFilter = true;
7368
break;
7469
}
7570

@@ -85,7 +80,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
8580
info.pointLookup = !range.lowerUnbounded() && !range.upperUnbounded() &&
8681
range.lower() == range.upper() && !range.lowerExclusive() &&
8782
!range.upperExclusive();
88-
info.canRemoveFilter = true;
8983
break;
9084
}
9185

@@ -99,7 +93,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
9993
}
10094
info.convertible = true;
10195
info.pointLookup = range.isSingleValue();
102-
info.canRemoveFilter = true;
10396
break;
10497
}
10598

@@ -114,7 +107,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
114107
}
115108
info.convertible = true;
116109
info.pointLookup = true;
117-
info.canRemoveFilter = true;
118110
break;
119111
}
120112

@@ -124,7 +116,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
124116
}
125117
info.convertible = true;
126118
info.pointLookup = true;
127-
info.canRemoveFilter = true;
128119
break;
129120
}
130121

@@ -135,7 +126,6 @@ FilterBoundInfo getFilterBoundInfo(const Filter& filter) {
135126
const auto& range = *filter.as<TimestampRange>();
136127
info.convertible = true;
137128
info.pointLookup = range.isSingleValue();
138-
info.canRemoveFilter = true;
139129
break;
140130
}
141131

@@ -222,11 +212,11 @@ void addColumnBound(
222212
}
223213
// For DESC, swap the inclusivity as well.
224214
if (isDesc) {
225-
lowerInclusive = lowerInclusive && localUpperInclusive;
226-
upperInclusive = upperInclusive && localLowerInclusive;
215+
lowerInclusive &= localUpperInclusive;
216+
upperInclusive &= localLowerInclusive;
227217
} else {
228-
lowerInclusive = lowerInclusive && localLowerInclusive;
229-
upperInclusive = upperInclusive && localUpperInclusive;
218+
lowerInclusive &= localLowerInclusive;
219+
upperInclusive &= localUpperInclusive;
230220
}
231221
addVectors(std::move(lowerVector), std::move(upperVector));
232222
break;
@@ -253,11 +243,11 @@ void addColumnBound(
253243
upperVector->setNull(0, true);
254244
}
255245
if (isDesc) {
256-
lowerInclusive = lowerInclusive && localUpperInclusive;
257-
upperInclusive = upperInclusive && localLowerInclusive;
246+
lowerInclusive &= localUpperInclusive;
247+
upperInclusive &= localLowerInclusive;
258248
} else {
259-
lowerInclusive = lowerInclusive && localLowerInclusive;
260-
upperInclusive = upperInclusive && localUpperInclusive;
249+
lowerInclusive &= localLowerInclusive;
250+
upperInclusive &= localUpperInclusive;
261251
}
262252
addVectors(std::move(lowerVector), std::move(upperVector));
263253
break;
@@ -284,11 +274,11 @@ void addColumnBound(
284274
upperVector->setNull(0, true);
285275
}
286276
if (isDesc) {
287-
lowerInclusive = lowerInclusive && localUpperInclusive;
288-
upperInclusive = upperInclusive && localLowerInclusive;
277+
lowerInclusive &= localUpperInclusive;
278+
upperInclusive &= localLowerInclusive;
289279
} else {
290-
lowerInclusive = lowerInclusive && localLowerInclusive;
291-
upperInclusive = upperInclusive && localUpperInclusive;
280+
lowerInclusive &= localLowerInclusive;
281+
upperInclusive &= localUpperInclusive;
292282
}
293283
addVectors(std::move(lowerVector), std::move(upperVector));
294284
break;

0 commit comments

Comments
 (0)