-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add round, ceil, floor, truncate to the In-Database Column type #6988
Conversation
This implementation of round is a generic, "by hand" version using column arithmetic. This approach will only be used in a few cases; most of the time we can use the built-in ROUND() function in both backends. |
if (!special) { | ||
out[i] = doOperation(item); | ||
} else { | ||
String msg = "Value is " + item; |
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 error message needs to be more user friendly.
String msg = "Value is " + item; | |
String msg = "The operation " + name + " does not allow " + item + " as input, returning Nothing."; |
or sth like that
|
||
do_round -1.22222222225 10 . should_equal -1.2222222223 | ||
do_round -1.222222222225 11 . should_equal -1.22222222223 | ||
do_round -1.2222222222225 12 . should_equal -1.222222222223 | ||
do_round -1.22222222222225 13 . should_equal -1.2222222222223 | ||
do_round -1.222222222222225 14 . should_equal -1.22222222222223 | ||
do_round -1.2222222222222225 15 . should_equal -1.222222222222223 |
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 are these removed?
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.
Because SQLite fails this test. I could add this one line to the backend-specific test, with different 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.
Why does it fail it? Should we be concerned? (if not a big deal, I'm ok with removing it)
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.
Moved to backend-specific tests.
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.
Looks good, that is a really great piece of work.
I'd just make the message added to the Arithmetic_Error
a bit more clear and that's it
@@ -123,7 +123,7 @@ sqlite_specific_spec prefix connection setup = | |||
expected_code = code_template.replace "{Tinfo}" tinfo | |||
t.distinct ["strs"] . to_sql . prepare . should_equal [expected_code, []] | |||
|
|||
Test.group "[PostgreSQL] math functions" <| | |||
Test.group "[PostgreSQL] math functionsasdfasdf" <| |
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.
Test.group "[PostgreSQL] math functionsasdfasdf" <| | |
Test.group "[PostgreSQL] math functions" <| |
please remove these random letters though :)
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.
Done
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.