benkrug commented on code in PR #13671: URL: https://github.com/apache/druid/pull/13671#discussion_r1082987412
########## docs/querying/sql-operators.md: ########## @@ -37,6 +37,10 @@ sidebar_label: "Operators" Operators in [Druid SQL](./sql.md) typically operate on one or two values and return a result based on the values. Types of operators in Druid SQL include arithmetic, comparison, logical, and more, as described here. +When performing math operations, Druid uses the integer datatype unless there are double or float values. If double or float values are involved, Druid uses double. Note that the highest precision way to store digits in Druid are 64-bit integers (long) or 64-bit floats (double). In essence, a double can represent 52 binary digits, so Druid may return incorrect results for doubles if the value exceeds 2^52. + +For more information about how Java handles primitive data types and how it may impact the results you get, see [Primitive data types in Java are a matter of precision](https://blogs.oracle.com/javamagazine/post/java-primitive-datatypes-int-float-double). Review Comment: imo the latest revisions are much improved. Maybe it would further clarify if we mentioned that doubles are 64-bit floats (which is explained elsewhere in the docs too). Eg, where it says "then the result is a double", maybe it could say "then the result is a double (ie, 64-bit float)"? Idk if "ie" is good for docs style, but something like that? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
