ibis icon indicating copy to clipboard operation
ibis copied to clipboard

feat: column expressions from a base table should also be valid on top of a limited table

Open wesm opened this issue 10 years ago • 1 comments

Issue by wesm Monday Apr 13, 2015 at 18:30 GMT Originally opened as http://github.mtv.cloudera.com/wesm/ibis/issues/180


Consider for example:

table.limit(100).aggregate(agg_exprs)

when agg_exprs was built from table. Currently fails AFAICT. Sort of a pedantic issue but it happened to me

related: #83

wesm avatar Apr 21 '15 18:04 wesm

While it can happen I'm going to call this a non-issue for now and push off to a distant milestone

wesm avatar Apr 28 '15 22:04 wesm

This can be done with _:

In [18]: import ibis

In [19]: from ibis import _

In [20]: t = ibis.table(dict(a="int", b="string"))

In [21]: t.limit(100).aggregate(sum_a=_.a.sum())
Out[21]:
r0 := UnboundTable: unbound_table_3
  a int64
  b string

r1 := Limit[r0, n=100]

Aggregation[r1]
  metrics:
    sum_a: Sum(r1.a)

In [22]: t.limit(100).group_by(_.b).aggregate(sum_a=_.a.sum())
Out[22]:
r0 := UnboundTable: unbound_table_3
  a int64
  b string

r1 := Limit[r0, n=100]

Aggregation[r1]
  metrics:
    sum_a: Sum(r1.a)
  by:
    b: r1.b

Closing.

cpcloud avatar Aug 21 '22 11:08 cpcloud