Skip to content

Conversation

@jiahuijiang
Copy link

What changes were proposed in this pull request?

Fixes https://issues.apache.org/jira/browse/SPARK-23823

Introduced in #19585

ResolveReferences stopped doing transfromsUp after this change and Attributes sometimes lose its correct origin

How was this patch tested?

Manually tested after this change analyze won't throw away correct Origin for columns

@jiahuijiang jiahuijiang changed the title [SPARK-23823][SQL] Fix ResolveReferences [SPARK-23823][SQL] ResolveReferences should preserve treenode origins Mar 29, 2018
@gatorsmile
Copy link
Member

@jiahuijiang Did you hit any error?

@gatorsmile
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Mar 30, 2018

Test build #88733 has finished for PR 20939 at commit b5588ca.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jiahuijiang
Copy link
Author

Yes, for any SQL queries with columns inside.
e.g. "create table /targetTable as (\nselect col1 from /path/to/table1\n)", after parsing the query, I got a QueryPlan where the "col1" project's origin is (2, 7). But after running analyzer.analyze on that query plan, the origin becomes (2, 0). Tested after this change it retains as (2, 7)

@gatorsmile
Copy link
Member

retest this please

@gatorsmile
Copy link
Member

@jiahuijiang Why do you need to check the value of origin? This is being used for error reporting only.

@SparkQA
Copy link

SparkQA commented Mar 30, 2018

Test build #88755 has finished for PR 20939 at commit b5588ca.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@jiahuijiang
Copy link
Author

We are implementing a language server that needs to understand where the column locations, so we are depending on some of these internal APIs

@jiahuijiang
Copy link
Author

jiahuijiang commented Apr 2, 2018

@gatorsmile Seems the tests are still flaking :/
And @robertzk proposed this fix #20961 instead, where we keep the origin directly inside transformExpression, so that all the mapChildren and mapExpressions automatically have their origins kept. Is it better to take that change instead?

@jiahuijiang
Copy link
Author

@gatorsmile Is #20961 crazy to do? It makes sure all the origins are kept correctly after analyzing, so future refactor won't cause similar issue. But not sure whether that behavior should be expected

@gatorsmile
Copy link
Member

#20961 looks good to me. Could you close this PR? Thanks!

@jiahuijiang jiahuijiang closed this Apr 4, 2018
@jiahuijiang jiahuijiang deleted the jj/fix-resolve-references branch April 4, 2018 13:16
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.

3 participants