Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/851#discussion_r123567359
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/test/rowSet/test/RowSetTest.java
---
@@ -309,13 +317,38 @@ private void testDoubleRW() {
assertEquals(0, reader.column(0).getDouble(), 0.000001);
assertTrue(reader.next());
assertEquals(Double.MAX_VALUE, reader.column(0).getDouble(), 0.000001);
+ assertEquals(Double.MAX_VALUE, (double) reader.column(0).getObject(),
0.000001);
--- End diff --
The trick here is to understand the difference between static and dynamic
typing. The run-time type of `getObject()` is `Double`, which can be unboxed to
an int. But, Java is a statically-typed language. The compile-time type of
`getObject()` is `Object`.
For the two-argument form of `assertEquals()`, that is fine: Java will box
the `int` to get an `Integer`, pass both to `assertEquals()` which will call
`equals()` on the objects and things work.
But, the three-argument form has the signature `assertEquals(double
expected, double actual, double delta)`, and the compiler does not have
sufficient information to convert the `Object` return value to a `double`. Here
is the error:
```
The method assertEquals(double, double, double) in the type Assert is not
applicable for the arguments (double, Object, double)
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---