Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Chained mutate operations give wrong results #1799

Closed
ayushi04 opened this issue May 27, 2019 · 0 comments · Fixed by #1812
Closed

BUG: Chained mutate operations give wrong results #1799

ayushi04 opened this issue May 27, 2019 · 0 comments · Fixed by #1812
Assignees
Labels
bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API
Milestone

Comments

@ayushi04
Copy link

Mutate function is giving wrong output. Please check below sample example.

table_expr = ibis.table([('a', 'string'), ('b', 'string')]) 
table_expr1 = table_expr['b'].fillna('Short Term') 
table_expr = table_expr.mutate(b = table_expr1) 
table_expr2 = table_expr['a'].fillna('Short Term') 
table_expr = table_expr.mutate(a = table_expr2) 
print(ibis.impala.compile(table_expr)) 

For the above program output is :
SELECT isnull(a, 'Short Term') AS a, b FROM t0

instead of
SELECT isnull(a, 'Short Term') AS a, isnull(b, 'Short Term') AS b FROM t0

Let me know if anything is wrong in my understanding.

@cpcloud cpcloud added this to the 1.1.0 milestone May 31, 2019
@cpcloud cpcloud added bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API labels May 31, 2019
@cpcloud cpcloud self-assigned this May 31, 2019
@cpcloud cpcloud changed the title mutate function is not working correctly BUG: Chained mutate operations give wrong results Jun 1, 2019
cpcloud added a commit that referenced this issue Jun 7, 2019
Closes #1799    This was kind of a nasty one. The query flattening
optimization was far too  aggressive.    @toryhaavik Do you feel
comfortable reviewing this?    One downside to this fix is that
simple, single expression columns are not flattened into their
subquery anymore. This will be addressed in the future after the
compiler is refactored.
Author: Phillip Cloud <cpcloud@gmail.com>

Closes #1812 from cpcloud/mutate-chain-bug and squashes the following commits:

31dedd6 [Phillip Cloud] BUG: Chained mutate operations give wrong results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis expressions Issues or PRs related to the expression API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants