HI Andrey, Thanks for raising bug.
We are using 1.7.0 branch. Could you please point me the branch of 1.7.0 I checked out from https://github.com/apache/ignite/tree/1.7.0, it is 1.7.0-SANPSHOT and have add code to verify the fix. I see following warnings in log. should I checkout any other branch ? [09:53:30] New version is available at ignite.apache.org: 1.7.0 2016-11-04 09:53:30 WARN GridUpdateNotifier:480 - New version is available at ignite.apache.org: 1.7.0 [09:53:36] New version is available at ignite.apache.org: 1.7.0 2016-11-04 09:53:36 WARN GridUpdateNotifier:480 - New version is available at ignite.apache.org: 1.7.0 Thanks On 4 November 2016 at 00:34, Andrey Mashenkov <[email protected]> wrote: > Yes, you are right. This is a bug. > > It seems there should be smth like this: > wasNull == curr.get(colIdx - 1) == null; > > I've create an issue https://issues.apache.org/jira/browse/IGNITE-4175 > > Thanks Anil ! > > > On Thu, Nov 3, 2016 at 9:45 PM, Anil <[email protected]> wrote: > >> following code i see in the JdbcResultSet. val is not null for null >> values for string types. then val == null is false. correct ? >> >> T val = cls == String.class ? (T)String.valueOf(curr.get(colIdx - 1)) : >> (T)curr.get(colIdx - 1); >> >> wasNull = val == null; >> >> On 3 November 2016 at 23:48, Andrey Mashenkov <[email protected]> >> wrote: >> >>> No, wasNull is true if column value is null otherwise false. >>> You can have wasNull() is true but getInt() is zero. E.g. getInt() >>> return type is primitive and default value (zero) shoud be return for NULL >>> fields. >>> >>> >>> On Thu, Nov 3, 2016 at 9:11 PM, Anil <[email protected]> wrote: >>> >>>> wasNull is false all the time for string types. correct ? >>>> >>>> On 3 November 2016 at 20:39, Andrey Mashenkov <[email protected]> >>>> wrote: >>>> >>>>> Javadoc says that null value should be returned. >>>>> >>>>> But from the other side, there is wasNull() method, that should be use >>>>> for null checks. >>>>> >>>>> >>>>> >>>>> On Thu, Nov 3, 2016 at 5:39 PM, Andrey Gura <[email protected]> wrote: >>>>> >>>>>> String.valuOf(null) return "null" string by contract. >>>>>> >>>>>> On Thu, Nov 3, 2016 at 5:33 PM, Anil <[email protected]> wrote: >>>>>> >>>>>>> HI , >>>>>>> >>>>>>> null values are returned as "null" with ignite jdbc result set. >>>>>>> >>>>>>> private <T> T getTypedValue(int colIdx, Class<T> cls) throws >>>>>>> SQLException { >>>>>>> ensureNotClosed(); >>>>>>> ensureHasCurrentRow(); >>>>>>> >>>>>>> try { >>>>>>> T val = cls == String.class ? >>>>>>> (T)String.valueOf(curr.get(colIdx - 1)) : (T)curr.get(colIdx - 1); >>>>>>> >>>>>>> wasNull = val == null; >>>>>>> >>>>>>> return val; >>>>>>> } >>>>>>> catch (IndexOutOfBoundsException ignored) { >>>>>>> throw new SQLException("Invalid column index: " + >>>>>>> colIdx); >>>>>>> } >>>>>>> catch (ClassCastException ignored) { >>>>>>> throw new SQLException("Value is an not instance of " + >>>>>>> cls.getName()); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> >>>>>>> if a column value is null (curr.get(colIdx - 1) return null but >>>>>>> String.valueOf( (curr.get(colIdx - 1) ) is not null it is "null". >>>>>>> >>>>>>> ArrayList<String> obj = new ArrayList<String>(); >>>>>>> obj.add(null); >>>>>>> System.out.println(null == (String)String.valueOf(obj.get(0))); >>>>>>> >>>>>>> above Sysout is false. >>>>>>> >>>>>>> Fix : >>>>>>> >>>>>>> Object colValue = curr.get(colIdx - 1); >>>>>>> >>>>>>> T val = cls == String.class ? (String) colValue : (T) colValue; >>>>>>> >>>>>>> or return (T) colValue >>>>>>> >>>>>>> >>>>>>> please let me know if you see any issues. thanks >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
