Skip to content
Closed
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
6 changes: 3 additions & 3 deletions velox/exec/tests/SimpleAggregateAdapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,16 @@ class CountNullsAggregate {
using AccumulatorType = Accumulator;
};

bool registerSimpleCountNullsAggregate(const std::string& name) {
exec::AggregateRegistrationResult registerSimpleCountNullsAggregate(
const std::string& name) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.returnType("bigint")
.intermediateType("bigint")
.argumentType("double")
.build()};

exec::registerAggregateFunction(
return exec::registerAggregateFunction(
name,
std::move(signatures),
[name](
Expand All @@ -432,7 +433,6 @@ bool registerSimpleCountNullsAggregate(const std::string& name) {
return std::make_unique<SimpleAggregateAdapter<CountNullsAggregate>>(
resultType);
});
return true;
}

void registerSimpleCountNullsAggregate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ std::unique_ptr<exec::Aggregate> makeApproxMostFrequentAggregate(
}
}

exec::AggregateRegistrationResult registerApproxMostFrequent(
const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerApproxMostFrequentAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
for (const auto& valueType :
{"tinyint", "smallint", "integer", "bigint", "varchar"}) {
Expand All @@ -364,6 +366,7 @@ exec::AggregateRegistrationResult registerApproxMostFrequent(
.argumentType("bigint")
.build());
}
auto name = prefix + kApproxMostFrequent;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand All @@ -385,10 +388,4 @@ exec::AggregateRegistrationResult registerApproxMostFrequent(
});
}

} // namespace

void registerApproxMostFrequentAggregate(const std::string& prefix) {
registerApproxMostFrequent(prefix + kApproxMostFrequent);
}

} // namespace facebook::velox::aggregate::prestosql
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,10 @@ void addSignatures(
.build());
}

exec::AggregateRegistrationResult registerApproxPercentile(
const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerApproxPercentileAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
for (const auto& inputType :
{"tinyint", "smallint", "integer", "bigint", "real", "double"}) {
Expand All @@ -814,6 +816,7 @@ exec::AggregateRegistrationResult registerApproxPercentile(
fmt::format("array({})", inputType),
signatures);
}
auto name = prefix + kApproxPercentile;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand Down Expand Up @@ -905,10 +908,4 @@ exec::AggregateRegistrationResult registerApproxPercentile(
/*registerCompanionFunctions*/ true);
}

} // namespace

void registerApproxPercentileAggregate(const std::string& prefix) {
registerApproxPercentile(prefix + kApproxPercentile);
}

} // namespace facebook::velox::aggregate::prestosql
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/ArbitraryAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ class NonNumericArbitrary : public exec::Aggregate {
}
};

exec::AggregateRegistrationResult registerArbitrary(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerArbitraryAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.typeVariable("T")
Expand All @@ -263,6 +266,7 @@ exec::AggregateRegistrationResult registerArbitrary(const std::string& name) {
.argumentType("T")
.build()};

auto name = prefix + kArbitrary;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand Down Expand Up @@ -312,10 +316,4 @@ exec::AggregateRegistrationResult registerArbitrary(const std::string& name) {
});
}

} // namespace

void registerArbitraryAggregate(const std::string& prefix) {
registerArbitrary(prefix + kArbitrary);
}

} // namespace facebook::velox::aggregate::prestosql
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/ArrayAggAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ class ArrayAggAggregate : public exec::Aggregate {
DecodedVector decodedIntermediate_;
};

exec::AggregateRegistrationResult registerArray(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerArrayAggAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.typeVariable("E")
Expand All @@ -244,6 +247,7 @@ exec::AggregateRegistrationResult registerArray(const std::string& name) {
.argumentType("E")
.build()};

auto name = prefix + kArrayAgg;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand All @@ -260,10 +264,4 @@ exec::AggregateRegistrationResult registerArray(const std::string& name) {
/*registerCompanionFunctions*/ true);
}

} // namespace

void registerArrayAggregate(const std::string& prefix) {
registerArray(prefix + kArrayAgg);
}

} // namespace facebook::velox::aggregate::prestosql
10 changes: 3 additions & 7 deletions velox/functions/prestosql/aggregates/AverageAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using namespace facebook::velox::functions::aggregate;

