Skip to content

Commit

Permalink
Temp Revert "Fix code due to API change"
Browse files Browse the repository at this point in the history
This reverts commit 9fcf843b6a9840b526f7294af8d0fd0fe2225e52.
  • Loading branch information
PHILO-HE committed Aug 1, 2024
1 parent e2819d4 commit 9e84fcb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion velox/core/SimpleFunctionMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ class UDFHolder {
void,
const std::vector<TypePtr>&,
const core::QueryConfig&,
const ConstantArg<exec_arg_type<TArgs>*...>::value>*;
const exec_arg_type<TArgs>*...>::value;

// TODO Remove
static constexpr bool udf_has_legacy_initialize = util::has_method<
Expand Down
14 changes: 7 additions & 7 deletions velox/functions/lib/Re2Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ struct Re2RegexpReplace {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* /*string*/,
const ConstantArg<arg_type<Varchar>>* pattern,
const ConstantArg<arg_type<Varchar>>* replacement) {
const arg_type<Varchar>* /*string*/,
const arg_type<Varchar>* pattern,
const arg_type<Varchar>* replacement) {
if (pattern != nullptr) {
const auto processedPattern = prepareRegexpPattern(*pattern->value());
const auto processedPattern = prepareRegexpPattern(*pattern);
re_.emplace(processedPattern, RE2::Quiet);
VELOX_USER_CHECK(
re_->ok(),
Expand All @@ -294,7 +294,7 @@ struct Re2RegexpReplace {
// Constant 'replacement' with non-constant 'pattern' needs to be
// processed separately for each row.
if (pattern != nullptr) {
ensureProcessedReplacement(re_.value(), *replacement->value());
ensureProcessedReplacement(re_.value(), *replacement);
constantReplacement_ = true;
}
}
Expand All @@ -303,8 +303,8 @@ struct Re2RegexpReplace {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* string,
const ConstantArg<arg_type<Varchar>>* pattern) {
const arg_type<Varchar>* string,
const arg_type<Varchar>* pattern) {
initialize(inputTypes, config, string, pattern, nullptr);
}

Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/TimeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct InitSessionTimezone {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Timestamp>>* /*timestamp*/) {
const arg_type<Timestamp>* /*timestamp*/) {
timeZone_ = getTimeZoneFromConfig(config);
}
};
Expand Down
62 changes: 31 additions & 31 deletions velox/functions/prestosql/DateTimeFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct FromUnixtimeFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<double>>* /*unixtime*/,
const ConstantArg<arg_type<Varchar>>* timezone) {
const arg_type<double>* /*unixtime*/,
const arg_type<Varchar>* timezone) {
if (timezone != nullptr) {
tzID_ = tz::getTimeZoneID((std::string_view)(*timezone));
}
Expand All @@ -79,9 +79,9 @@ struct FromUnixtimeFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<double>>* /*unixtime*/,
const ConstantArg<arg_type<int64_t>>* hours,
const ConstantArg<arg_type<int64_t>>* minutes) {
const arg_type<double>* /*unixtime*/,
const arg_type<int64_t>* hours,
const arg_type<int64_t>* minutes) {
if (hours != nullptr && minutes != nullptr) {
tzID_ = tz::getTimeZoneID(*hours * 60 + *minutes);
}
Expand Down Expand Up @@ -145,21 +145,21 @@ struct DateFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* date) {
const arg_type<Varchar>* date) {
timeZone_ = getTimeZoneFromConfig(config);
}

FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Timestamp>>* timestamp) {
const arg_type<Timestamp>* timestamp) {
timeZone_ = getTimeZoneFromConfig(config);
}

FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<TimestampWithTimezone>>* timestampWithTimezone) {
const arg_type<TimestampWithTimezone>* timestampWithTimezone) {
// Do nothing. Session timezone doesn't affect the result.
}

