question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simple table reduction uses window operation instead of aggregation

See original GitHub issue

Actual behaviour

import ibis
t = ibis.table([('e', 'int64'), ('f', 'int32')])
expr1 = t[t.e.sum().name('e'), t.f.sum().name('f')]
expr1

download mysql compiles to

SELECT sum(t0.e) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS e, sum(t0.f) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS f 
FROM t5 AS t0

Expected behaviour

expr1 should aggregate instead of using window operation like the following expression

expr2 = t.aggregate([t.e.sum().name('e'), t.f.sum().name('f')])
expr2

image mysql compiles to

SELECT sum(t0.e) AS e, sum(t0.f) AS f 
FROM t5 AS t0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cpcloudcommented, Apr 7, 2022

@fuxinhao-crypto It looks like row_to_json isn’t a reduction. Can you try subclassing ValueOp instead?

0reactions
gforsythcommented, Apr 7, 2022

@fuxinhao-crypto – would you mind re-posing this question over in https://github.com/ibis-project/ibis/discussions so it’s more easily discoverable for other users?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data tutorial: Using Window Functions
Window Functions enable users to perform calculations against partitions, subgroups or sections, of a result such as a table or results from another...
Read more >
Implementing a generic REDUCE aggregate function with ...
A reduction is a generic aggregate function that operates on groups. So, we will have to re-use some SQL aggregate function mechanism to...
Read more >
SQL Window Functions vs. SQL Aggregate Functions
In SQL, window functions operate on a set of rows called a window frame. They return a single value for each row from...
Read more >
An Easy Guide to Advanced SQL Window Functions
This article is a guide on advanced window functions for data analysis in SQL. You'll learn through examples about aggregation, ranking, ...
Read more >
Data Aggregation in Tableau
In Tableau, multidimensional data sources are supported only in Windows. You can change the aggregation for a measure in the view from its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found