#include #include namespace DB { template struct DivideIntegralOrZeroImpl { using ResultType = typename NumberTraits::ResultOfIntegerDivision::Type; static const constexpr bool allow_fixed_string = false; static const constexpr bool allow_string_integer = false; template static inline Result apply(A a, B b) { if (unlikely(divisionLeadsToFPE(a, b))) return 0; return DivideIntegralImpl::template apply(a, b); } #if USE_EMBEDDED_COMPILER static constexpr bool compilable = false; /// TODO implement the checks #endif }; struct NameIntDivOrZero { static constexpr auto name = "intDivOrZero"; }; using FunctionIntDivOrZero = BinaryArithmeticOverloadResolver; REGISTER_FUNCTION(IntDivOrZero) { factory.registerFunction(); } }