Skip to content
Merged
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
1 change: 1 addition & 0 deletions be/src/agent/be_exec_version_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class BeExecVersionManager {
* e. change shuffle serialize/deserialize way
* f. shrink some function's nullable mode.
* g. do local merge of remote runtime filter
* h. "now": ALWAYS_NOT_NULLABLE -> DEPEND_ON_ARGUMENTS
*/
constexpr inline int BeExecVersionManager::max_be_exec_version = 4;
constexpr inline int BeExecVersionManager::min_be_exec_version = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ using FunctionLocalTimeWithPrecision =
using FunctionLocalTimestampWithPrecision =
FunctionCurrentDateOrDateTime<CurrentDateTimeImpl<LocalTimestampFunctionName, true>>;

using FunctionNowWithPrecisionOld =
FunctionCurrentDateOrDateTimeOld<CurrentDateTimeImpl<NowFunctionName, true>>;

struct CurDateFunctionName {
static constexpr auto name = "curdate";
};
Expand Down Expand Up @@ -182,6 +185,8 @@ void register_function_date_time_computation(SimpleFunctionFactory& factory) {
factory.register_function<FunctionMilliSecToDateTime>();
factory.register_function<FunctionSecToDateTime>();

factory.register_alternative_function<FunctionNowWithPrecisionOld>();

// alias
factory.register_alias("days_add", "date_add");
factory.register_alias("days_add", "adddate");
Expand Down
35 changes: 35 additions & 0 deletions be/src/vec/functions/function_date_or_datetime_computation.h
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,41 @@ struct CurrentDateTimeImpl {
}
};

template <typename FunctionImpl>
class FunctionCurrentDateOrDateTimeOld : public IFunction {
public:
static constexpr bool has_variadic_argument =
!std::is_void_v<decltype(has_variadic_argument_types(std::declval<FunctionImpl>()))>;

static constexpr auto name = FunctionImpl::name;
static FunctionPtr create() { return std::make_shared<FunctionCurrentDateOrDateTimeOld>(); }

String get_name() const override { return name; }

size_t get_number_of_arguments() const override { return 0; }

// the only diff in old version is it's ALWAYS_NOT_NULLABLE
bool use_default_implementation_for_nulls() const override { return false; }

DataTypePtr get_return_type_impl(const ColumnsWithTypeAndName& arguments) const override {
return std::make_shared<typename FunctionImpl::ReturnType>();
}

bool is_variadic() const override { return true; }

DataTypes get_variadic_argument_types_impl() const override {
if constexpr (has_variadic_argument) {
return FunctionImpl::get_variadic_argument_types();
}
return {};
}

Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
return FunctionImpl::execute(context, block, arguments, result, input_rows_count);
}
};

template <typename FunctionName, typename DateType, typename NativeType>
struct CurrentDateImpl {
using ReturnType = DateType;
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/functions/simple_function_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SimpleFunctionFactory {
/// @TEMPORARY: for be_exec_version=3
template <class Function>
void register_alternative_function() {
static std::string suffix {"_old_for_version_before_3_0"};
static std::string suffix {"_old_for_version_before_4_0"};
function_to_replace[Function::name] = Function::name + suffix;
register_function(Function::name + suffix, &createDefaultFunction<Function>);
}
Expand Down