Skip to content

[SPARK-41293][SQL][TESTS] Code cleanup for assertXXX methods in ExpressionTypeCheckingSuite#38820

Closed
LuciferYang wants to merge 2 commits intoapache:masterfrom
LuciferYang:SPARK-41293
Closed

[SPARK-41293][SQL][TESTS] Code cleanup for assertXXX methods in ExpressionTypeCheckingSuite#38820
LuciferYang wants to merge 2 commits intoapache:masterfrom
LuciferYang:SPARK-41293

Conversation

@LuciferYang
Copy link
Contributor

@LuciferYang LuciferYang commented Nov 28, 2022

What changes were proposed in this pull request?

This pr do some code clean up for assertXXX method in ExpressionTypeCheckingSuite:

  1. Reuse analysisException instead of duplicate intercept[AnalysisException](assertSuccess(expr)) in assertErrorForXXX methods.
  2. remove assertError method that is no longer used
  3. Change assertErrorForXXX methods access scope to private due to they are only used in ExpressionTypeCheckingSuite.

Why are the changes needed?

Code clean up.

Does this PR introduce any user-facing change?

No, just for test

How was this patch tested?

Pass GitHub Actions

@github-actions github-actions bot added the SQL label Nov 28, 2022
@LuciferYang
Copy link
Contributor Author

cc @MaxGekk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

private def analysisException(expr: Expression): AnalysisException = {
    intercept[AnalysisException](assertSuccess(expr))
  }

@LuciferYang LuciferYang changed the title [SPARK-41293][TESTS] Extract a general assertError method to deduplicate code in ExpressionTypeCheckingSuite [SPARK-41293][TESTS] Cleanup assertErrorForXXX method in ExpressionTypeCheckingSuite Nov 28, 2022
@LuciferYang LuciferYang changed the title [SPARK-41293][TESTS] Cleanup assertErrorForXXX method in ExpressionTypeCheckingSuite [SPARK-41293][TESTS] Code clean up forassertErrorForXXX method in ExpressionTypeCheckingSuite Nov 28, 2022
@LuciferYang LuciferYang changed the title [SPARK-41293][TESTS] Code clean up forassertErrorForXXX method in ExpressionTypeCheckingSuite [SPARK-41293][TESTS] Code clean up for assertErrorForXXX method in ExpressionTypeCheckingSuite Nov 28, 2022
@LuciferYang LuciferYang changed the title [SPARK-41293][TESTS] Code clean up for assertErrorForXXX method in ExpressionTypeCheckingSuite [SPARK-41293][TESTS] Code cleanup for assertXXX methods in ExpressionTypeCheckingSuite Nov 28, 2022
@MaxGekk MaxGekk changed the title [SPARK-41293][TESTS] Code cleanup for assertXXX methods in ExpressionTypeCheckingSuite [SPARK-41293][SQL][TESTS] Code cleanup for assertXXX methods in ExpressionTypeCheckingSuite Nov 28, 2022
@MaxGekk
Copy link
Member

MaxGekk commented Nov 28, 2022

+1, LGTM. Merging to master. I have checked the test suite locally.
Thank you, @LuciferYang.

@MaxGekk MaxGekk closed this in c3de4ca Nov 28, 2022
@LuciferYang
Copy link
Contributor Author

thanks @MaxGekk

beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 15, 2022
…pressionTypeCheckingSuite`

### What changes were proposed in this pull request?
This pr do some code clean up for `assertXXX` method in `ExpressionTypeCheckingSuite`:

1.  Reuse `analysisException` instead of duplicate `intercept[AnalysisException](assertSuccess(expr))` in `assertErrorForXXX` methods.
2. remove  `assertError` method that is no longer used
3. Change `assertErrorForXXX` methods access scope to `private` due to they are only used in `ExpressionTypeCheckingSuite`.

### Why are the changes needed?
Code clean up.

### Does this PR introduce _any_ user-facing change?
No, just for test

### How was this patch tested?
Pass GitHub Actions

Closes apache#38820 from LuciferYang/SPARK-41293.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
beliefer pushed a commit to beliefer/spark that referenced this pull request Dec 18, 2022
…pressionTypeCheckingSuite`

### What changes were proposed in this pull request?
This pr do some code clean up for `assertXXX` method in `ExpressionTypeCheckingSuite`:

1.  Reuse `analysisException` instead of duplicate `intercept[AnalysisException](assertSuccess(expr))` in `assertErrorForXXX` methods.
2. remove  `assertError` method that is no longer used
3. Change `assertErrorForXXX` methods access scope to `private` due to they are only used in `ExpressionTypeCheckingSuite`.

### Why are the changes needed?
Code clean up.

### Does this PR introduce _any_ user-facing change?
No, just for test

### How was this patch tested?
Pass GitHub Actions

Closes apache#38820 from LuciferYang/SPARK-41293.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments