mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
fix core dump when compile expression
This commit is contained in:
parent
bbd70932e2
commit
e650a6094a
@ -123,9 +123,11 @@ llvm::Value * nativeCast(llvm::IRBuilderBase & b, const DataTypePtr & from_type,
|
||||
}
|
||||
else if (to_type->isNullable())
|
||||
{
|
||||
auto * from_native_type = toNativeType(b, from_type);
|
||||
auto * to_native_type = toNativeType(b, to_type);
|
||||
auto * inner = nativeCast(b, from_type, value, removeNullable(to_type));
|
||||
return b.CreateInsertValue(llvm::Constant::getNullValue(from_native_type), inner, {0});
|
||||
auto * res_ptr = b.CreateAlloca(to_native_type);
|
||||
auto * res_value = b.CreateLoad(to_native_type, res_ptr);
|
||||
return b.CreateInsertValue(res_value, inner, {0});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1 @@
|
||||
4
|
@ -0,0 +1,4 @@
|
||||
CREATE TABLE test (col1 Nullable(DOUBLE), col2 Nullable(DOUBLE), col3 DOUBLE) ENGINE=Memory;
|
||||
|
||||
insert into test values(1.0 , 2.0, 3.0);
|
||||
select multiIf(col1 > 2, col2/col3, 4.0) from test SETTINGS min_count_to_compile_expression=0;
|
Loading…
Reference in New Issue
Block a user