Expand Down Expand Up @@ -971,8 +971,8 @@ struct DateTruncFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<Timestamp>>* /*timestamp*/) {
const arg_type<Varchar>* unitString,
const arg_type<Timestamp>* /*timestamp*/) {
timeZone_ = getTimeZoneFromConfig(config);

if (unitString != nullptr) {
Expand All @@ -983,8 +983,8 @@ struct DateTruncFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<Date>>* /*date*/) {
const arg_type<Varchar>* unitString,
const arg_type<Date>* /*date*/) {
if (unitString != nullptr) {
unit_ = getDateUnit(*unitString, false);
}
Expand All @@ -993,8 +993,8 @@ struct DateTruncFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<TimestampWithTimezone>>* /*timestamp*/) {
const arg_type<Varchar>* unitString,
const arg_type<TimestampWithTimezone>* /*timestamp*/) {
if (unitString != nullptr) {
unit_ = getTimestampUnit(*unitString);
}
Expand Down Expand Up @@ -1196,9 +1196,9 @@ struct DateAddFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<int64_t>* /*value*/,
const ConstantArg<arg_type<Timestamp>>* /*timestamp*/) {
const arg_type<Varchar>* unitString,
const int64_t* /*value*/,
const arg_type<Timestamp>* /*timestamp*/) {
sessionTimeZone_ = getTimeZoneFromConfig(config);
if (unitString != nullptr) {
unit_ = fromDateTimeUnitString(*unitString, false /*throwIfInvalid*/);
Expand All @@ -1208,9 +1208,9 @@ struct DateAddFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<int64_t>* /*value*/,
const ConstantArg<arg_type<Date>>* /*date*/) {
const arg_type<Varchar>* unitString,
const int64_t* /*value*/,
const arg_type<Date>* /*date*/) {
if (unitString != nullptr) {
unit_ = getDateUnit(*unitString, false);
}
Expand Down Expand Up @@ -1295,9 +1295,9 @@ struct DateDiffFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<Timestamp>>* /*timestamp1*/,
const ConstantArg<arg_type<Timestamp>>* /*timestamp2*/) {
const arg_type<Varchar>* unitString,
const arg_type<Timestamp>* /*timestamp1*/,
const arg_type<Timestamp>* /*timestamp2*/) {
if (unitString != nullptr) {
unit_ = fromDateTimeUnitString(*unitString, false /*throwIfInvalid*/);
}
Expand All @@ -1308,9 +1308,9 @@ struct DateDiffFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<Date>>* /*date1*/,
const ConstantArg<arg_type<Date>>* /*date2*/) {
const arg_type<Varchar>* unitString,
const arg_type<Date>* /*date1*/,
const arg_type<Date>* /*date2*/) {
if (unitString != nullptr) {
unit_ = getDateUnit(*unitString, false);
}
Expand All @@ -1319,9 +1319,9 @@ struct DateDiffFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Varchar>>* unitString,
const ConstantArg<arg_type<TimestampWithTimezone>>* /*timestampWithTimezone1*/,
const ConstantArg<arg_type<TimestampWithTimezone>>* /*timestampWithTimezone2*/) {
const arg_type<Varchar>* unitString,
const arg_type<TimestampWithTimezone>* /*timestampWithTimezone1*/,
const arg_type<TimestampWithTimezone>* /*timestampWithTimezone2*/) {
if (unitString != nullptr) {
unit_ = fromDateTimeUnitString(*unitString, false /*throwIfInvalid*/);
}
Expand Down Expand Up @@ -1390,8 +1390,8 @@ struct DateFormatFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const ConstantArg<arg_type<Timestamp>>* /*timestamp*/,
const ConstantArg<arg_type<Varchar>>* formatString) {
const arg_type<Timestamp>* /*timestamp*/,
const arg_type<Varchar>* formatString) {
sessionTimeZone_ = getTimeZoneFromConfig(config);
if (formatString != nullptr) {
setFormatter(*formatString);
Expand Down

0 comments on commit 9e84fcb

Please sign in to comment.