PDGGK opened a new pull request, #135:
URL: https://github.com/apache/iotdb-extras/pull/135
## What
`IoTDBLookupFunction.eval` fails the whole lookup join with
```
java.lang.NullPointerException: Cannot invoke
"org.apache.flink.table.types.DataType.equals(Object)" because the return value
of "java.util.Map.get(Object)" is null
at org.apache.iotdb.flink.sql.common.Utils.isTypeEqual(Utils.java:175)
at
org.apache.iotdb.flink.sql.function.IoTDBLookupFunction.eval(IoTDBLookupFunction.java:135)
```
when one of the declared columns has no value at the looked-up timestamp.
IoTDB returns that value as a `Field` with no data type, and `isTypeEqual`
looks up `null` in its type map. `Utils.getValue` already returns null for a
field with no data type; the type check before it did not.
## Reproduction
IoTDB 2.0.11 standalone and the unchanged `examples/flink-sql`
`LookupExample`, with FLOAT series `root.sg.d0.s0`, `root.sg.d1.s0` and
`root.sg.d1.s1` written at times 1 to 5, leaving `root.sg.d1.s1` empty at time
3:
- master: the job fails with the exception above.
- this branch: 5 joined rows, with `root.sg.d1.s1` null at time 3.
- with the time-3 value filled in, master also returns all 5 rows, so the
missing value is the only trigger.
The bounded scan is not affected: it takes column types from the result set
metadata, and a scan over a series with a missing value returns a null for it.
## Change
Emit null for a field with no data type before the type check. The module
had no tests, so this adds junit and mockito as test dependencies (as
`flink-iotdb-connector` does) and `IoTDBLookupFunctionTest` with a null case
and a fully populated case. The null case fails on master with the same
exception.
`mvn -Pwith-flink -pl
connectors/flink-iotdb-connector,connectors/flink-sql-iotdb-connector -am clean
verify` passes on JDK 17.
--
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]