Skip to content

Conversation

@jiahuijiang
Copy link

@jiahuijiang jiahuijiang commented Mar 7, 2018

What changes were proposed in this pull request?

Fixes bug introduce in apache#19585

How was this patch tested?

Manually tested "projects" in the parsed logical plan have correct origin now

Please review http://spark.apache.org/contributing.html before opening a pull request.

@robert3005
Copy link

Can we propose this upstream? This looks like a generic bug and should be fixed there. Take a look at http://spark.apache.org/contributing.html

@jiahuijiang
Copy link
Author

@robert3005 kk! Btw in terms of testing, I can't find much reference on tests related to Origin... Should I just add a test to analyze a simple query and check the Origin for every expression?

@robert3005
Copy link

I would verify for the cases that it failed before that origin is the same before and after analysis.

Slightly curious what actual thing didn't respect this since TreeNode#transform/up/down preserves origin so must be some of the nested expressions

@jiahuijiang
Copy link
Author

It's broken by this commit apache@36b826f
marked as trivial :-P so pretty sure it's not intentional

var i = 0
while (i < arr.length) {
arr(i) = f(productElement(i))
CurrentOrigin.withOrigin(origin) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the origin you want - the one you want is productElement(i) since this is the element being mapped over. Fixing it here is hard because of types - as f takes Any. I spent some time looking at this yesterday and I think easiest thing to do is #344

@mccheah
Copy link

mccheah commented Mar 30, 2018

Closing in favor of #344

@mccheah mccheah closed this Mar 30, 2018
@jiahuijiang
Copy link
Author

closed by #344

@jiahuijiang jiahuijiang deleted the jj/fix-attributes branch March 30, 2018 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants