paul-rogers commented on issue #1690: DRILL-7086: Output schema for row set 
mechanism
URL: https://github.com/apache/drill/pull/1690#issuecomment-473618300
 
 
   For narrowing conversions, I ended up with a bit of an ad-hoc solution that 
follows the Java conventions.
   
   * When converting from int to TINYINT, or SMALLINT, the upper bits are 
simply truncated. (The code uses a setInt() accessor for all these types. No 
checking is done to maximize performance.)
   * When converting from long to int, an exception is thrown for overflow. 
(The "natural" method for an int is setInt(), so the setLong() uses the Java 
Math.toExactInt() method which throws an exception for overflow.)
   * When converting from double to BigInt, follows the Java convention of 
converting to the closest available value.
   * When converting from double to other integral types, first follows the 
double-to-BigInt rules, then the long-to-int rule.
   
   These are the simplest, fastest conversions based on the idea that data 
should be correct for the target type. We can tinker with the overflow logic 
over time without affecting the "happy path" for correct values.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to