mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Removed (most probably) redundant if branch. Fixed VALUES table funtion.
This commit is contained in:
parent
57eef84322
commit
6f68cfc45c
@ -187,9 +187,6 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID
|
||||
return dynamic_cast<const IDataTypeEnum &>(type).castToValue(src);
|
||||
}
|
||||
|
||||
if (src.getType() == Field::Types::UInt64)
|
||||
return src;
|
||||
|
||||
if (src.getType() == Field::Types::String)
|
||||
{
|
||||
if (which_type.isDate())
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <Core/Block.h>
|
||||
#include <Storages/StorageValues.h>
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
|
||||
#include <Parsers/ASTExpressionList.h>
|
||||
#include <Parsers/ASTLiteral.h>
|
||||
@ -32,7 +33,6 @@ static void parseAndInsertValues(MutableColumns & res_columns, const ASTs & args
|
||||
for (size_t i = 1; i < args.size(); ++i)
|
||||
{
|
||||
const auto & [value_field, value_type_ptr] = evaluateConstantExpression(args[i], context);
|
||||
|
||||
Field value = convertFieldToType(value_field, *sample_block.getByPosition(0).type, value_type_ptr.get());
|
||||
res_columns[0]->insert(value);
|
||||
}
|
||||
@ -42,6 +42,7 @@ static void parseAndInsertValues(MutableColumns & res_columns, const ASTs & args
|
||||
for (size_t i = 1; i < args.size(); ++i)
|
||||
{
|
||||
const auto & [value_field, value_type_ptr] = evaluateConstantExpression(args[i], context);
|
||||
const DataTypes & value_types_tuple = typeid_cast<const DataTypeTuple *>(value_type_ptr.get())->getElements();
|
||||
const TupleBackend & value_tuple = value_field.safeGet<Tuple>().toUnderType();
|
||||
|
||||
if (value_tuple.size() != sample_block.columns())
|
||||
@ -49,7 +50,7 @@ static void parseAndInsertValues(MutableColumns & res_columns, const ASTs & args
|
||||
|
||||
for (size_t j = 0; j < value_tuple.size(); ++j)
|
||||
{
|
||||
Field value = convertFieldToType(value_tuple[j], *sample_block.getByPosition(j).type, value_type_ptr.get());
|
||||
Field value = convertFieldToType(value_tuple[j], *sample_block.getByPosition(j).type, value_types_tuple[j].get());
|
||||
res_columns[j]->insert(value);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user