joshelser commented on a change in pull request #150:
URL: https://github.com/apache/calcite-avatica/pull/150#discussion_r698103594
##########
File path:
core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java
##########
@@ -722,13 +701,21 @@ protected Number getNumber() throws SQLException {
return (Number) super.getObject();
}
+ //FIXME There are several problems with this, the code below simply
implements
+ //a previous behaviour codified by the Calcite test suite.
+ //
+ // 1. It interprets a scale of 0 as a NOOP parameter, it should in fact
drop all fractionals
+ // 2. It uses RoundingMode.UNNECESSARY. All other Accessors use
RoundingMode.DOWN, and
+ // there is nothing in the specs that suggests that it should behave
differently
+ // 3. The scale from MetaData is NOT applied to BigDecimal values. Why ?
+ // 4. Metadata scale is only applied for getBigDecimal(), and only in this
Accessor. Why ?
public BigDecimal getBigDecimal(int scale) throws SQLException {
Number n = getNumber();
if (n == null) {
return null;
}
BigDecimal decimal = AvaticaSite.toBigDecimal(n);
- if (0 != scale) {
+ if (0 != scale && !(n instanceof BigDecimal)) {
Review comment:
Strange. The localAvatica option did seem to work for me (at least, it
didn't fail -- admittedly, I didn't look deep to make sure Calcite actually
picked it up). Thanks for verifying this.
--
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]