namespace facebook::velox::aggregate::prestosql {
namespace {

/// Count is BIGINT() while sum and the final aggregates type depends on
/// the input types:
Expand All @@ -30,7 +29,8 @@ namespace {
/// REAL | DOUBLE | REAL
/// ALL INTs | DOUBLE | DOUBLE
/// DECIMAL | DECIMAL | DECIMAL
exec::AggregateRegistrationResult registerAverage(const std::string& name) {
exec::AggregateRegistrationResult registerAverageAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;

for (const auto& inputType : {"smallint", "integer", "bigint", "double"}) {
Expand All @@ -55,6 +55,7 @@ exec::AggregateRegistrationResult registerAverage(const std::string& name) {
.returnType("DECIMAL(a_precision, a_scale)")
.build());

auto name = prefix + kAvg;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand Down Expand Up @@ -140,10 +141,5 @@ exec::AggregateRegistrationResult registerAverage(const std::string& name) {
},
/*registerCompanionFunctions*/ true);
}
} // namespace

void registerAverageAggregate(const std::string& prefix) {
registerAverage(prefix + kAvg);
}

} // namespace facebook::velox::aggregate::prestosql
5 changes: 3 additions & 2 deletions velox/functions/prestosql/aggregates/BitwiseXorAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class BitwiseXorAggregate {

} // namespace

void registerBitwiseXorAggregate(const std::string& prefix) {
exec::AggregateRegistrationResult registerBitwiseXorAggregate(
const std::string& prefix) {
const std::string name = prefix + kBitwiseXor;

std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
Expand All @@ -79,7 +80,7 @@ void registerBitwiseXorAggregate(const std::string& prefix) {
.build());
}

exec::registerAggregateFunction(
return exec::registerAggregateFunction(
name,
std::move(signatures),
[name](
Expand Down
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/ChecksumAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ class ChecksumAggregate : public exec::Aggregate {
DecodedVector decodedIntermediate_;
};

exec::AggregateRegistrationResult registerChecksum(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerChecksumAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.typeVariable("T")
Expand All @@ -217,6 +220,7 @@ exec::AggregateRegistrationResult registerChecksum(const std::string& name) {
.build(),
};

auto name = prefix + kChecksum;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand All @@ -236,10 +240,4 @@ exec::AggregateRegistrationResult registerChecksum(const std::string& name) {
});
}

} // namespace

void registerChecksumAggregate(const std::string& prefix) {
registerChecksum(prefix + kChecksum);
}

} // namespace facebook::velox::aggregate::prestosql
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/CountAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ class CountAggregate : public SimpleNumericAggregate<bool, int64_t, int64_t> {
DecodedVector decodedIntermediate_;
};

exec::AggregateRegistrationResult registerCount(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerCountAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.returnType("bigint")
Expand All @@ -162,6 +165,7 @@ exec::AggregateRegistrationResult registerCount(const std::string& name) {
.build(),
};

auto name = prefix + kCount;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand All @@ -177,10 +181,4 @@ exec::AggregateRegistrationResult registerCount(const std::string& name) {
});
}

} // namespace

void registerCountAggregate(const std::string& prefix) {
registerCount(prefix + kCount);
}

} // namespace facebook::velox::aggregate::prestosql
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/CountIfAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ class CountIfAggregate : public exec::Aggregate {
}
};

exec::AggregateRegistrationResult registerCountIf(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerCountIfAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures{
exec::AggregateFunctionSignatureBuilder()
.returnType("bigint")
Expand All @@ -177,6 +180,7 @@ exec::AggregateRegistrationResult registerCountIf(const std::string& name) {
.build(),
};

auto name = prefix + kCountIf;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand All @@ -201,10 +205,4 @@ exec::AggregateRegistrationResult registerCountIf(const std::string& name) {
});
}

} // namespace

void registerCountIfAggregate(const std::string& prefix) {
registerCountIf(prefix + kCountIf);
}

} // namespace facebook::velox::aggregate::prestosql
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/EntropyAggregates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ void checkRowType(const TypePtr& type, const std::string& errorMessage) {
errorMessage);
}

exec::AggregateRegistrationResult registerEntropy(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerEntropyAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
std::vector<std::string> inputTypes = {"smallint", "integer", "bigint"};
for (const auto& inputType : inputTypes) {
Expand All @@ -345,6 +348,7 @@ exec::AggregateRegistrationResult registerEntropy(const std::string& name) {
.build());
}

auto name = prefix + kEntropy;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand Down Expand Up @@ -382,10 +386,4 @@ exec::AggregateRegistrationResult registerEntropy(const std::string& name) {
});
}

} // namespace

void registerEntropyAggregates(const std::string& prefix) {
registerEntropy(prefix + kEntropy);
}

} // namespace facebook::velox::aggregate::prestosql
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class GeometricMeanAggregate {

} // namespace

void registerGeometricMeanAggregate(const std::string& prefix) {
exec::AggregateRegistrationResult registerGeometricMeanAggregate(
const std::string& prefix) {
const std::string name = prefix + kGeometricMean;

std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
Expand All @@ -102,7 +103,7 @@ void registerGeometricMeanAggregate(const std::string& prefix) {
.argumentType("real")
.build());

exec::registerAggregateFunction(
return exec::registerAggregateFunction(
name,
std::move(signatures),
[name](
Expand Down
12 changes: 5 additions & 7 deletions velox/functions/prestosql/aggregates/HistogramAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ class HistogramAggregate : public exec::Aggregate {
DecodedVector decodedIntermediate_;
};

exec::AggregateRegistrationResult registerHistogram(const std::string& name) {
} // namespace

exec::AggregateRegistrationResult registerHistogramAggregate(
const std::string& prefix) {
std::vector<std::shared_ptr<exec::AggregateFunctionSignature>> signatures;
for (const auto inputType :
{"boolean",
Expand All @@ -360,6 +363,7 @@ exec::AggregateRegistrationResult registerHistogram(const std::string& name) {
.build());
}

auto name = prefix + kHistogram;
return exec::registerAggregateFunction(
name,
std::move(signatures),
Expand Down Expand Up @@ -405,10 +409,4 @@ exec::AggregateRegistrationResult registerHistogram(const std::string& name) {
});
}

} // namespace

void registerHistogramAggregate(const std::string& prefix) {
registerHistogram(prefix + kHistogram);
}

} // namespace facebook::velox::aggregate::prestosql
Loading