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-31820][SQL][TESTS] Fix flaky JavaBeanDeserializationSuite #28639

Closed

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented May 26, 2020

What changes were proposed in this pull request?

Modified formatting of expected timestamp strings in the test JavaBeanDeserializationSuite.testSpark22000 to correctly format timestamps with zero seconds fraction. Current implementation outputs .0 but must be empty string. From SPARK-31820 failure:

  • should be 2020-05-25 12:39:17
  • but incorrect expected string is 2020-05-25 12:39:17.0

Why are the changes needed?

To make JavaBeanDeserializationSuite stable, and avoid test failures like #28630 (comment)

Does this PR introduce any user-facing change?

No

How was this patch tested?

I changed

new java.sql.Timestamp(System.currentTimeMillis()),
to

new java.sql.Timestamp((System.currentTimeMillis() / 1000) * 1000),

to force zero seconds fraction.

@SparkQA
Copy link

SparkQA commented May 26, 2020

Test build #123109 has finished for PR 28639 at commit 3c191a9.

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

@MaxGekk
Copy link
Member Author

MaxGekk commented May 26, 2020

jenkins, retest this, please

@MaxGekk
Copy link
Member Author

MaxGekk commented May 26, 2020

@HeartSaVioR @srowen @maropu @cloud-fan @HyukjinKwon Please, review this fix. I think it is related to #23854 and #24112

@@ -210,6 +212,17 @@ private static Row createRecordSpark22000Row(Long index) {
return new GenericRow(values);
}

private static String timestampToString(Timestamp ts) {
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we reuse FractionTimestampFormatter?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could but if we introduce a bug to the formatter, we could catch it by this test.

Copy link
Member Author

Choose a reason for hiding this comment

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

One more thing, if we use the same formatter for expected and actual results, checking current timestamps doesn't make so much sense. In that case, we could test a concrete timestamp.

@@ -210,6 +212,17 @@ private static Row createRecordSpark22000Row(Long index) {
return new GenericRow(values);
}

private static String timestampToString(Timestamp ts) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented May 26, 2020

Test build #123112 has finished for PR 28639 at commit 3c191a9.

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

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

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

LGTM

@cloud-fan cloud-fan closed this in 87d34e6 May 26, 2020
@cloud-fan
Copy link
Contributor

thanks, merging to master/3.0!

cloud-fan pushed a commit that referenced this pull request May 26, 2020
### What changes were proposed in this pull request?
Modified formatting of expected timestamp strings in the test `JavaBeanDeserializationSuite`.`testSpark22000` to correctly format timestamps with **zero** seconds fraction. Current implementation outputs `.0` but must be empty string. From SPARK-31820 failure:
- should be `2020-05-25 12:39:17`
- but incorrect expected string is `2020-05-25 12:39:17.0`

### Why are the changes needed?
To make `JavaBeanDeserializationSuite` stable, and avoid test failures like #28630 (comment)

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

### How was this patch tested?
I changed https://github.com/apache/spark/blob/7dff3b125de23a4d6ce834217ee08973b259414c/sql/core/src/test/java/test/org/apache/spark/sql/JavaBeanDeserializationSuite.java#L207 to
```java
new java.sql.Timestamp((System.currentTimeMillis() / 1000) * 1000),
```
to force zero seconds fraction.

Closes #28639 from MaxGekk/fix-JavaBeanDeserializationSuite.

Authored-by: Max Gekk <max.gekk@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 87d34e6)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@SparkQA
Copy link

SparkQA commented May 26, 2020

Test build #123114 has finished for PR 28639 at commit 3c191a9.

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

@MaxGekk MaxGekk deleted the fix-JavaBeanDeserializationSuite branch June 5, 2020 19:44
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.

5 participants