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-47179][SQL] Improve error message from SparkThrowableSuite for better debuggability #45273

Closed

Conversation

itholic
Copy link
Contributor

@itholic itholic commented Feb 27, 2024

What changes were proposed in this pull request?

This PR proposes to improve error message from SparkThrowableSuite for better debuggability

Why are the changes needed?

The current error message is not very actionable for developer who need regenerating the error class documentation.

Does this PR introduce any user-facing change?

No API change, but the error message is changed:

Before

The error class document is not up to date. Please regenerate it.

After

he error class document is not up to date. Please regenerate it by running `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "core/testOnly *SparkThrowableSuite -- -t \"Error classes match with document\""`

How was this patch tested?

The existing CI should pass.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the CORE label Feb 27, 2024
"The error class document is not up to date. Please regenerate it.")
"The error class document is not up to date. Please regenerate it by running " +
"`SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \"core/testOnly *SparkThrowableSuite -- -t " +
"\\\"Error classes match with document\\\"\"`")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a variable of string to replace this hardcoded instruction and put that val at the begging of this class and under the comment of how to re-generate the golden file?

The reason it is better because it is possible that the instruction of how to re-gen is updated but the developer fail to update the instruction in the such messages.

Copy link
Contributor

@amaliujia amaliujia Feb 27, 2024

Choose a reason for hiding this comment

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

E.g.

  /* Used to regenerate the error class file. Run:
   {{{
      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
        "core/testOnly *SparkThrowableSuite -- -t \"Error classes are correctly formatted\""
   }}}

   To regenerate the error class document. Run:
   {{{
      SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \
        "core/testOnly *SparkThrowableSuite -- -t \"Error classes match with document\""
   }}}
   */
   val error_message_instrcution = "Please regenerate it by running " +
            "`SPARK_GENERATE_GOLDEN_FILES=1 build/sbt \"core/testOnly *SparkThrowableSuite -- -t " +
            "\\\"Error classes match with document\\\"\"

The use the val in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. Will update

Copy link
Member

Choose a reason for hiding this comment

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

I agree but try to avoid duplicates. Just combine a short comment + a val with a command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

@MaxGekk
Copy link
Member

MaxGekk commented Feb 27, 2024

The failed test seems like unrelated:

[info] - interrupt tag *** FAILED *** (30 seconds, 244 milliseconds)
[info]   The code passed to eventually never returned normally. Attempted 40 times over 30.057059009 seconds. Last failure message: ListBuffer("02ddb716-97aa-44a7-985c-7eebbad97acb") had length 1 instead of expected length 2 Interrupted operations: ListBuffer(02ddb716-97aa-44a7-985c-7eebbad97acb).. (SparkSessionE2ESuite.scala:216)
[info]   org.scalatest.exceptions.TestFailedDueToTimeoutException:

@MaxGekk
Copy link
Member

MaxGekk commented Feb 27, 2024

+1, LGTM. Merging to master.
Thank you, @itholic and @amaliujia for review.

@MaxGekk MaxGekk closed this in 9d2fd5e Feb 27, 2024
@amaliujia
Copy link
Contributor

Late LGTM thanks!

@itholic
Copy link
Contributor Author

itholic commented Feb 28, 2024

Thanks all for the review!

TakawaAkirayo pushed a commit to TakawaAkirayo/spark that referenced this pull request Mar 4, 2024
… better debuggability

### What changes were proposed in this pull request?

This PR proposes to improve error message from SparkThrowableSuite for better debuggability

### Why are the changes needed?

The current error message is not very actionable for developer who need regenerating the error class documentation.

### Does this PR introduce _any_ user-facing change?

No API change, but the error message is changed:

**Before**
```
The error class document is not up to date. Please regenerate it.
```

**After**
```
he error class document is not up to date. Please regenerate it by running `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "core/testOnly *SparkThrowableSuite -- -t \"Error classes match with document\""`
```

### How was this patch tested?

The existing CI should pass.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#45273 from itholic/improve_error_suite_debuggability.

Authored-by: Haejoon Lee <haejoon.lee@databricks.com>
Signed-off-by: Max Gekk <max.gekk@gmail.com>
ericm-db pushed a commit to ericm-db/spark that referenced this pull request Mar 5, 2024
… better debuggability

### What changes were proposed in this pull request?

This PR proposes to improve error message from SparkThrowableSuite for better debuggability

### Why are the changes needed?

The current error message is not very actionable for developer who need regenerating the error class documentation.

### Does this PR introduce _any_ user-facing change?

No API change, but the error message is changed:

**Before**
```
The error class document is not up to date. Please regenerate it.
```

**After**
```
he error class document is not up to date. Please regenerate it by running `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "core/testOnly *SparkThrowableSuite -- -t \"Error classes match with document\""`
```

### How was this patch tested?

The existing CI should pass.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#45273 from itholic/improve_error_suite_debuggability.

Authored-by: Haejoon Lee <haejoon.lee@databricks.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
3 participants