Skip to content

Commit d069db4

Browse files
remove unused DoubleValues (#292)
1 parent 3a3426d commit d069db4

File tree

3 files changed

+2
-106
lines changed

3 files changed

+2
-106
lines changed

velox/substrait/SubstraitToVeloxPlan.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,22 +1810,6 @@ void SubstraitVeloxPlanConverter::setInFilter(
18101810
const std::string& inputName,
18111811
connector::hive::SubfieldFilters& filters) {}
18121812

1813-
template <>
1814-
void SubstraitVeloxPlanConverter::setInFilter<TypeKind::DOUBLE>(
1815-
const std::vector<variant>& variants,
1816-
bool nullAllowed,
1817-
const std::string& inputName,
1818-
connector::hive::SubfieldFilters& filters) {
1819-
std::vector<double> values;
1820-
values.reserve(variants.size());
1821-
for (const auto& variant : variants) {
1822-
double value = variant.value<double>();
1823-
values.emplace_back(value);
1824-
}
1825-
filters[common::Subfield(inputName, true)] =
1826-
common::createDoubleValues(values, nullAllowed);
1827-
}
1828-
18291813
template <>
18301814
void SubstraitVeloxPlanConverter::setInFilter<TypeKind::BIGINT>(
18311815
const std::vector<variant>& variants,

velox/type/Filter.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ std::string Filter::toString() const {
6464
case FilterKind::kDoubleRange:
6565
strKind = "DoubleRange";
6666
break;
67-
case FilterKind::kDoubleValues:
68-
strKind = "DoubleValues";
69-
break;
7067
case FilterKind::kFloatRange:
7168
strKind = "FloatRange";
7269
break;
@@ -1015,31 +1012,6 @@ std::unique_ptr<Filter> notNullOrTrue(bool nullAllowed) {
10151012

10161013
} // namespace
10171014

1018-
std::unique_ptr<Filter> createDoubleValues(
1019-
const std::vector<double>& values,
1020-
bool nullAllowed) {
1021-
if (values.empty()) {
1022-
return nullOrFalse(nullAllowed);
1023-
}
1024-
if (values.size() == 1) {
1025-
return std::make_unique<DoubleRange>(
1026-
values.front(),
1027-
false,
1028-
false,
1029-
values.front(),
1030-
false,
1031-
false,
1032-
nullAllowed);
1033-
}
1034-
double min = values.front();
1035-
double max = values.front();
1036-
for (const auto& value : values) {
1037-
min = (value < min) ? value : min;
1038-
max = (value > max) ? value : max;
1039-
}
1040-
return std::make_unique<DoubleValues>(min, max, values, nullAllowed);
1041-
}
1042-
10431015
std::unique_ptr<Filter> createBigintValuesFilter(
10441016
const std::vector<int64_t>& values,
10451017
bool nullAllowed,

velox/type/Filter.h

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ enum class FilterKind {
4747
kNegatedBigintValuesUsingHashTable,
4848
kNegatedBigintValuesUsingBitmask,
4949
kDoubleRange,
50-
kDoubleValues,
5150
kFloatRange,
5251
kBytesRange,
5352
kNegatedBytesRange,
@@ -623,7 +622,7 @@ class BigintRange final : public Filter {
623622
folly::dynamic serialize() const override;
624623

625624
static FilterPtr create(const folly::dynamic& obj);
626-
625+
627626
BigintRange(
628627
int64_t lower,
629628
bool lowerUnbounded,
@@ -1146,60 +1145,6 @@ class NegatedBigintValuesUsingBitmask final : public Filter {
11461145
std::unique_ptr<BigintValuesUsingBitmask> nonNegated_;
11471146
};
11481147

1149-
class DoubleValues final : public Filter {
1150-
public:
1151-
/// @param min Minimum value.
1152-
/// @param max Maximum value.
1153-
/// @param values A list of unique values that pass the filter. Must contain
1154-
/// at least two entries.
1155-
/// @param nullAllowed Null values are passing the filter if true.
1156-
DoubleValues(
1157-
double min,
1158-
double max,
1159-
const std::vector<double>& values,
1160-
bool nullAllowed);
1161-
1162-
DoubleValues(const DoubleValues& other, bool nullAllowed)
1163-
: Filter(true, nullAllowed, FilterKind::kDoubleValues),
1164-
bitmask_(other.bitmask_),
1165-
min_(other.min_),
1166-
max_(other.max_) {}
1167-
1168-
folly::dynamic serialize() const override;
1169-
1170-
std::unique_ptr<Filter> clone(
1171-
std::optional<bool> nullAllowed = std::nullopt) const final {
1172-
if (nullAllowed) {
1173-
return std::make_unique<DoubleValues>(*this, nullAllowed.value());
1174-
} else {
1175-
return std::make_unique<DoubleValues>(*this);
1176-
}
1177-
}
1178-
1179-
std::vector<double> values() const;
1180-
1181-
bool testDouble(double value) const final;
1182-
1183-
bool testDoubleRange(double min, double max, bool hasNull) const final;
1184-
1185-
std::unique_ptr<Filter> mergeWith(const Filter* other) const final;
1186-
1187-
bool testingEquals(const Filter& other) const final;
1188-
1189-
private:
1190-
std::unique_ptr<Filter> mergeWith(double min, double max, const Filter* other)
1191-
const;
1192-
1193-
int64_t toInt64(double value) const {
1194-
int64_t converted = (int64_t)(value + 0.5);
1195-
return converted;
1196-
}
1197-
1198-
std::vector<bool> bitmask_;
1199-
const double min_;
1200-
const double max_;
1201-
};
1202-
12031148
/// Base class for range filters on floating point and string data types.
12041149
class AbstractRange : public Filter {
12051150
public:
@@ -1938,7 +1883,7 @@ class MultiRange final : public Filter {
19381883
: Filter(true, nullAllowed, FilterKind::kMultiRange),
19391884
filters_(std::move(filters)),
19401885
nanAllowed_(true) {}
1941-
1886+
19421887
folly::dynamic serialize() const override;
19431888

19441889
static FilterPtr create(const folly::dynamic& obj);
@@ -2019,9 +1964,4 @@ std::unique_ptr<Filter> createBigintValues(
20191964
std::unique_ptr<Filter> createNegatedBigintValues(
20201965
const std::vector<int64_t>& values,
20211966
bool nullAllowed);
2022-
2023-
std::unique_ptr<Filter> createDoubleValues(
2024-
const std::vector<double>& values,
2025-
bool nullAllowed);
2026-
20271967
} // namespace facebook::velox::common

0 commit comments

Comments
 (0)