Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Aug 9, 2024
1 parent 6ab4abf commit 67a25bd
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 111 deletions.
3 changes: 2 additions & 1 deletion velox/core/SimpleFunctionMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "velox/core/CoreTypeSystem.h"
#include "velox/core/Metaprogramming.h"
#include "velox/core/QueryConfig.h"
#include "velox/expression/ComplexViewTypes.h"
#include "velox/expression/FunctionSignature.h"
#include "velox/expression/SignatureBinder.h"
#include "velox/type/SimpleFunctionApi.h"
Expand Down Expand Up @@ -894,7 +895,7 @@ class UDFHolder {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& config,
const typename exec_resolver<TArgs>::in_type*... constantArgs) {
const facebook::velox::exec::OptionalAccessor<typename exec_resolver<TArgs>::in_type>*... constantArgs) {
if constexpr (udf_has_initialize) {
return instance_.initialize(inputTypes, config, constantArgs...);
}
Expand Down
4 changes: 2 additions & 2 deletions velox/examples/SimpleFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ struct MyRegexpMatchFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig&,
const arg_type<Varchar>*,
const arg_type<Varchar>* pattern) {
const accessor_arg_type<Varchar>*,
const accessor_arg_type<Varchar>* pattern) {
// Compile the RE2 object just once if pattern is constant. Functions might
// choose to throw in case the regexp pattern is not constant, as it can be
// quite expensive to compile it on a per-row basis. In this example we
Expand Down
5 changes: 3 additions & 2 deletions velox/expression/SimpleFunctionAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ class SimpleFunctionAdapter : public VectorFunction {
if (packed.at(POSITION) != nullptr) {
SelectivityVector rows(1);
DecodedVector decodedVector(*packed.at(POSITION), rows);
auto oneReader = VectorReader<arg_at<POSITION>>(&decodedVector);
auto accessor = OptionalAccessor(&oneReader, 0);
const auto oneReader = VectorReader<arg_at<POSITION>>(&decodedVector);
using temp_type = exec_arg_at<POSITION>;
auto accessor = OptionalAccessor<temp_type>(&oneReader, 0);
unpackInitialize<POSITION + 1>(
inputTypes,
config,
Expand Down
10 changes: 5 additions & 5 deletions velox/expression/tests/SimpleFunctionInitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct NonDefaultWithArrayInitFunction {
void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<int32_t>* /*first*/,
const arg_type<velox::Array<int32_t>>* second) {
const accessor_arg_type<int32_t>* /*first*/,
const accessor_arg_type<velox::Array<int32_t>>* second) {
if (second == nullptr) {
return;
}
Expand Down Expand Up @@ -134,8 +134,8 @@ struct NonDefaultWithMapInitFunction {
void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<int32_t>* /*first*/,
const arg_type<velox::Map<int32_t, int64_t>>* second) {
const accessor_arg_type<int32_t>* /*first*/,
const accessor_arg_type<velox::Map<int32_t, int64_t>>* second) {
if (second == nullptr) {
return;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ struct InitAlwaysThrowsFunction {
void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<int32_t>* /*first*/) {
const accessor_arg_type<int32_t>* /*first*/) {
VELOX_USER_FAIL("Unconditional throw!");
}

Expand Down
16 changes: 8 additions & 8 deletions velox/expression/tests/SimpleFunctionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,12 +1253,12 @@ struct ConstantArgumentFunction {
void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<int32_t>* /*first*/,
const arg_type<int32_t>* /*second*/,
const arg_type<Varchar>* /*third*/,
const arg_type<Generic<T1>>* /*fourth*/,
const arg_type<Array<int32_t>>* /*fifth*/,
const arg_type<Map<int32_t, int32_t>>* /*sixth*/) {}
const accessor_arg_type<int32_t>* /*first*/,
const accessor_arg_type<int32_t>* /*second*/,
const accessor_arg_type<Varchar>* /*third*/,
const accessor_arg_type<Generic<T1>>* /*fourth*/,
const accessor_arg_type<Array<int32_t>>* /*fifth*/,
const accessor_arg_type<Map<int32_t, int32_t>>* /*sixth*/) {}

bool callNullable(
out_type<int64_t>& out,
Expand Down Expand Up @@ -1301,7 +1301,7 @@ struct DecimalPlusOneFunction {
void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& /*config*/,
const A* /*a*/) {
const accessor_arg_type<A>* /*a*/) {
scale_ = getDecimalPrecisionScale(*inputTypes[0]).second;
}

Expand All @@ -1322,7 +1322,7 @@ struct DecimalPlusTwoFunction {
void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& /*config*/,
const A* /*a*/) {
const accessor_arg_type<A>* /*a*/) {
scale_ = getDecimalPrecisionScale(*inputTypes[0]).second;
}

Expand Down
10 changes: 5 additions & 5 deletions velox/functions/lib/Re2Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ struct Re2RegexpReplace {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<Varchar>* /*string*/,
const arg_type<Varchar>* pattern,
const arg_type<Varchar>* replacement) {
const accessor_arg_type<Varchar>* /*string*/,
const accessor_arg_type<Varchar>* pattern,
const accessor_arg_type<Varchar>* replacement) {
if (pattern != nullptr) {
const auto processedPattern = prepareRegexpPattern(*pattern);
re_.emplace(processedPattern, RE2::Quiet);
Expand All @@ -303,8 +303,8 @@ struct Re2RegexpReplace {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& config,
const arg_type<Varchar>* string,
const arg_type<Varchar>* pattern) {
const accessor_arg_type<Varchar>* string,
const accessor_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 arg_type<Timestamp>* /*timestamp*/) {
const accessor_arg_type<Timestamp>* /*timestamp*/) {
timeZone_ = getTimeZoneFromConfig(config);
}
};
Expand Down
84 changes: 42 additions & 42 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 arg_type<double>* /*unixtime*/,
const arg_type<Varchar>* timezone) {
const accessor_arg_type<double>* /*unixtime*/,
const accessor_arg_type<Varchar>* timezone) {
if (timezone != nullptr) {
tzID_ = tz::getTimeZoneID((std::string_view)(*timezone));
}
Expand All @@ -80,8 +80,8 @@ struct FromUnixtimeFunction {
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<double>* /*unixtime*/,
const arg_type<int64_t>* hours,
const arg_type<int64_t>* minutes) {
const accessor_arg_type<int64_t>* hours,
const accessor_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 arg_type<Varchar>* date) {
const accessor_arg_type<Varchar>* date) {
timeZone_ = getTimeZoneFromConfig(config);
}

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

FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<TimestampWithTimezone>* timestampWithTimezone) {
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<Timestamp>* /*timestamp*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<Date>* /*date*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<TimestampWithTimezone>* /*timestamp*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_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 arg_type<Varchar>* unitString,
const int64_t* /*value*/,
const arg_type<Timestamp>* /*timestamp*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_arg_type<int64_t>* /*value*/,
const accessor_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 arg_type<Varchar>* unitString,
const int64_t* /*value*/,
const arg_type<Date>* /*date*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_arg_type<int64_t>* /*value*/,
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<Timestamp>* /*timestamp1*/,
const arg_type<Timestamp>* /*timestamp2*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_arg_type<Timestamp>* /*timestamp1*/,
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<Date>* /*date1*/,
const arg_type<Date>* /*date2*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_arg_type<Date>* /*date1*/,
const accessor_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 arg_type<Varchar>* unitString,
const arg_type<TimestampWithTimezone>* /*timestampWithTimezone1*/,
const arg_type<TimestampWithTimezone>* /*timestampWithTimezone2*/) {
const accessor_arg_type<Varchar>* unitString,
const accessor_arg_type<TimestampWithTimezone>* /*timestampWithTimezone1*/,
const accessor_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 arg_type<Timestamp>* /*timestamp*/,
const arg_type<Varchar>* formatString) {
const accessor_arg_type<Timestamp>* /*timestamp*/,
const accessor_arg_type<Varchar>* formatString) {
sessionTimeZone_ = getTimeZoneFromConfig(config);
if (formatString != nullptr) {
setFormatter(*formatString);
Expand All @@ -1402,8 +1402,8 @@ struct DateFormatFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& /*config*/,
const arg_type<TimestampWithTimezone>* /*timestamp*/,
const arg_type<Varchar>* formatString) {
const accessor_arg_type<TimestampWithTimezone>* /*timestamp*/,
const accessor_arg_type<Varchar>* formatString) {
if (formatString != nullptr) {
setFormatter(*formatString);
isConstFormat_ = true;
Expand Down Expand Up @@ -1469,7 +1469,7 @@ struct FromIso8601Timestamp {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<Varchar>* /*input*/) {
const accessor_arg_type<Varchar>* /*input*/) {
auto sessionTzName = config.sessionTimezone();
if (!sessionTzName.empty()) {
sessionTzID_ = tz::getTimeZoneID(sessionTzName);
Expand Down Expand Up @@ -1511,8 +1511,8 @@ struct DateParseFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<Varchar>* /*input*/,
const arg_type<Varchar>* formatString) {
const accessor_arg_type<Varchar>* /*input*/,
const accessor_arg_type<Varchar>* formatString) {
if (formatString != nullptr) {
format_ = buildMysqlDateTimeFormatter(
std::string_view(formatString->data(), formatString->size()));
Expand Down Expand Up @@ -1555,8 +1555,8 @@ struct FormatDateTimeFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<Timestamp>* /*timestamp*/,
const arg_type<Varchar>* formatString) {
const accessor_arg_type<Timestamp>* /*timestamp*/,
const accessor_arg_type<Varchar>* formatString) {
sessionTimeZone_ = getTimeZoneFromConfig(config);
if (formatString != nullptr) {
setFormatter(*formatString);
Expand Down Expand Up @@ -1629,8 +1629,8 @@ struct ParseDateTimeFunction {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<Varchar>* /*input*/,
const arg_type<Varchar>* format) {
const accessor_arg_type<Varchar>* /*input*/,
const accessor_arg_type<Varchar>* format) {
if (format != nullptr) {
format_ = buildJodaDateTimeFormatter(
std::string_view(format->data(), format->size()));
Expand Down Expand Up @@ -1726,7 +1726,7 @@ struct ToISO8601Function {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& inputTypes,
const core::QueryConfig& config,
const arg_type<Timestamp>* /*input*/) {
const accessor_arg_type<Timestamp>* /*input*/) {
if (inputTypes[0]->isTimestamp()) {
timeZone_ = getTimeZoneFromConfig(config);
}
Expand Down Expand Up @@ -1780,8 +1780,8 @@ struct AtTimezoneFunction : public TimestampWithTimezoneSupport<T> {
FOLLY_ALWAYS_INLINE void initialize(
const std::vector<TypePtr>& /*inputTypes*/,
const core::QueryConfig& config,
const arg_type<TimestampWithTimezone>* /*tsWithTz*/,
const arg_type<Varchar>* timezone) {
const accessor_arg_type<TimestampWithTimezone>* /*tsWithTz*/,
const accessor_arg_type<Varchar>* timezone) {
if (timezone != nullptr) {
targetTimezoneID_ = tz::getTimeZoneID(
std::string_view(timezone->data(), timezone->size()));
Expand Down
Loading

0 comments on commit 67a25bd

Please sign in to comment.