def test_column_ref_table_aliases(self): context = QueryContext() table1 = ibis.table([('key1', 'string'), ('value1', 'double')]) table2 = ibis.table([('key2', 'string'), ('value and2', 'double')]) context.set_alias(table1, 't0') context.set_alias(table2, 't1') expr = table1['value1'] - table2['value and2'] result = self._translate(expr, context=context) expected = 't0.value1 - t1.`value and2`' assert result == expected
def test_column_ref_table_aliases(self): context = QueryContext() table1 = ibis.table([("key1", "string"), ("value1", "double")]) table2 = ibis.table([("key2", "string"), ("value and2", "double")]) context.set_alias(table1, "t0") context.set_alias(table2, "t1") expr = table1["value1"] - table2["value and2"] result = self._translate(expr, context=context) expected = "t0.value1 - t1.`value and2`" assert result == expected
def test_correlated_predicate_subquery(self): t0 = self.table t1 = t0.view() expr = t0.g == t1.g ctx = QueryContext() ctx.make_alias(t0) # Grab alias from parent context subctx = ctx.subcontext() subctx.make_alias(t1) subctx.make_alias(t0) result = self._translate(expr, context=subctx) expected = "t0.g = t1.g" assert result == expected
def __init__(self, expr, context=None, named=False, permit_subquery=False): self.expr = expr self.permit_subquery = permit_subquery if context is None: from ibis.sql.compiler import QueryContext context = QueryContext() self.context = context # For now, governing whether the result will have a name self.named = named
def test_column_ref_table_aliases(self): context = QueryContext() table1 = ibis.table([ ('key1', 'string'), ('value1', 'double') ]) table2 = ibis.table([ ('key2', 'string'), ('value and2', 'double') ]) context.set_alias(table1, 't0') context.set_alias(table2, 't1') expr = table1['value1'] - table2['value and2'] result = self._translate(expr, context=context) expected = 't0.value1 - t1.`value and2`' assert result == expected