Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.18.1, 1.20.0, 1.19.1
-
None
-
None
Description
As per JDBC standard, ResultSet.wasNull()
Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.
However, Flink JDBC driver currently does not update the wasNull flag within the FlinkResultSet.get*() methods. Instead, it only sets this flag during iteration over rows fetched from the gateway endpoint. This behavior leads to wasNull returning true only if the entire row is null, not when individual column values are null. Consequently, reading a null value using FlinkResultSet.get*() incorrectly results in wasNull() returning false, which is not compliant with the JDBC specification.
Proposed solution
Check if the underlying value accessed with FlinkResultSet.get*() method is null, and update wasNull accordingly.
For discussion
Can we skip null rows in FlinkResultSet.next()?
Steps to reproduce:
Add
assertTrue(resultSet.wasNull());
after any call to resultSet.get*() in testStringResultSetNullData(). Run the test and see the failed check.