| 723 | } |
| 724 | |
| 725 | FuncRet arrayFunc(DB::ASTPtr ch, std::map<std::string, Column> & columns) |
| 726 | { |
| 727 | auto x = std::dynamic_pointer_cast<DB::ASTFunction>(ch); |
| 728 | if (x) |
| 729 | { |
| 730 | std::set<std::string> indents = {}; |
| 731 | std::string value = "["; |
| 732 | ColumnType type_value = Type::i | Type::f | Type::d | Type::dt | Type::s; |
| 733 | bool no_indent = true; |
| 734 | for (const auto & arg : x->arguments->children) |
| 735 | { |
| 736 | auto ident = std::dynamic_pointer_cast<DB::ASTIdentifier>(arg); |
| 737 | if (ident) |
| 738 | { |
| 739 | no_indent = false; |
| 740 | indents.insert(ident->name()); |
| 741 | } |
| 742 | auto literal = std::dynamic_pointer_cast<DB::ASTLiteral>(arg); |
| 743 | if (literal) |
| 744 | { |
| 745 | ColumnType type = type_cast(literal->value.getType()); |
| 746 | if (type == Type::s || type == Type::d || type == Type::dt) |
| 747 | type = time_type(value); |
| 748 | type_value &= type; |
| 749 | |
| 750 | if (value != "[") |
| 751 | value += ", "; |
| 752 | value += applyVisitor(DB::FieldVisitorToString(), literal->value); |
| 753 | } |
| 754 | } |
| 755 | for (const auto & indent : indents) |
| 756 | { |
| 757 | auto c = Column(indent); |
| 758 | c.type = type_value; |
| 759 | if (columns.count(indent)) |
| 760 | columns[indent].merge(c); |
| 761 | else |
| 762 | columns[indent] = c; |
| 763 | } |
| 764 | value += ']'; |
| 765 | FuncRet r(type_value, ""); |
| 766 | r.is_array = true; |
| 767 | if (no_indent) |
| 768 | r.value = value; |
| 769 | return r; |
| 770 | } |
| 771 | return FuncRet(); |
| 772 | } |
| 773 | FuncRet arithmeticFunc(DB::ASTPtr ch, std::map<std::string, Column> & columns) |
| 774 | { |
| 775 | auto x = std::dynamic_pointer_cast<DB::ASTFunction>(ch); |
nothing calls this directly
no test coverage detected