@@ -806,7 +806,7 @@ TEST(StreamingHashJoin, SimpleJoinTests)
806806 context);
807807
808808 // / Additional range between
809- if (Streaming::isAppendStorage (left_data_stream_semantic) && kind == JoinKind::Inner && strictness == JoinStrictness::All
809+ if (Streaming::isAppendStorage (left_data_stream_semantic) && ( kind == JoinKind::Inner || kind == JoinKind::Left) && strictness == JoinStrictness::All
810810 && Streaming::isAppendStorage (right_data_stream_semantic))
811811 {
812812 commonTest (
@@ -826,6 +826,118 @@ TEST(StreamingHashJoin, SimpleJoinTests)
826826 }
827827}
828828
829+ TEST (StreamingHashJoin, AppendLeftAllJoinAppend)
830+ {
831+ auto context = getContext ().context ;
832+ Block left_header = prepareBlock (/* types*/ {" int" , " datetime64(3, 'UTC')" }, /* no data*/ " " , context);
833+ Block right_header = prepareBlock (/* types*/ {" int" , " datetime64(3, 'UTC')" }, /* no data*/ " " , context);
834+
835+ // / stream(t1) left all join stream(t2) on t1.col_1 = t2.col_1
836+ commonTest (
837+ " left" ,
838+ " all" ,
839+ /* on_clause*/ " t1.col_1 = t2.col_1" ,
840+ left_header,
841+ Streaming::StorageSemantic::Append,
842+ /* left_primary_key_column_indexes*/ std::nullopt ,
843+ right_header,
844+ Streaming::StorageSemantic::Append,
845+ /* right_primary_key_column_indexes*/ std::nullopt ,
846+ /* to_join_steps*/
847+ {
848+ {
849+ /* to join pos*/ ToJoinStep::RIGHT,
850+ /* to join block*/ prepareBlockByHeader (right_header, " (1, '2023-1-1 00:00:00')" , context),
851+ /* expected join results*/ ExpectedJoinResults{},
852+ },
853+ {
854+ /* to join pos*/ ToJoinStep::LEFT,
855+ /* to join block*/ prepareBlockByHeader (left_header, " (1, '2023-1-1 00:00:00')(2, '2023-1-1 00:00:00')" , context),
856+ /* expected join results*/
857+ ExpectedJoinResults{
858+ // / output header: col_1, col_2, t2.col_2
859+ .values = " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:00')"
860+ " (2, '2023-1-1 00:00:00', '1970-1-1 00:00:00')" ,
861+ },
862+ },
863+ },
864+ context);
865+ }
866+
867+ TEST (StreamingHashJoin, AppendLeftRangeJoinAppend)
868+ {
869+ auto context = getContext ().context ;
870+ Block left_header = prepareBlock (/* types*/ {" int" , " datetime64(3, 'UTC')" }, /* no data*/ " " , context);
871+ Block right_header = prepareBlock (/* types*/ {" int" , " datetime64(3, 'UTC')" }, /* no data*/ " " , context);
872+
873+ commonTest (
874+ " left" ,
875+ " all" ,
876+ /* on_clause*/ " t1.col_1 = t2.col_1 and date_diff_within(2s, t1.col_2, t2.col_2)" ,
877+ left_header,
878+ Streaming::StorageSemantic::Append,
879+ /* left_primary_key_column_indexes*/ std::nullopt ,
880+ right_header,
881+ Streaming::StorageSemantic::Append,
882+ /* right_primary_key_column_indexes*/ std::nullopt ,
883+ /* to_join_steps*/
884+ {
885+ {
886+ /* to join pos*/ ToJoinStep::RIGHT,
887+ /* to join block*/ prepareBlockByHeader (right_header, " (1, '2023-1-1 00:00:00')(1, '2023-1-1 00:00:01')" , context),
888+ /* expected join results*/ ExpectedJoinResults{},
889+ },
890+ {
891+ /* to join pos*/ ToJoinStep::LEFT,
892+ /* to join block*/ prepareBlockByHeader (left_header, " (1, '2023-1-1 00:00:00')(2, '2023-1-1 00:00:00')" , context),
893+ /* expected join results*/
894+ ExpectedJoinResults{
895+ // / output header: col_1, col_2, t2.col_2
896+ .values = " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:00')(1, '2023-1-1 00:00:00', '2023-1-1 00:00:01')"
897+ " (2, '2023-1-1 00:00:00', '1970-1-1 00:00:00')" ,
898+ },
899+ },
900+ {
901+ /* to join pos*/ ToJoinStep::RIGHT,
902+ /* to join block*/ prepareBlockByHeader (right_header, " (1, '2023-1-1 00:00:02')(1, '2023-1-1 00:00:03')(2, '2023-1-1 00:00:02')(2, '2023-1-1 00:00:03')" , context),
903+ /* expected join results*/
904+ ExpectedJoinResults{
905+ // / output header: col_1, col_2, t2.col_2
906+ .values = " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:02')"
907+ " (2, '2023-1-1 00:00:00', '2023-1-1 00:00:02')" ,
908+ },
909+ },
910+ {
911+ /* to join pos*/ ToJoinStep::LEFT,
912+ /* to join block*/ prepareBlockByHeader (left_header, " (1, '2023-1-1 00:00:00')(1, '2023-1-1 00:00:02')" , context),
913+ /* expected join results*/
914+ ExpectedJoinResults{
915+ // / output header: col_1, col_2, t2.col_2
916+ .values = " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:00')"
917+ " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:01')"
918+ " (1, '2023-1-1 00:00:00', '2023-1-1 00:00:02')"
919+ " (1, '2023-1-1 00:00:02', '2023-1-1 00:00:00')"
920+ " (1, '2023-1-1 00:00:02', '2023-1-1 00:00:01')"
921+ " (1, '2023-1-1 00:00:02', '2023-1-1 00:00:02')"
922+ " (1, '2023-1-1 00:00:02', '2023-1-1 00:00:03')" ,
923+ },
924+ },
925+ {
926+ /* to join pos*/ ToJoinStep::LEFT,
927+ /* to join block*/ prepareBlockByHeader (left_header, " (2, '2023-1-1 00:00:00')(2, '2023-1-1 00:00:02')(3, '2023-1-1 00:00:03')" , context),
928+ /* expected join results*/
929+ ExpectedJoinResults{
930+ // / output header: col_1, col_2, t2.col_2
931+ .values = " (2, '2023-1-1 00:00:00', '2023-1-1 00:00:02')"
932+ " (2, '2023-1-1 00:00:02', '2023-1-1 00:00:02')"
933+ " (2, '2023-1-1 00:00:02', '2023-1-1 00:00:03')"
934+ " (3, '2023-1-1 00:00:03', '1970-1-1 00:00:00')" ,
935+ },
936+ },
937+ },
938+ context);
939+ }
940+
829941TEST (StreamingHashJoin, AppendLeftAsofJoinAppend)
830942{
831943 auto context = getContext ().context ;
0 commit comments