-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Port remaining tests in functions.rs to sqllogictest #6608
Conversation
@@ -87,5 +87,5 @@ pub fn decimal_to_str(value: Decimal) -> String { | |||
} | |||
|
|||
pub fn big_decimal_to_str(value: BigDecimal) -> String { | |||
value.round(12).normalized().to_string() | |||
value.round(16).normalized().to_string() |
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.
Sqrt(2)
returns a double value of 1.4142135623730951
.
the precision of value.round(12)
is not sufficient, 1.414213562373
is returned.
To improve accuracy, we could increase the rounding precision to value.round(16)
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.
will cause other testcase failed:
- pg_compat_simple.slt:76
- window.slt:441
- decimal.slt:391
- predicates.slt:47
- pg_compat_window.slt:692
so i reverted change.
SELECT sqrt(column1) FROM t | ||
---- | ||
1.4142135623730951 |
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 original test case had a value of 1
, but when I called sqrt(1)
in SQLLogicTest, it returned a value of 1
, which should have been displayed as 1.0
for clarity. To make the response more reasonable, I changed the value in the test case from 1
to 2
, it's will retrun 1.4142135623730951
# case_sensitive_identifiers_functions | ||
statement ok | ||
create table t as 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.
This data could replace the original test case. Can you guys provide some feedback?
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.
I think using 2 is a better value than 1 👍
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.
I think this looks great -- thank you @jiangzhx
# case_sensitive_identifiers_functions | ||
statement ok | ||
create table t as 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.
I think using 2 is a better value than 1 👍
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.
thank you @jiangzhx
I clicked by mistake, sorry ... |
Which issue does this PR close?
Closes #6300.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?