Skip to content

Conversation

@sarutak
Copy link
Member

@sarutak sarutak commented May 8, 2016

What changes were proposed in this pull request?

This PR introduce place holder for comment in generated code and the purpose is same for #12939 but much safer.

Generated code to be compiled doesn't include actual comments but includes place holder instead.

Place holders in generated code will be replaced with actual comments only at the time of logging.

Also, this PR can resolve SPARK-15205.

How was this patch tested?

Existing tests.

@SparkQA
Copy link

SparkQA commented May 8, 2016

Test build #58079 has finished for PR 12979 at commit 766f5c6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class SourceCode(val body: String, val comment: Map[String, String]) extends Serializable

@sarutak sarutak changed the title [SPARK-15205][SQL][WIP] Codegen can compile more than twice for the same source code [SPARK-15205][SQL][WIP] Codegen can compile the same code more than twice May 8, 2016
@SparkQA
Copy link

SparkQA commented May 11, 2016

Test build #58394 has finished for PR 12979 at commit 60b8e0b.

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

@sarutak sarutak changed the title [SPARK-15205][SQL][WIP] Codegen can compile the same code more than twice [SPARK-15205][SQL] Codegen can compile the same code more than twice May 18, 2016
@davies
Copy link
Contributor

davies commented May 18, 2016

@sarutak It's expected to compile twice on two different queries, it does not worth to optimize this corner case (ideally it should generate different source code even without comments).

@SparkQA
Copy link

SparkQA commented May 18, 2016

Test build #58746 has finished for PR 12979 at commit 4cb5ed3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class CodeAndComment(val body: String, val comment: Map[String, String]) extends Serializable

// as a function before. In that case, we just re-use it.
val code = s"/* ${toCommentSafeString(this.toString)} */"
ExprCode(code, subExprState.isNull, subExprState.value)
val placeHolder = s"/*{${ctx.freshName("comment_placeholder")}}*/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add extra {} here? we could also make comment_placeholder shorter

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, } is really needed.
If we have place holders like comment_placeholder1 and comment_placeholder12, and the actual comment Hello corresponds to comment_placeholder1, comment_placeholder1 will be replaced with Hello but also comment_placeholder12 will be replaced with Hello2.

@davies
Copy link
Contributor

davies commented May 18, 2016

These place holders are good for safety, could you update the PR title and description?

@sarutak sarutak changed the title [SPARK-15205][SQL] Codegen can compile the same code more than twice [SPARK-15165][SPARK-15205][SQL] Introduce place holder for comments in generated code May 18, 2016
@SparkQA
Copy link

SparkQA commented May 19, 2016

Test build #58866 has finished for PR 12979 at commit b7e7b3d.

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

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #58944 has finished for PR 12979 at commit 3c49567.

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

@sarutak
Copy link
Member Author

sarutak commented May 20, 2016

retest this please.

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #58945 has finished for PR 12979 at commit 6ebfa10.

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

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #58946 has finished for PR 12979 at commit 6ebfa10.

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

@sarutak sarutak force-pushed the SPARK-15205 branch 2 times, most recently from 4029d44 to 7fd047c Compare May 20, 2016 15:41
@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #59003 has finished for PR 12979 at commit 7fd047c.

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

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #59008 has finished for PR 12979 at commit a039d18.

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

@davies
Copy link
Contributor

davies commented May 20, 2016

LGTM,
Merging this into master and 2.0, thanks!

asfgit pushed a commit that referenced this pull request May 20, 2016
… in generated code

## What changes were proposed in this pull request?

This PR introduce place holder for comment in generated code and the purpose  is same for #12939 but much safer.

Generated code to be compiled doesn't include actual comments but includes place holder instead.

Place holders in generated code will be replaced with actual comments only at the time of  logging.

Also, this PR can resolve SPARK-15205.

## How was this patch tested?

Existing tests.

Author: Kousuke Saruta <[email protected]>

Closes #12979 from sarutak/SPARK-15205.

(cherry picked from commit 22947cd)
Signed-off-by: Davies Liu <[email protected]>
@davies
Copy link
Contributor

davies commented May 20, 2016

@sarutak Could you create another PR for 1.6? (If we have not fix the security bug in 1.6)

@asfgit asfgit closed this in 22947cd May 20, 2016
@sarutak
Copy link
Member Author

sarutak commented May 20, 2016

O.K, I'll do it. Need another PR for branch-1.5 too?

@davies
Copy link
Contributor

davies commented May 20, 2016

Maybe 1.5 and 1.6 could share the same PR (if no much conflicts)

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #59001 has finished for PR 12979 at commit 4029d44.

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

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #59004 has finished for PR 12979 at commit 9c7ff14.

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

asfgit pushed a commit that referenced this pull request May 25, 2016
## What changes were proposed in this pull request?

This PR fixes 3 slow tests:

1. `ParquetQuerySuite.read/write wide table`: This is not a good unit test as it runs more than 5 minutes. This PR removes it and add a new regression test in `CodeGenerationSuite`, which is more "unit".
2. `ParquetQuerySuite.returning batch for wide table`: reduce the threshold and use smaller data size.
3. `DatasetSuite.SPARK-14554: Dataset.map may generate wrong java code for wide table`: Improve `CodeFormatter.format`(introduced at #12979) can dramatically speed this it up.

## How was this patch tested?

N/A

Author: Wenchen Fan <[email protected]>

Closes #13273 from cloud-fan/test.

(cherry picked from commit 50b660d)
Signed-off-by: Cheng Lian <[email protected]>
asfgit pushed a commit that referenced this pull request May 25, 2016
## What changes were proposed in this pull request?

This PR fixes 3 slow tests:

1. `ParquetQuerySuite.read/write wide table`: This is not a good unit test as it runs more than 5 minutes. This PR removes it and add a new regression test in `CodeGenerationSuite`, which is more "unit".
2. `ParquetQuerySuite.returning batch for wide table`: reduce the threshold and use smaller data size.
3. `DatasetSuite.SPARK-14554: Dataset.map may generate wrong java code for wide table`: Improve `CodeFormatter.format`(introduced at #12979) can dramatically speed this it up.

## How was this patch tested?

N/A

Author: Wenchen Fan <[email protected]>

Closes #13273 from cloud-fan/test.
@sarutak sarutak deleted the SPARK-15205 branch June 4, 2021 20:47
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