Skip to content

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

Closed
kiszk wants to merge 5 commits into
apache:masterfrom
kiszk:SPARK-22219
Closed

[SPARK-22219][SQL] Refactor code to get a value for "spark.sql.codegen.comments"#19449
kiszk wants to merge 5 commits into
apache:masterfrom
kiszk:SPARK-22219

Conversation

@kiszk

@kiszkkiszk commented Oct 6, 2017

Copy link
Copy Markdown
Member

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
Copy Markdown

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.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
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.

@gatorsmilegatorsmileOct 8, 2017

Copy link
Copy Markdown
Member

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.

@kiszkkiszkOct 8, 2017

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
Contributor

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

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
Member

Hm, shall we leave this closed then?

@kiszk

Copy link
Copy Markdown
MemberAuthor

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

@SparkQA

Copy link
Copy Markdown

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.

.booleanConf
.createWithDefault(true)

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown

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
Copy Markdown
MemberAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

cc @gatorsmile

1 similar comment
@kiszk

Copy link
Copy Markdown
MemberAuthor

cc @gatorsmile

@HyukjinKwon

Copy link
Copy Markdown
Member

Seems okay to me.

@srowen

Copy link
Copy Markdown
Member

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

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown

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

kiszk commented Aug 1, 2018

Copy link
Copy Markdown
MemberAuthor

retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Member

LGTM pending Jenkins.

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
Member

retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
Member

retest this please

@gatorsmile

Copy link
Copy Markdown
Member

ok to test

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
Member

retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
Member

retest this please

@SparkQA

Copy link
Copy Markdown

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

kiszk commented Aug 2, 2018

Copy link
Copy Markdown
MemberAuthor

retest this please

@srowen

Copy link
Copy Markdown
Member

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
Copy Markdown

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
Copy Markdown
Member

Merged to master

@asfgitasfgit closed this in bbdcc3bAug 2, 2018
Sign up for freeto 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

@kiszk@SparkQA@tejasapatil@HyukjinKwon@srowen@gatorsmile@viirya