| 48 | #define NEXT_DAY_FNS(name) DATE_TYPES(NEXT_DAY_SAFE_NULL_IF_NULL, name, {}) |
| 49 | |
| 50 | std::vector<NativeFunction> GetDateTimeFunctionRegistry() { |
| 51 | static std::vector<NativeFunction> date_time_fn_registry_ = { |
| 52 | UNARY_SAFE_NULL_NEVER_BOOL(isnull, {}, day_time_interval), |
| 53 | UNARY_SAFE_NULL_NEVER_BOOL(isnull, {}, month_interval), |
| 54 | DATE_EXTRACTION_TRUNCATION_FNS(EXTRACT_SAFE_NULL_IF_NULL, extract), |
| 55 | DATE_EXTRACTION_TRUNCATION_FNS(TRUNCATE_SAFE_NULL_IF_NULL, date_trunc_), |
| 56 | |
| 57 | DATE_TYPES(EXTRACT_SAFE_NULL_IF_NULL, extractDoy, {}), |
| 58 | DATE_TYPES(EXTRACT_SAFE_NULL_IF_NULL, extractDow, {}), |
| 59 | DATE_TYPES(EXTRACT_SAFE_NULL_IF_NULL, extractEpoch, {}), |
| 60 | |
| 61 | TIME_EXTRACTION_FNS(extract), |
| 62 | |
| 63 | NEXT_DAY_FNS(next_day), |
| 64 | |
| 65 | NativeFunction("castDATE", {}, DataTypeVector{utf8()}, date64(), kResultNullIfNull, |
| 66 | "castDATE_utf8", |
| 67 | NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), |
| 68 | |
| 69 | NativeFunction("castTIMESTAMP", {}, DataTypeVector{utf8()}, timestamp(), |
| 70 | kResultNullIfNull, "castTIMESTAMP_utf8", |
| 71 | NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), |
| 72 | |
| 73 | NativeFunction("castVARCHAR", {"varchar"}, DataTypeVector{timestamp(), int64()}, |
| 74 | utf8(), kResultNullIfNull, "castVARCHAR_timestamp_int64", |
| 75 | NativeFunction::kNeedsContext), |
| 76 | |
| 77 | NativeFunction("to_date", {}, DataTypeVector{utf8(), utf8()}, date64(), |
| 78 | kResultNullInternal, "gdv_fn_to_date_utf8_utf8", |
| 79 | NativeFunction::kNeedsContext | |
| 80 | NativeFunction::kNeedsFunctionHolder | |
| 81 | NativeFunction::kCanReturnErrors), |
| 82 | |
| 83 | NativeFunction("to_date", {}, DataTypeVector{utf8(), utf8(), int32()}, date64(), |
| 84 | kResultNullInternal, "gdv_fn_to_date_utf8_utf8_int32", |
| 85 | NativeFunction::kNeedsContext | |
| 86 | NativeFunction::kNeedsFunctionHolder | |
| 87 | NativeFunction::kCanReturnErrors), |
| 88 | NativeFunction("castTIMESTAMP", {}, DataTypeVector{date64()}, timestamp(), |
| 89 | kResultNullIfNull, "castTIMESTAMP_date64"), |
| 90 | |
| 91 | NativeFunction("castTIMESTAMP", {}, DataTypeVector{int64()}, timestamp(), |
| 92 | kResultNullIfNull, "castTIMESTAMP_int64"), |
| 93 | |
| 94 | NativeFunction("castDATE", {"to_date"}, DataTypeVector{timestamp()}, date64(), |
| 95 | kResultNullIfNull, "castDATE_timestamp"), |
| 96 | |
| 97 | NativeFunction("castTIME", {}, DataTypeVector{utf8()}, time32(), kResultNullIfNull, |
| 98 | "castTIME_utf8", |
| 99 | NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors), |
| 100 | |
| 101 | NativeFunction("castTIME", {}, DataTypeVector{timestamp()}, time32(), |
| 102 | kResultNullIfNull, "castTIME_timestamp"), |
| 103 | |
| 104 | NativeFunction("castTIME", {}, DataTypeVector{int32()}, time32(), kResultNullIfNull, |
| 105 | "castTIME_int32"), |
| 106 | |
| 107 | NativeFunction("castBIGINT", {}, DataTypeVector{day_time_interval()}, int64(), |
no test coverage detected