Esempio n. 1
0
    def test_column_ref_table_aliases(self):
        context = ImpalaContext()

        table1 = ibis.table([('key1', 'string'), ('value1', 'double')])

        table2 = ibis.table([('key2', 'string'), ('value and2', 'double')])

        context.set_ref(table1, 't0')
        context.set_ref(table2, 't1')

        expr = table1['value1'] - table2['value and2']

        result = self._translate(expr, context=context)
        expected = 't0.`value1` - t1.`value and2`'
        assert result == expected
Esempio n. 2
0
    def test_column_ref_table_aliases(self):
        context = ImpalaContext()

        table1 = ibis.table([("key1", "string"), ("value1", "double")])

        table2 = ibis.table([("key2", "string"), ("value and2", "double")])

        context.set_ref(table1, "t0")
        context.set_ref(table2, "t1")

        expr = table1["value1"] - table2["value and2"]

        result = self._translate(expr, context=context)
        expected = "t0.`value1` - t1.`value and2`"
        assert result == expected
Esempio n. 3
0
    def test_correlated_predicate_subquery(self):
        t0 = self.table
        t1 = t0.view()

        expr = t0.g == t1.g

        ctx = ImpalaContext()
        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
Esempio n. 4
0
    def test_correlated_predicate_subquery(self):
        t0 = self.table
        t1 = t0.view()

        expr = t0.g == t1.g

        ctx = ImpalaContext()
        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
Esempio n. 5
0
    def test_column_ref_table_aliases(self):
        context = ImpalaContext()

        table1 = ibis.table([
            ('key1', 'string'),
            ('value1', 'double')
        ])

        table2 = ibis.table([
            ('key2', 'string'),
            ('value and2', 'double')
        ])

        context.set_ref(table1, 't0')
        context.set_ref(table2, 't1')

        expr = table1['value1'] - table2['value and2']

        result = self._translate(expr, context=context)
        expected = 't0.`value1` - t1.`value and2`'
        assert result == expected