Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 committed Apr 15, 2024
1 parent 260a8bb commit 84959ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
8 changes: 8 additions & 0 deletions velox/functions/lib/RegistrationHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ void registerUnaryIntegral(const std::vector<std::string>& aliases) {
registerFunction<T, int64_t, int64_t>(aliases);
}

template <template <class> class T, typename TReturn>
void registerUnaryIntegralWithTReturn(const std::vector<std::string>& aliases) {
registerFunction<T, TReturn, int8_t>(aliases);
registerFunction<T, TReturn, int16_t>(aliases);
registerFunction<T, TReturn, int32_t>(aliases);
registerFunction<T, TReturn, int64_t>(aliases);
}

template <template <class> class T>
void registerUnaryFloatingPoint(const std::vector<std::string>& aliases) {
registerFunction<T, double, double>(aliases);
Expand Down
13 changes: 2 additions & 11 deletions velox/functions/sparksql/Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ inline void registerArrayMinMaxFunctions(const std::string& prefix) {
registerArrayMinMaxFunctions<Timestamp>(prefix);
registerArrayMinMaxFunctions<Date>(prefix);
}

template <template <class> typename T>
inline void registerIntegralToTimestamp(
const std::vector<std::string>& aliases) {
registerFunction<T, Timestamp, int8_t>(aliases);
registerFunction<T, Timestamp, int16_t>(aliases);
registerFunction<T, Timestamp, int32_t>(aliases);
registerFunction<T, Timestamp, int64_t>(aliases);
}
} // namespace

void registerFunctions(const std::string& prefix) {
Expand Down Expand Up @@ -399,11 +390,11 @@ void registerFunctions(const std::string& prefix) {

registerFunction<TimestampToMicrosFunction, int64_t, Timestamp>(
{prefix + "unix_micros"});
registerIntegralToTimestamp<MicrosToTimestampFunction>(
registerUnaryIntegralWithTReturn<MicrosToTimestampFunction, Timestamp>(
{prefix + "timestamp_micros"});
registerFunction<TimestampToMillisFunction, int64_t, Timestamp>(
{prefix + "unix_millis"});
registerIntegralToTimestamp<MillisToTimestampFunction>(
registerUnaryIntegralWithTReturn<MillisToTimestampFunction, Timestamp>(
{prefix + "timestamp_millis"});

// Register bloom filter function
Expand Down

0 comments on commit 84959ea

Please sign in to comment.