[
https://issues.apache.org/jira/browse/NIFI-9169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ZhangCheng updated NIFI-9169:
-----------------------------
Description:
For NIFI, If we set some EL to one processor, such as `${schema.name}` for
PutDatabaseREcord, and the incoming flowfile does not have a `schema.name`
attribute, then the result of PutDatabaseRecord property evalutes is Empty
String(""), not NULL.
{code:java}
if (expressions.size() == 1) {
final String evaluated =
expressions.get(0).evaluate(evaluationContext, decorator);
return evaluated == null ? EMPTY_STRING : evaluated;
}
{code}
And maybe we don not want the Empty String , for example
{code:java}
// PutDatabaseRecord
public static TableSchema from(final Connection conn, final String catalog,
final String schema, final String tableName,
final boolean translateColumnNames,
final boolean includePrimaryKeys, ComponentLog log) throws SQLException {
final DatabaseMetaData dmd = conn.getMetaData();
try (final ResultSet colrs = dmd.getColumns(catalog, schema,
tableName, "%")) {
.......
{code}
> Improvement for Expression Language when evaluated result is NULL
> -----------------------------------------------------------------
>
> Key: NIFI-9169
> URL: https://issues.apache.org/jira/browse/NIFI-9169
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: ZhangCheng
> Assignee: ZhangCheng
> Priority: Major
>
> For NIFI, If we set some EL to one processor, such as `${schema.name}` for
> PutDatabaseREcord, and the incoming flowfile does not have a `schema.name`
> attribute, then the result of PutDatabaseRecord property evalutes is Empty
> String(""), not NULL.
> {code:java}
> if (expressions.size() == 1) {
> final String evaluated =
> expressions.get(0).evaluate(evaluationContext, decorator);
> return evaluated == null ? EMPTY_STRING : evaluated;
> }
> {code}
> And maybe we don not want the Empty String , for example
> {code:java}
> // PutDatabaseRecord
> public static TableSchema from(final Connection conn, final String catalog,
> final String schema, final String tableName,
> final boolean translateColumnNames,
> final boolean includePrimaryKeys, ComponentLog log) throws SQLException {
> final DatabaseMetaData dmd = conn.getMetaData();
> try (final ResultSet colrs = dmd.getColumns(catalog, schema,
> tableName, "%")) {
> .......
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)