-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change cast(double|real as varchar) to return scientific notation (#7602
) Summary: Change cast(double as varchar) and cast(real as varchar) to return scientific notation, when magnitude of the input value is greater than or equal to 10^7, or less than 10^-3. Today they return standard notation in all cases. Change to use fmt::format() instead of folly::to() to output standard notation, for less noisy digits in outputs, when magnitude of the input value is greater than or equal to 10^-3 and less than 10^7. Use QueryConfig legacy_cast false to gate this new behavior. To keep existing behavior, set legacy_cast to true. The returned scientific notation uses a max of 17 significant decimal digits for double and a max of 8 decimal digits for real, according to the double and single precision supported by IEEE 754 floating point, as well as Presto empirically. Also add 4 benchmarks for casting double or real to scientific notation or standard notation. The time of casting for legacy_cast = false, new implementation is on par with the time for legacy_cast = true, today implementation. Pull Request resolved: #7602 Reviewed By: kagamiori Differential Revision: D51386874 Pulled By: gggrace14 fbshipit-source-id: 84286074864b8a817d0f3feb97d498b4fe7c6c66
- Loading branch information
1 parent
a5d816e
commit 14dc44b
Showing
4 changed files
with
322 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters