Fix low cardinality functions result cache if function can't be executed on default arguments.

This commit is contained in:
Nikolai Kochetov 2018-09-27 17:45:35 +03:00
parent 03d85227d1
commit 65c8a00e51

View File

@ -440,7 +440,8 @@ void PreparedFunctionImpl::execute(Block & block, const ColumnNumbers & args, si
if (auto * res_type_with_dict = typeid_cast<const DataTypeWithDictionary *>(res.type.get()))
{
const auto * low_cardinality_column = findLowCardinalityArgument(block, args);
bool use_cache = low_cardinality_result_cache
bool can_be_executed_on_default_arguments = canBeExecutedOnDefaultArguments();
bool use_cache = low_cardinality_result_cache && can_be_executed_on_default_arguments
&& low_cardinality_column && low_cardinality_column->isSharedDictionary();
PreparedFunctionLowCardinalityResultCache::DictionaryKey key;
@ -460,7 +461,7 @@ void PreparedFunctionImpl::execute(Block & block, const ColumnNumbers & args, si
block_without_dicts.safeGetByPosition(result).type = res_type_with_dict->getDictionaryType();
ColumnPtr indexes = replaceColumnsWithDictionaryByNestedAndGetDictionaryIndexes(
block_without_dicts, args, canBeExecutedOnDefaultArguments());
block_without_dicts, args, can_be_executed_on_default_arguments);
executeWithoutColumnsWithDictionary(block_without_dicts, args, result, block_without_dicts.rows());