#pragma once #include namespace DB { /** Implements `+=` operation. * Returns false if the result is zero. */ class FieldVisitorSum : public StaticVisitor { private: const Field & rhs; public: explicit FieldVisitorSum(const Field & rhs_); // We can add all ints as unsigned regardless of their actual signedness. bool operator() (Int64 & x) const; bool operator() (UInt64 & x) const; bool operator() (Float64 & x) const; bool operator() (Null &) const; bool operator() (String &) const; bool operator() (Array &) const; bool operator() (Tuple &) const; bool operator() (Map &) const; bool operator() (UUID &) const; bool operator() (AggregateFunctionStateData &) const; template bool operator() (DecimalField & x) const { x += get>(rhs); return x.getValue() != T(0); } template > > bool operator() (T & x) const { x += rhs.reinterpret(); return x != T(0); } }; }