Skip to content

Commit

Permalink
[fix](null safe equal join) fix coredump if both sides of the conjunc…
Browse files Browse the repository at this point in the history
…t is not nullable (apache#36263)

## Proposed changes

For a null safe equal join, FE may generate a plan that both sides of
the conjuct are not nullable, which is a valid plan, BE will coredump in
this situation.

Issue Number: close #xxx

Coredump stacktrace:
```
#0  0x00007fff042caacf in raise () from /lib64/libc.so.6
#1  0x00007fff0429dea5 in abort () from /lib64/libc.so.6
apache#2  0x00005555a7ec7cad in ?? ()
apache#3  0x00005555a7eba34a in google::LogMessage::Fail() ()
apache#4  0x00005555a7ebd436 in google::LogMessage::SendToLog() ()
apache#5  0x00005555a7eb9e80 in google::LogMessage::Flush() ()
apache#6  0x00005555a7ebdc79 in google::LogMessageFatal::~LogMessageFatal() ()
apache#7  0x000055557824c9ac in doris::vectorized::IColumn::get_raw_data (this=0x60400387df90)
    at /mnt/disk2/tengjianping/doris-39/be/src/vec/columns/column.h:590
apache#8  0x00005555a4a85f32 in doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>::pack_fixeds<unsigned long> (this=0x6110086dcb50, 
    row_numbers=21, key_columns=std::vector of length 1, capacity 1 = {...}, 
    nullmap_columns=std::vector of length 0, capacity 0, 
    result=std::vector of length 21, capacity 21 = {...})
    at /mnt/disk2/tengjianping/doris-39/be/src/vec/common/hash_table/hash_map_context.h:405
apache#9  0x00005555a4a83a77 in doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>::init_serialized_keys (this=0x6110086dcb50, 
    key_columns=std::vector of length 1, capacity 1 = {...}, num_rows=21, null_map=0x0, 
    is_join=true, is_build=true, bucket_size=32)
    at /mnt/disk2/tengjianping/doris-39/be/src/vec/common/hash_table/hash_map_context.h:470
apache#10 0x00005555a48d9228 in doris::pipeline::ProcessHashTableBuild<doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false> >::run<1, false, false, false> (this=0x75d6195d92a0, hash_table_ctx=..., null_map=0x0, has_null_key=0x6120057db3c0)
    at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/exec/hashjoin_build_sink.h:208
apache#11 0x00005555a456dd23 in doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeS   tate*, doris::vectorized::Block&)::$_1::operator()<doris::vectorized::MethodKeysFixed<doris::JoinHashTable<      unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<do--Type <RET> for more, q to qu
--Type <RET> for more, q to quit, c to continue without paging--c
ris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>, std::integral_constant<bool, false>, std::integral_constant<bool, false> >(doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>, std::integral_constant<bool, false>, std::integral_constant<bool, false>) const (this=0x75d61989aa10, arg=..., join_op=..., has_null_value=..., short_circuit_for_null_in_build_side=..., with_other_conjuncts=...) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/exec/hashjoin_build_sink.cpp:296
apache#12 0x00005555a456d93c in std::__invoke_impl<doris::Status, doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>, std::integral_constant<bool, false>, std::integral_constant<bool, false> >(std::__invoke_other, doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>&&, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>&&, std::integral_constant<bool, false>&&, std::integral_constant<bool, false>&&) (__f=..., __args=..., __args=..., __args=..., __args=..., __args=...) at /mnt/disk2/tengjianping/local/ldb_toolchain/bin/../lib64/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61
apache#13 0x00005555a456d88c in std::__invoke<doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>, std::integral_constant<bool, false>, std::integral_constant<bool, false> >(doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>&&, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>&, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>&, std::integral_constant<bool, false>&&, std::integral_constant<bool, false>&&, std::integral_constant<bool, false>&&) (__fn=..., __args=..., __args=..., __args=..., __args=..., __args=...) at /mnt/disk2/tengjianping/local/ldb_toolchain/bin/../lib64/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96
apache#14 0x00005555a43eef75 in _ZNSt8__detail9__variant17__gen_vtable_implINS0_12_Multi_arrayIPFNS0_21__deduce_visit_resultIN5doris6StatusEEEONS4_10vectorized8OverloadIJZNS4_8pipeline27HashJoinBuildSinkLocalState19process_build_blockEPNS4_12RuntimeStateERNS7_5BlockEE3$_0ZNSA_19process_build_blockESC_SE_E3$_1EEERSt7variantIJSt9monostateNS7_16MethodSerializedINS4_13JoinHashTableINS4_9StringRefE11DefaultHashISN_vEEEEENS7_15MethodOneNumberIhNSM_Ih9HashCRC32IhEEEEENSS_ItNSM_ItST_ItEEEEENSS_IjNSM_IjST_IjEEEEENSS_ImNSM_ImST_ImEEEEENSS_IN4wide7integerILm128EjEENSM_IS18_ST_IS18_EEEEENSS_INS17_ILm256EjEENSM_IS1C_ST_IS1C_EEEEENS7_15MethodKeysFixedIS14_Lb1EEENS1G_IS14_Lb0EEENS1G_IS1A_Lb1EEENS1G_IS1A_Lb0EEENS1G_IS1E_Lb1EEENS1G_IS1E_Lb0EEENS1G_INSM_INS7_7UInt136EST_IS1N_EEELb1EEENS1G_IS1P_Lb0EEEEERSJ_IJSt17integral_constantINS4_7TJoinOp4typeELS1W_0EES1U_IS1W_LS1W_2EES1U_IS1W_LS1W_8EES1U_IS1W_LS1W_1EES1U_IS1W_LS1W_4EES1U_IS1W_LS1W_3EES1U_IS1W_LS1W_5EES1U_IS1W_LS1W_7EES1U_IS1W_LS1W_9EES1U_IS1W_LS1W_10EES1U_IS1W_LS1W_11EEEEOSJ_IJS1U_IbLb0EES1U_IbLb1EEEES2D_S2D_EJEEESt16integer_sequenceImJLm9ELm3ELm0ELm0ELm0EEEE14__visit_invokeESI_S1T_S29_S2D_S2D_S2D_ (__visitor=..., __vars=..., __vars=..., __vars=..., __vars=..., __vars=...) at /mnt/disk2/tengjianping/local/ldb_toolchain/bin/../lib64/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:1013
apache#15 0x00005555a43cf068 in std::__do_visit<std::__detail::__variant::__deduce_visit_result<doris::Status>, doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>, std::variant<std::monostate, doris::vectorized::MethodSerialized<doris::JoinHashTable<doris::StringRef, DefaultHash<doris::StringRef, void> > >, doris::vectorized::MethodOneNumber<unsigned char, doris::JoinHashTable<unsigned char, HashCRC32<unsigned char> > >, doris::vectorized::MethodOneNumber<unsigned short, doris::JoinHashTable<unsigned short, HashCRC32<unsigned short> > >, doris::vectorized::MethodOneNumber<unsigned int, doris::JoinHashTable<unsigned int, HashCRC32<unsigned int> > >, doris::vectorized::MethodOneNumber<unsigned long, doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> > >, doris::vectorized::MethodOneNumber<wide::integer<128ul, unsigned int>, doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > > >, doris::vectorized::MethodOneNumber<wide::integer<256ul, unsigned int>, doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > > >, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, false> >&, std::variant<std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)0>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)2>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)8>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)4>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)3>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)5>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)7>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)9>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)10>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)11> >&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> > >(doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>&&, std::variant<std::monostate, doris::vectorized::MethodSerialized<doris::JoinHashTable<doris::StringRef, DefaultHash<doris::StringRef, void> > >, doris::vectorized::MethodOneNumber<unsigned char, doris::JoinHashTable<unsigned char, HashCRC32<unsigned char> > >, doris::vectorized::MethodOneNumber<unsigned short, doris::JoinHashTable<unsigned short, HashCRC32<unsigned short> > >, doris::vectorized::MethodOneNumber<unsigned int, doris::JoinHashTable<unsigned int, HashCRC32<unsigned int> > >, doris::vectorized::MethodOneNumber<unsigned long, doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> > >, doris::vectorized::MethodOneNumber<wide::integer<128ul, unsigned int>, doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > > >, doris::vectorized::MethodOneNumber<wide::integer<256ul, unsigned int>, doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > > >, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, false> >&, std::variant<std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)0>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)2>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)8>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)4>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)3>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)5>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)7>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)9>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)10>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)11> >&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&) (__visitor=..., __variants=..., __variants=..., __variants=..., __variants=..., __variants=...) at /mnt/disk2/tengjianping/local/ldb_toolchain/bin/../lib64/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:1714
apache#16 0x00005555a43c8dea in std::visit<doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>, std::variant<std::monostate, doris::vectorized::MethodSerialized<doris::JoinHashTable<doris::StringRef, DefaultHash<doris::StringRef, void> > >, doris::vectorized::MethodOneNumber<unsigned char, doris::JoinHashTable<unsigned char, HashCRC32<unsigned char> > >, doris::vectorized::MethodOneNumber<unsigned short, doris::JoinHashTable<unsigned short, HashCRC32<unsigned short> > >, doris::vectorized::MethodOneNumber<unsigned int, doris::JoinHashTable<unsigned int, HashCRC32<unsigned int> > >, doris::vectorized::MethodOneNumber<unsigned long, doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> > >, doris::vectorized::MethodOneNumber<wide::integer<128ul, unsigned int>, doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > > >, doris::vectorized::MethodOneNumber<wide::integer<256ul, unsigned int>, doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > > >, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, false> >&, std::variant<std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)0>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)2>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)8>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)4>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)3>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)5>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)7>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)9>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)10>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)11> >&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> > >(doris::vectorized::Overload<doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_0, doris::pipeline::HashJoinBuildSinkLocalState::process_build_block(doris::RuntimeState*, doris::vectorized::Block&)::$_1>&&, std::variant<std::monostate, doris::vectorized::MethodSerialized<doris::JoinHashTable<doris::StringRef, DefaultHash<doris::StringRef, void> > >, doris::vectorized::MethodOneNumber<unsigned char, doris::JoinHashTable<unsigned char, HashCRC32<unsigned char> > >, doris::vectorized::MethodOneNumber<unsigned short, doris::JoinHashTable<unsigned short, HashCRC32<unsigned short> > >, doris::vectorized::MethodOneNumber<unsigned int, doris::JoinHashTable<unsigned int, HashCRC32<unsigned int> > >, doris::vectorized::MethodOneNumber<unsigned long, doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> > >, doris::vectorized::MethodOneNumber<wide::integer<128ul, unsigned int>, doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > > >, doris::vectorized::MethodOneNumber<wide::integer<256ul, unsigned int>, doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > > >, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<unsigned long, HashCRC32<unsigned long> >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<128ul, unsigned int>, HashCRC32<wide::integer<128ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<wide::integer<256ul, unsigned int>, HashCRC32<wide::integer<256ul, unsigned int> > >, false>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, true>, doris::vectorized::MethodKeysFixed<doris::JoinHashTable<doris::vectorized::UInt136, HashCRC32<doris::vectorized::UInt136> >, false> >&, std::variant<std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)0>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)2>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)8>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)1>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)4>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)3>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)5>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)7>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)9>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)10>, std::integral_constant<doris::TJoinOp::type, (doris::TJoinOp::type)11> >&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&, std::variant<std::integral_constant<bool, false>, std::integral_constant<bool, true> >&&) (__visitor=..., __variants=..., __variants=..., __variants=..., __variants=..., __variants=...) at /mnt/disk2/tengjianping/local/ldb_toolchain/bin/../lib64/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/variant:1769
apache#17 0x00005555a43c848d in doris::pipeline::HashJoinBuildSinkLocalState::process_build_block (this=0x616000669080, state=0x61e003eca080, block=...) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/exec/hashjoin_build_sink.cpp:278
apache#18 0x00005555a43cd0a2 in doris::pipeline::HashJoinBuildSinkOperatorX::sink (this=0x613001702bc0, state=0x61e003eca080, in_block=0x60d0000f7d40, eos=true) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/exec/hashjoin_build_sink.cpp:557
apache#19 0x00005555a7bdd4e1 in doris::pipeline::PipelineTask::execute(bool*)::$_1::operator()() const (this=0x75d619925bd0) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/pipeline_task.cpp:356
apache#20 0x00005555a7bda84c in doris::pipeline::PipelineTask::execute (this=0x61700073d800, eos=0x75d6198f4230) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/pipeline_task.cpp:359
apache#21 0x00005555a7c34c6a in doris::pipeline::TaskScheduler::_do_work (this=0x60b00226b9e0, index=10) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/task_scheduler.cpp:135
apache#22 0x00005555a7c374bb in doris::pipeline::TaskScheduler::start()::$_0::operator()() const (this=0x6060055527f8) at /mnt/disk2/tengjianping/doris-39/be/src/pipeline/task_scheduler.cpp:64
```
  • Loading branch information
jacktengg authored Jun 14, 2024
1 parent a89a358 commit 56ac976
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 4 deletions.
10 changes: 8 additions & 2 deletions be/src/pipeline/exec/hashjoin_build_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,14 @@ Status HashJoinBuildSinkOperatorX::init(const TPlanNode& tnode, RuntimeState* st
const auto vexpr = _build_expr_ctxs.back()->root();

/// null safe equal means null = null is true, the operator in SQL should be: <=>.
const bool is_null_safe_equal = eq_join_conjunct.__isset.opcode &&
eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL;
const bool is_null_safe_equal =
eq_join_conjunct.__isset.opcode &&
(eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL) &&
// For a null safe equal join, FE may generate a plan that
// both sides of the conjuct are not nullable, we just treat it
// as a normal equal join conjunct.
(eq_join_conjunct.right.nodes[0].is_nullable ||
eq_join_conjunct.left.nodes[0].is_nullable);

const bool should_convert_to_nullable = is_null_safe_equal &&
!eq_join_conjunct.right.nodes[0].is_nullable &&
Expand Down
8 changes: 6 additions & 2 deletions be/src/pipeline/exec/hashjoin_probe_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,17 @@ Status HashJoinProbeOperatorX::init(const TPlanNode& tnode, RuntimeState* state)
RETURN_IF_ERROR(vectorized::VExpr::create_expr_tree(eq_join_conjunct.left, ctx));
_probe_expr_ctxs.push_back(ctx);
bool null_aware = eq_join_conjunct.__isset.opcode &&
eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL;
eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL &&
(eq_join_conjunct.right.nodes[0].is_nullable ||
eq_join_conjunct.left.nodes[0].is_nullable);
probe_not_ignore_null[conjuncts_index] =
null_aware ||
(_probe_expr_ctxs.back()->root()->is_nullable() && probe_dispose_null);
conjuncts_index++;
const bool is_null_safe_equal = eq_join_conjunct.__isset.opcode &&
eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL;
(eq_join_conjunct.opcode == TExprOpcode::EQ_FOR_NULL) &&
(eq_join_conjunct.right.nodes[0].is_nullable ||
eq_join_conjunct.left.nodes[0].is_nullable);

/// If it's right anti join,
/// we should convert the probe to nullable if the build side is nullable.
Expand Down
5 changes: 5 additions & 0 deletions regression-test/data/query_p0/join/rqg/rqg12257/rqg12257.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !rqg12257 --

-- !rqg12257_2 --

Loading

0 comments on commit 56ac976

Please sign in to comment.