wuchong commented on a change in pull request #9335: [FLINK-13503][API] Add
contract in `LookupableTableSource` to specify the behavior when lookupKeys
contains null.
URL: https://github.com/apache/flink/pull/9335#discussion_r310451016
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/sources/LookupableTableSource.java
##########
@@ -33,13 +33,33 @@
public interface LookupableTableSource<T> extends TableSource<T> {
/**
- * Gets the {@link TableFunction} which supports lookup one key at a
time.
+ * Gets the {@link TableFunction} which supports lookup one key at a
time. Calling `eval`
+ * method in the returned {@link TableFunction} means send a lookup
request to the TableSource.
+ *
+ * <p><strong>IMPORTANT:</strong>
+ * Lookup keys in a request may contain null value. When it happens, it
expects to lookup
+ * records with null value on the lookup key field.
+ * E.g., for a MySQL table with the following schema, send a lookup
request with null value
+ * on `age` field means to find students whose age are unknown
(CAUTION: It is equivalent to filter condition:
+ * `WHERE age IS NULL` instead of `WHERE age = null`).
+ *
+ * -----------------
+ * Table : Student
+ * -----------------
+ * id | LONG
+ * age | INT
+ * name | STRING
+ * -----------------
+ * For the external system which does not support null value (E.g,
HBase does not support null value on rowKey),
+ * it could throw an exception or discard the request when receiving a
request with null value on lookup key.
Review comment:
Please never throw an exception. We should discard the request because HBase
don't have null rowkeys.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services