fix build

This commit is contained in:
Anton Popov 2020-03-24 18:56:46 +03:00
parent b12bf5758e
commit 445d750938
2 changed files with 6 additions and 6 deletions

View File

@ -116,10 +116,10 @@ namespace
if (name == identifier->name)
{
ColumnWithTypeAndName column;
Field value = convertFieldToType(literal->value, *type);
if (!literal->value.isNull() && value.isNull())
Field converted = convertFieldToType(value, *type);
if (converted.isNull())
return {};
column.column = type->createColumnConst(1, value);
column.column = type->createColumnConst(1, converted);
column.name = name;
column.type = type;
return {{std::move(column)}};

View File

@ -17,13 +17,13 @@ void ASTLiteral::updateTreeHashImpl(SipHash & hash_state) const
void ASTLiteral::appendColumnNameImpl(WriteBuffer & ostr) const
{
/// 100 - just arbitrary value.
constexpr auto MIN_ELEMENTS_FOR_HASHING = 100;
constexpr auto min_elements_for_hashing = 100;
/// Special case for very large arrays and tuples. Instead of listing all elements, will use hash of them.
/// (Otherwise column name will be too long, that will lead to significant slowdown of expression analysis.)
auto type = value.getType();
if ((type == Field::Types::Array && value.get<const Array &>().size() > MIN_ELEMENTS_FOR_HASHING)
|| (type == Field::Types::Tuple && value.get<const Tuple &>().size() > MIN_ELEMENTS_FOR_HASHING))
if ((type == Field::Types::Array && value.get<const Array &>().size() > min_elements_for_hashing)
|| (type == Field::Types::Tuple && value.get<const Tuple &>().size() > min_elements_for_hashing))
{
SipHash hash;
applyVisitor(FieldVisitorHash(hash), value);