You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Mark Payne (Jira)" <ji...@apache.org> on 2023/09/01 14:06:00 UTC
[jira] [Created] (NIFI-12018) Allow return values from UpdateRecord to be non-String values
Mark Payne created NIFI-12018:
---------------------------------
Summary: Allow return values from UpdateRecord to be non-String values
Key: NIFI-12018
URL: https://issues.apache.org/jira/browse/NIFI-12018
Project: Apache NiFi
Issue Type: Improvement
Components: Core Framework, Extensions
Reporter: Mark Payne
Assignee: Mark Payne
In the UpdateRecord processor, it allows using Expression Language to refer to `field.value` and `field.name`. Often, these are used for things like date manipulation, etc. but the return value is always a String because it's evaluating Expression Language.
Under the hood, Expression Language's {{Query}} object exposes a {{{}ResultType{}}}. We should add two methods to the {{PropertyValue}} object:
{{ResultType getResultType()}}
{{Object asObject()}}
Where {{getResultType()}} will return {{ResultType.STRING}} if no Expression Language is present / has been evaluated, and the {{asObject()}} method will return one of the following types of values based on the {{{}ResultType{}}}:
{code:java}
ResultType | Java Type
STRING | String
BOOLEAN | Boolean
WHOLE_NUMBER | Long
DATE | Date
INSTANT | java.time.Instant
DECIMAL | Double
NUMBER | Number{code}
We should then update {{UpdateRecord}} to make use of {{asObject()}} instead of {{{}getValue(){}}}. This would allow us to create expressions such as
{code:java}
${field.value:toDate('yyyy/MM/dd HH:mm:ss'):toNumber()} {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)