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

[SPARK-22219][SQL] Refactor code to get a value for "spark.sql.codegen.comments" #19449

Closed
wants to merge 5 commits into from

Conversation

kiszk
Copy link
Member

@kiszk kiszk commented Oct 6, 2017

What changes were proposed in this pull request?

This PR refactors code to get a value for "spark.sql.codegen.comments" by avoiding SparkEnv.get.conf. This PR uses SQLConf.get.codegenComments since SQLConf.get always returns an instance of SQLConf.

How was this patch tested?

Added test case to DebuggingSuite

@SparkQA
Copy link

SparkQA commented Oct 6, 2017

Test build #82520 has finished for PR 19449 at commit be4220d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -929,7 +929,7 @@ class CodegenContext {
// be extremely expensive in certain cases, such as deeply-nested expressions which operate over
// inputs with wide schemas. For more details on the performance issues that motivated this
// flat, see SPARK-15680.
if (SparkEnv.get != null && SparkEnv.get.conf.getBoolean("spark.sql.codegen.comments", false)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

note to other reviewers: for historical context why this was done, see https://github.com/apache/spark/pull/13421/files#r65268674

Copy link
Member

Choose a reason for hiding this comment

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

SQLConf is based on the active spark session. The active spark session is not always correctly set. Thus, we do not encourage the community to use SQLConf.

Copy link
Member

Choose a reason for hiding this comment

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

See the PR: #18568

Copy link
Contributor

Choose a reason for hiding this comment

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

There are places in codebase which do SQLConf.get (esp. CodeGenerator.scala which is being modified in this PR). Are you suggesting to change that everywhere like #18568 ? I think it will be good thing to do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for your comments. Is it better to pass SQLConf to the constructor of CodegenContext?

Copy link
Member

Choose a reason for hiding this comment

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

I am afraid it might require a lot of code changes if we add SQLConf to CodegenContext.

Copy link
Member

@gatorsmile gatorsmile Oct 8, 2017

Choose a reason for hiding this comment

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

@tejasapatil Maybe just do nothing now. We need to fix the bugs in active session management first.

Copy link
Member Author

@kiszk kiszk Oct 8, 2017

Choose a reason for hiding this comment

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

Good to hear that
@tejasapatil Could you please let us know when it is available as a PR?
I misunderstood @gatorsmile 's comment. I understood there is no activity to fix active session management.

Copy link
Member

Choose a reason for hiding this comment

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

So far, I do not have a bandwidth to fix it. If anybody is interested in this, please feel free to start it. This requires a design doc at first.

@tejasapatil
Copy link
Contributor

LGTM. There are already multiple places in codegen where SQLConf.get is being used so this will make things consistent

@@ -929,7 +929,7 @@ class CodegenContext {
// be extremely expensive in certain cases, such as deeply-nested expressions which operate over
// inputs with wide schemas. For more details on the performance issues that motivated this
// flat, see SPARK-15680.
Copy link
Member

Choose a reason for hiding this comment

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

We should move these comments to the SQLConf description.

@kiszk
Copy link
Member Author

kiszk commented May 18, 2018

When #21299 will be merged, I think that we can revisit this PR.

@SparkQA
Copy link

SparkQA commented May 18, 2018

Test build #90760 has finished for PR 19449 at commit be4220d.

  • This patch fails PySpark unit tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Hm, shall we leave this closed then?

@kiszk
Copy link
Member Author

kiszk commented Jul 16, 2018

Sorry for leaving this for a while. I will update it using StaticSQLConf soon.

@SparkQA
Copy link

SparkQA commented Jul 16, 2018

Test build #93118 has finished for PR 19449 at commit a198901.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -751,6 +751,12 @@ object SQLConf {
.booleanConf
.createWithDefault(true)

val MAX_CASES_BRANCHES = buildConf("spark.sql.codegen.maxCaseBranches")
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh..., I will remove this

@SparkQA
Copy link

SparkQA commented Jul 17, 2018

Test build #93148 has finished for PR 19449 at commit 8680026.

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

@kiszk
Copy link
Member Author

kiszk commented Jul 17, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Jul 17, 2018

Test build #93156 has finished for PR 19449 at commit 8680026.

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

@kiszk
Copy link
Member Author

kiszk commented Jul 17, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Jul 17, 2018

Test build #93159 has finished for PR 19449 at commit 8680026.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@kiszk
Copy link
Member Author

kiszk commented Jul 22, 2018

cc @gatorsmile

1 similar comment
@kiszk
Copy link
Member Author

kiszk commented Jul 30, 2018

cc @gatorsmile

@HyukjinKwon
Copy link
Member

Seems okay to me.

@srowen
Copy link
Member

srowen commented Jul 31, 2018

@kiszk looks OK except there's an old comment about moving the comments to the new member you've extracted.

@SparkQA
Copy link

SparkQA commented Jul 31, 2018

Test build #93841 has finished for PR 19449 at commit afe889d.

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

@SparkQA
Copy link

SparkQA commented Jul 31, 2018

Test build #4225 has finished for PR 19449 at commit afe889d.

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

@kiszk
Copy link
Member Author

kiszk commented Aug 1, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Aug 1, 2018

Test build #93852 has finished for PR 19449 at commit afe889d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

assert(res.length == 2)
assert(res.forall{ case (_, code) =>
code.contains("* Codegend pipeline") && code.contains("// input[")})
}
Copy link
Member

Choose a reason for hiding this comment

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

combine these two?

Seq(true, false).foreach { flag =>
  ...
  if (flag) {
     ...
  } else {
    ...
  }
}

@SparkQA
Copy link

SparkQA commented Aug 1, 2018

Test build #93895 has finished for PR 19449 at commit 253bc19.

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

@gatorsmile
Copy link
Member

LGTM pending Jenkins.

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #4229 has finished for PR 19449 at commit 253bc19.

  • This patch fails Spark unit tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #93923 has finished for PR 19449 at commit 253bc19.

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

@gatorsmile
Copy link
Member

retest this please

@gatorsmile
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #93953 has finished for PR 19449 at commit 253bc19.

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

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #93982 has finished for PR 19449 at commit 253bc19.

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

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #94014 has finished for PR 19449 at commit 253bc19.

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

@kiszk
Copy link
Member Author

kiszk commented Aug 2, 2018

retest this please

@srowen
Copy link
Member

srowen commented Aug 2, 2018

I think we have a problem in the kafka tests right now that will cause this to fail. Seems to be the cause several times now

@SparkQA
Copy link

SparkQA commented Aug 2, 2018

Test build #94049 has finished for PR 19449 at commit 253bc19.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen
Copy link
Member

srowen commented Aug 2, 2018

Merged to master

@asfgit asfgit closed this in bbdcc3b Aug 2, 2018
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.

7 participants