-
Notifications
You must be signed in to change notification settings - Fork 122
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
Tests for getAs() for Double, Integer types #375
Conversation
|
Null can be cast to any type without any exception. reference |
} | ||
|
||
/*test values: 5 gbp/gbp/<blank> etc. */ | ||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens in these tests with the wrong values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are converted to null. at present schema has "Nullable" field set to true
But is converted to 0.0, when this field is set to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. so we should move the df creation here and add that test - nullable change. this will be good documentation when we later encounter issues with user data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note
Nullable 'true' in schema. Unsupported values change to null
+-----------+------------+
|fieldDouble|fieldInteger|
+-----------+------------+
| 0.55| 55|
| 1.234| 1234|
| 34.0| null|
| 99.56| 9956|
| null| 56|
| 23.0| null|
| null| 45|
| 65.0| null|
| null| null|
| null| 23|
| 56.0| 56|
| null| null|
| null| 34|
| 78.0| null|
| 78.0| 87|
+-----------+------------+
Nullable 'false' in schema. Unsupported values change to Zero(0.0/0)
+-----------+------------+
|fieldDouble|fieldInteger|
+-----------+------------+
| 0.55| 55|
| 1.234| 1234|
| 34.0| 0|
| 99.56| 9956|
| 0.0| 56|
| 23.0| 0|
| 0.0| 45|
| 65.0| 0|
| 0.0| 0|
| 0.0| 23|
| 56.0| 56|
| 0.0| 0|
| 0.0| 34|
| 78.0| 0|
| 78.0| 87|
+-----------+------------+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the testcases includes Nullable - true and false for IntegerType and DoubleType.
|
||
Dataset<Row> df; | ||
|
||
@BeforeEach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use @before ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to @BeforeAll
e19add1
to
a41c123
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment for next time, it would be simpler to set up different dfs for different types - doubles/integers rather than having one df. tests should be as atomic as possible.
sample input/output
#355 (comment)