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

Add from_ieee754_32 Presto function #7903

Closed

Conversation

pdabre12
Copy link
Contributor

@pdabre12 pdabre12 commented Dec 6, 2023

Copy link

netlify bot commented Dec 6, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 0d8a91a
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6605bdd759471600086577c8

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 6, 2023
@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch from b063468 to 82678ad Compare January 5, 2024 10:10
@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch from 82678ad to b8a6db1 Compare January 29, 2024 18:25
Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pdabre12.

Code looks good. Small comment in the tests.

@aditi-pandit
Copy link
Collaborator

@pdabre12 : Please can you add results of ExpressionFuzzer with this function https://facebookincubator.github.io/velox/develop/testing/fuzzer.html#how-to-run

@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch 2 times, most recently from 43a3ce1 to e2093e2 Compare February 1, 2024 06:01
@majetideepak majetideepak requested a review from czentgr February 1, 2024 17:36
@pdabre12
Copy link
Contributor Author

pdabre12 commented Feb 1, 2024

This test fails because

Expected equality of these values:

std::numeric_limits<float>::quiet_NaN()
    Which is: nan
  fromIEEE754Bits32( toIEEE754Bits32(std::numeric_limits<float>::quiet_NaN()))
  Which is: (nan)

Any suggestions of what I can do about the parenthesis () surrounding nan?

@czentgr
Copy link
Collaborator

czentgr commented Feb 2, 2024

This test fails because

Expected equality of these values:

std::numeric_limits<float>::quiet_NaN()
    Which is: nan
  fromIEEE754Bits32( toIEEE754Bits32(std::numeric_limits<float>::quiet_NaN()))
  Which is: (nan)

Any suggestions of what I can do about the parenthesis () surrounding nan?

As discussed. You can't compare using EXPECT_EQ because this is the same as nan == nan which always returns false ("A NaN never compares equal to itself." from the cpp reference). Instead, check that the return from the function call is actually a nan via std::isnan and EXPECT_TRUE.

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pdabre12 . Code is good.

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@pdabre12 : The linux-build has test failures. Please fix the tests as per Christian's comments.

@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch 3 times, most recently from 8ff4883 to 4df9d68 Compare February 5, 2024 23:24
@pdabre12
Copy link
Contributor Author

pdabre12 commented Feb 6, 2024

@aditi-pandit Please review. The pipeline is clean now.

@pdabre12
Copy link
Contributor Author

pdabre12 commented Feb 6, 2024

Fuzzer output:

I20240205 18:16:46.861337 22035276 ExpressionVerifier.cpp:153] Starting simplified eval execution.
I20240205 18:16:46.861505 22035276 FuzzerToolkit.cpp:103] Exceptions match.
I20240205 18:16:46.861514 22035276 ExpressionFuzzerVerifier.cpp:363] ==============================> Done with iteration 39674
I20240205 18:16:46.861541 22035276 ExpressionFuzzerVerifier.cpp:160] ==============================> Top 1 by number of rows processed
I20240205 18:16:46.861547 22035276 ExpressionFuzzerVerifier.cpp:162] Format: functionName numTimesSelected proportionOfTimesSelected numProcessedRows
I20240205 18:16:46.861552 22035276 ExpressionFuzzerVerifier.cpp:166] from_ieee754_32 39675 100.00% 2896347
I20240205 18:16:46.861565 22035276 ExpressionFuzzerVerifier.cpp:172] ==============================> Bottom 1 by number of rows processed
I20240205 18:16:46.861572 22035276 ExpressionFuzzerVerifier.cpp:174] Format: functionName numTimesSelected proportionOfTimesSelected numProcessedRows
I20240205 18:16:46.861577 22035276 ExpressionFuzzerVerifier.cpp:179] from_ieee754_32 39675 100.00% 2896347
I20240205 18:16:46.861582 22035276 ExpressionFuzzerVerifier.cpp:192] ==============================> All stats sorted by number of times the function was chosen
I20240205 18:16:46.861588 22035276 ExpressionFuzzerVerifier.cpp:194] Format: functionName numTimesSelected proportionOfTimesSelected numProcessedRows
I20240205 18:16:46.861593 22035276 ExpressionFuzzerVerifier.cpp:198] from_ieee754_32 39675 100.00% 2896347
E20240205 18:16:46.861600 22035276 ExpressionFuzzerVerifier.cpp:369] Total iterations: 39675
E20240205 18:16:46.861605 22035276 ExpressionFuzzerVerifier.cpp:370] Total failed: 32138
[==========] Running 0 tests from 0 test suites.
[==========] 0 tests from 0 test suites ran. (0 ms total)
[  PASSED  ] 0 tests.

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks

@aditi-pandit
Copy link
Collaborator

@Yuhta , @kagamiori : Please can you help with the review and merge.

@ashokku2022
Copy link

@Yuhta @kagamiori I know you are busy with other high-priority issues, however, I was wondering if you could look into this one whenever you get time so that we can close it. Thanks!

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

@pdabre12 : Had a quick review comment.

@@ -94,6 +94,10 @@ Binary Functions

Encodes ``real`` in a 32-bit big-endian binary according to IEEE 754 single-precision floating-point format.

.. function:: from_ieee754_32(binary) -> real
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this to the right alphabetical order in the list.

out_type<float>& result,
const arg_type<Varbinary>& input) {
static constexpr auto kTypeLength = sizeof(int32_t);
VELOX_USER_CHECK_EQ(input.size(), kTypeLength, "Expected 4-byte input");
Copy link
Collaborator

Choose a reason for hiding this comment

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

The java error is "Input floating-point value must be exactly 4 bytes long"

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Please see comments above.

@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch from 4df9d68 to 7f6724e Compare March 1, 2024 00:05
@pdabre12
Copy link
Contributor Author

pdabre12 commented Mar 1, 2024

@aditi-pandit Addressed the comments, please review again.
Thanks.

Copy link
Collaborator

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @pdabre12

@aditi-pandit
Copy link
Collaborator

@Yuhta @kagamiori : Please can you help with review and merge.

@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch 2 times, most recently from 0d9494e to 7a6ec4c Compare March 28, 2024 17:28
@pdabre12 pdabre12 force-pushed the add-from_ieee754_32 branch from 7a6ec4c to 0d8a91a Compare March 28, 2024 18:58
@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@mbasmanova mbasmanova changed the title Add from_ieee754_32() Presto function Add from_ieee754_32 Presto function Mar 28, 2024
@facebook-github-bot
Copy link
Contributor

@Yuhta merged this pull request in 2d899d4.

Copy link

Conbench analyzed the 1 benchmark run on commit 2d899d4f.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Joe-Abraham pushed a commit to Joe-Abraham/velox that referenced this pull request Jun 7, 2024
Summary:
Add from_ieee754_32() scalar function

Resolves : facebookincubator#4427

Reference: https://github.com/prestodb/presto/blob/master/presto-main/src/main/java/com/facebook/presto/operator/scalar/VarbinaryFunctions.java#L267

Pull Request resolved: facebookincubator#7903

Reviewed By: mbasmanova

Differential Revision: D55440664

Pulled By: Yuhta

fbshipit-source-id: 691532afbdc053c357d9a9d6241701df69dde682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement from_ieee754_32 function for presto
6 participants