#NEWLINE# def test_loj_subquery_filter_handling( self ) : #NEWLINE# #INDENT# left = ibis . table ( [ ( 'id' , 'int32' ) , ( 'desc' , 'string' ) ] , 'foo' ) #NEWLINE# right = ibis . table ( [ ( 'id' , 'int32' ) , ( 'desc' , 'string' ) ] , 'bar' ) #NEWLINE# left = left [ ( left . id < 2 ) ] #NEWLINE# right = right [ ( right . id < 3 ) ] #NEWLINE# joined = left . left_join ( right , [ 'id' , 'desc' ] ) #NEWLINE# joined = joined [ ( [ left [ name ] . name ( ( 'left_' + name ) ) for name in left . columns ] + [ right [ name ] . name ( ( 'right_' + name ) ) for name in right . columns ] ) ] #NEWLINE# result = to_sql ( joined ) #NEWLINE# expected = 'SELECT t0.`id` AS `left_id`, t0.`desc` AS `left_desc`, t1.`id` AS `right_id`,\n       t1.`desc` AS `right_desc`\nFROM (\n  SELECT *\n  FROM foo\n  WHERE `id` < 2\n) t0\n  LEFT OUTER JOIN (\n    SELECT *\n    FROM bar\n    WHERE `id` < 3\n  ) t1\n    ON t0.`id` = t1.`id` AND\n       t0.`desc` = t1.`desc`' #NEWLINE# assert ( result == expected )