#NEWLINE# def test_cross_plus_selection_becomes_join( self ) : #NEWLINE# #INDENT# 'Test that the optimizer compiles away cross-products.' #NEWLINE# with open ( 'examples/reachable.myl' ) as fh : #NEWLINE# #INDENT# query = fh . read ( ) #NEWLINE# #UNINDENT# def plan_contains_cross( plan ) : #NEWLINE# #INDENT# def f( op ) : #NEWLINE# #INDENT# if ( isinstance ( op , raco . algebra . CrossProduct ) and ( not isinstance ( op . left , raco . algebra . SingletonRelation ) ) ) : #NEWLINE# #INDENT# ( yield True ) #NEWLINE# #UNINDENT# #UNINDENT# return any ( plan . postorder ( f ) ) #NEWLINE# #UNINDENT# statements = self . parser . parse ( statements ) #NEWLINE# self . processor . evaluate ( statements ) #NEWLINE# lp = self . processor . get_logical_plan ( ) #NEWLINE# self . assertTrue ( plan_contains_cross ( lp ) ) #NEWLINE# pp = self . processor . get_physical_plan ( ) #NEWLINE# self . assertFalse ( plan_contains_cross ( pp ) )