#include #include namespace DB { template struct DivideIntegralOrZeroImpl { using ResultType = typename NumberTraits::ResultOfIntegerDivision::Type; template static inline Result apply(A a, B b) { return unlikely(divisionLeadsToFPE(a, b)) ? 0 : 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 = FunctionBinaryArithmetic; void registerFunctionIntDivOrZero(FunctionFactory & factory) { factory.registerFunction(); } }