Fixed nullIf function

This commit is contained in:
Alexey Milovidov 2019-08-21 04:28:55 +03:00
parent 449dc4757a
commit 69be2c4658

View File

@ -50,10 +50,10 @@ public:
auto equals_func = FunctionFactory::instance().get("equals", context)->build(
{temp_block.getByPosition(arguments[0]), temp_block.getByPosition(arguments[1])});
size_t not_equals_res_pos = temp_block.columns();
size_t equals_res_pos = temp_block.columns();
temp_block.insert({nullptr, equals_func->getReturnType(), ""});
equals_func->execute(temp_block, {arguments[0], arguments[1]}, not_equals_res_pos, input_rows_count);
equals_func->execute(temp_block, {arguments[0], arguments[1]}, equals_res_pos, input_rows_count);
/// Argument corresponding to the NULL value.
size_t null_pos = temp_block.columns();
@ -67,8 +67,8 @@ public:
temp_block.insert(null_elem);
auto func_if = FunctionFactory::instance().get("if", context)->build(
{temp_block.getByPosition(not_equals_res_pos), temp_block.getByPosition(null_pos), temp_block.getByPosition(arguments[0])});
func_if->execute(temp_block, {not_equals_res_pos, null_pos, arguments[0]}, result, input_rows_count);
{temp_block.getByPosition(equals_res_pos), temp_block.getByPosition(null_pos), temp_block.getByPosition(arguments[0])});
func_if->execute(temp_block, {equals_res_pos, null_pos, arguments[0]}, result, input_rows_count);
block.getByPosition(result).column = std::move(temp_block.getByPosition(result).column);
}