| 38 | } |
| 39 | |
| 40 | TableFunctionPtr TableFunctionFactory::get( |
| 41 | const ASTPtr & ast_function, |
| 42 | ContextPtr context) const |
| 43 | { |
| 44 | const auto * table_function = ast_function->as<ASTFunction>(); |
| 45 | if (!table_function) |
| 46 | throw Exception(ErrorCodes::LOGICAL_ERROR, |
| 47 | "Expected a table function (ASTFunction) but got '{}'", ast_function->formatForErrorMessage()); |
| 48 | |
| 49 | auto res = tryGet(table_function->name, context); |
| 50 | if (!res) |
| 51 | { |
| 52 | auto hints = getHints(table_function->name); |
| 53 | if (!hints.empty()) |
| 54 | throw Exception(ErrorCodes::UNKNOWN_FUNCTION, "Unknown table function {}. Maybe you meant: {}", table_function->name, toString(hints)); |
| 55 | throw Exception(ErrorCodes::UNKNOWN_FUNCTION, "Unknown table function {}", table_function->name); |
| 56 | } |
| 57 | |
| 58 | res->parseArguments(ast_function, context); |
| 59 | return res; |
| 60 | } |
| 61 | |
| 62 | TableFunctionPtr TableFunctionFactory::tryGet( |
| 63 | const std::string & name_param, |
no test coverage detected