-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix failing test #20634
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
Fix failing test #20634
Changes from 10 commits
05b61a1
92667a9
0fc9606
163b8f3
7e2629a
902ff86
2c80758
eb2bb40
736d2a1
cc2dd2f
e8007ca
3847509
a1839e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import io.airbyte.integrations.standardtest.source.TestDataHolder; | ||
import io.airbyte.integrations.standardtest.source.TestDestinationEnv; | ||
import io.airbyte.protocol.models.JsonSchemaType; | ||
import java.math.BigDecimal; | ||
ryankfu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import java.text.DateFormat; | ||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
|
@@ -146,7 +147,8 @@ protected void initTests() { | |
.sourceType("NUMBER") | ||
.airbyteType(JsonSchemaType.NUMBER) | ||
.addInsertValues("null", "1", "123.45", "power(10, -130)", "9.99999999999999999999 * power(10, 125)") | ||
.addExpectedValues(null, "1", "123.45", String.valueOf(Math.pow(10, -130)), String.valueOf(9.99999999999999999999 * Math.pow(10, 125))) | ||
.addExpectedValues(null, "1", "123.45", String.valueOf(Math.pow(10, -130)), | ||
"999999999999999999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this not possible to have the last expected value be String.valueOf(9.99999999999999999999 * Math.pow(10, 125) This would be difficult to understand, but if the usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might add in the comment the reason how come it's a plain string representation, like something along the lines of "because normalization expects values in integer strings whereas `Math.pow(10, 125)` returns a scientific notation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. thank you |
||
.build()); | ||
|
||
addDataTypeTestData( | ||
|
@@ -155,7 +157,7 @@ protected void initTests() { | |
.airbyteType(JsonSchemaType.NUMBER) | ||
.fullSourceDataType("NUMBER(6,-2)") | ||
.addInsertValues("123.89") | ||
.addExpectedValues("100.0") | ||
.addExpectedValues("100") | ||
.build()); | ||
|
||
addDataTypeTestData( | ||
|
@@ -164,7 +166,7 @@ protected void initTests() { | |
.airbyteType(JsonSchemaType.NUMBER) | ||
.fullSourceDataType("FLOAT(5)") | ||
.addInsertValues("1.34", "126.45") | ||
.addExpectedValues("1.3", "130.0") | ||
.addExpectedValues("1.3", "130") | ||
.build()); | ||
|
||
addDataTypeTestData( | ||
|
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.
If I'm understanding this correctly, this will be showing integer values only, right? I haven't seen the usage of
%.0f
before, normally it would have one decimal precision value.Also this seems to work but curious if this should be
since the string formatting is indicating a Float
f
vs Doubled
Uh oh!
There was an error while loading. Please reload this page.
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.
The weeds of floating point string format.
How I missed thee… :-)
f
signifies a floating point number - ad
modifier is a decimal integer I think, but it won't accept a double or float value.the
%.0f
formats a floating point number to print with 0 decimal digits (0 precision) - which is the expected string.And a
Float.valueOf("1.0E30")
is theoretically ok, but depending on actual hardware and implementation won't print as a clean1
with zeroes but some weird floating point "1000000015047466200000000000000" and so on- it's the whole single/double precision implementation of respective float/double types.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.
Thanks for the explanation, nothing else to add and glad for the clarification