def test_hash_join(): simple_op = EqOp(Var('t1.x'), Var('t2.y')) ctx = {} comparison = join_keys(SCHEMA_1,SCHEMA_2, simple_op) j = tuple(hash_join(False,t1,t2, comparison, ctx)) eq_( j, ( (1,1,0), (1,1,1), ) ) multi_key = And( EqOp(Var('t1.x'), Var('t2.y')), EqOp(Var('t1.x'), Var('t2.z')), ) comparison = join_keys(SCHEMA_1,SCHEMA_2, multi_key) j = tuple(hash_join(False,t1,t2, comparison, ctx)) eq_( j, ( (1,1,1), ) )
def test_join_keys(): simple_op = EqOp(Var('t1.x'), Var('t2.y')) left_key, right_key = join_keys(SCHEMA_1,SCHEMA_2, simple_op) ctx = None eq_( left_key((1,), ctx), (1,) ) eq_( right_key((1,0), ctx), (1,) ) multi_key = And( EqOp(Var('t1.x'), Var('t2.y')), EqOp(Var('t1.x'), Var('t2.z')), ) left_key, right_key = join_keys(SCHEMA_1,SCHEMA_2, multi_key) eq_( left_key((1,), ctx), (1,1) ) eq_( right_key((1,0), ctx), (1,0) )