Beispiel #1
0
    def test_memoize_aggregate_correctly(self):
        table = self.table

        agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis')
        agg_exprs = [table['a'].sum().name('sum(a)'),
                     table['b'].mean().name('mean(b)'), agg_expr]

        result = table.aggregate(agg_exprs, by=['g'])

        formatter = ExprFormatter(result)
        formatted = formatter.get_result()

        alias = formatter.memo.get_alias(table.op())
        assert formatted.count(alias) == 7
Beispiel #2
0
    def test_memoize_aggregate_correctly(self):
        table = self.table

        agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis')
        agg_exprs = [table['a'].sum().name('sum(a)'),
                     table['b'].mean().name('mean(b)'), agg_expr]

        result = table.aggregate(agg_exprs, by=['g'])

        formatter = ExprFormatter(result)
        formatted = formatter.get_result()

        alias = formatter.memo.get_alias(table)
        assert formatted.count(alias) == 7
Beispiel #3
0
def test_memoize_aggregate_correctly(table):
    agg_expr = (table['c'].sum() / table['c'].mean() - 1).name('analysis')
    metrics = [
        table['a'].sum().name('sum(a)'),
        table['b'].mean().name('mean(b)'),
        agg_expr,
    ]

    result = table.aggregate(metrics, by=['g'])

    formatter = ExprFormatter(result)
    formatted = formatter.get_result()

    alias = formatter.memo.get_alias(table)
    assert formatted.count(alias) == 7
Beispiel #4
0
 def _repr(self, memo=None):
     from ibis.expr.format import ExprFormatter
     return ExprFormatter(self, memo=memo).get_result()
Beispiel #5
0
    def _repr(self, memo: FormatMemo | None = None) -> str:
        from ibis.expr.format import ExprFormatter

        return ExprFormatter(self, memo=memo).get_result()
Beispiel #6
0
 def _repr(self):
     from ibis.expr.format import ExprFormatter
     return ExprFormatter(self).get_result()
Beispiel #7
0
    def _repr(self, memo: 'Optional[FormatMemo]' = None):
        from ibis.expr.format import ExprFormatter

        return ExprFormatter(self, memo=memo).get_result()