drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Rogers <par0...@yahoo.com.INVALID>
Subject Re: Documentation for maths operations between different types?
Date Thu, 15 Aug 2019 17:04:50 GMT
Hi Dave,

As it turns out, improving the detail in function documentation is a long-standing request.
The historical answer has been to either 1) read the code, or 2) try it with a test query.

You can use the sqlTypeOf() function to learn the answer to your question:

SELECT sqlTypeOf(cast(1 AS INT) / cast(2 AS INT)) FROM values(1)

Charles Givre patiently tracked down and documented all the Drill functions in his appendix
to our book "Learning Apache Drill." But, even there, the level of detail you request is missing.

Maybe, once you do the research to find the answers you want, you could submit a Documentation
JIRA ticket with the results so that it can be added to the documentation.

Thanks,
- Paul

 

    On Thursday, August 15, 2019, 03:55:11 AM PDT, Dave Challis <dave.challis@cipher.ai>
wrote:  
 
 Is there any documentation out there on how mathematical functions are
handled when operating on different types?

E.g.:

* would integer division of 1 / 2 produce a float or double of 0.5? Or an
integer of the same type set to 0?

* if two INT are multipled and produce a result larger than INT can
support, is the result returned as a BIGINT?
  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message