minor fixes

This commit is contained in:
Alexander Tokmakov 2020-09-18 14:06:30 +03:00
parent fb31544d4a
commit e1cf60990a
2 changed files with 3 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#include <TableFunctions/ITableFunction.h>
#include <TableFunctions/TableFunctionFactory.h>
#include <TableFunctions/TableFunctionNull.h>
#include <Interpreters/evaluateConstantExpression.h>
#include "registerTableFunctions.h"
@ -26,10 +27,7 @@ StoragePtr TableFunctionNull::executeImpl(const ASTPtr & ast_function, const Con
if (arguments.size() != 1)
throw Exception("Table function '" + getName() + "' requires 'structure'.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
const auto * literal = arguments[0]->as<ASTLiteral>();
if (!literal)
throw Exception("Table function " + getName() + " requested literal argument.", ErrorCodes::LOGICAL_ERROR);
auto structure = literal->value.safeGet<String>();
auto structure = evaluateConstantExpressionOrIdentifierAsLiteral(arguments[0], context)->as<ASTLiteral>()->value.safeGet<String>();
ColumnsDescription columns = parseColumnsListFromString(structure, context);
auto res = StorageNull::create(StorageID(getDatabaseName(), table_name), columns, ConstraintsDescription());

View File

@ -19,6 +19,7 @@ SRCS(
TableFunctionInput.cpp
TableFunctionMerge.cpp
TableFunctionMySQL.cpp
TableFunctionNull.cpp
TableFunctionNumbers.cpp
TableFunctionRemote.cpp
TableFunctionURL.cpp