Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2166#discussion_r140341776
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/GenerateTableFetch.java
---
@@ -402,16 +402,20 @@ private String getColumnStateMaxValue(String
tableName, Map<String, String> stat
return maxValue;
}
- private Integer getColumnType(String tableName, String colName) {
+ private Integer getColumnType(final ProcessContext context, String
tableName, String colName, FlowFile flowFile) {
final String fullyQualifiedStateKey = getStateKey(tableName,
colName);
Integer type = columnTypeMap.get(fullyQualifiedStateKey);
if (type == null && !isDynamicTableName) {
// If the table name is static and the fully-qualified key was
not found, try just the column name
type = columnTypeMap.get(getStateKey(null, colName));
}
+ if (type == null || columnTypeMap.size() == 0) {
+ // This means column type cache is clean after instance
reboot. We should re-cache column type
+ super.setup(context, false, flowFile);
--- End diff --
Calling `setup()` only updates `columnTypeMap`. The `type` variable will
stay being null here. Doesn't it throw ProcessException? Shouldn't we add `type
= columnTypeMap.get` after calling setup?
---