| 1 | #include <DataTypes/DataTypeFunction.h> |
|---|---|
| 2 | #include <IO/WriteBufferFromString.h> |
| 3 | #include <IO/Operators.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | std::string DataTypeFunction::doGetName() const |
| 10 | { |
| 11 | WriteBufferFromOwnString res; |
| 12 | |
| 13 | res << "Function("; |
| 14 | if (argument_types.size() > 1) |
| 15 | res << "("; |
| 16 | for (size_t i = 0; i < argument_types.size(); ++i) |
| 17 | { |
| 18 | if (i > 0) |
| 19 | res << ", "; |
| 20 | const DataTypePtr & type = argument_types[i]; |
| 21 | res << (type ? type->getName() : "?"); |
| 22 | } |
| 23 | if (argument_types.size() > 1) |
| 24 | res << ")"; |
| 25 | res << " -> "; |
| 26 | res << (return_type ? return_type->getName() : "?"); |
| 27 | res << ")"; |
| 28 | return res.str(); |
| 29 | } |
| 30 | |
| 31 | bool DataTypeFunction::equals(const IDataType & rhs) const |
| 32 | { |
| 33 | return typeid(rhs) == typeid(*this) && getName() == rhs.getName(); |
| 34 | } |
| 35 | |
| 36 | } |
| 37 |