[ 
https://issues.apache.org/jira/browse/NIFI-15803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alaksiej Ščarbaty updated NIFI-15803:
-------------------------------------
    Description: 
The {{format()}} RecordPath function preserves the source field's data type 
(e.g., LONG, INT) on the returned {{FieldValue}} instead of using STRING.

When used with {{UpdateRecord}} to write a formatted timestamp into a new 
field, the destination field inherits the source's numeric type, which is 
incorrect.

E.g. record:

{ "event_time": 1234567890 }

expression in _UpdateRecord:_ 
__/DATE = format(/event_time, 'yyy-MM-dd')_

causes {{{}NumberFormatException{}}}, as writer expects the "DATE" fields to be 
of "LONG" type.

Formatted fields should always be of a STRING type.

*A concern:* this is a bug fix, but it's a breaking change. If someone expects 
that original data type is returned from format, the flow might break.

  was:
The {{format()}} RecordPath function preserves the source field's data type 
(e.g., LONG, INT) on the returned {{FieldValue}} instead of using STRING.

When used with {{UpdateRecord}} to write a formatted timestamp into a new 
field, the destination field inherits the source's numeric type, which is 
incorrect.

{{{}{}}}E.g. record: {_}{ "event_time": 1234567890 }{_}, expression in 
UpdateRecord: _/DATE = format(/event_time, 'yyy-MM-dd')_ causes 
{{{}NumberFormatException{}}}, as writer expects the "DATE" fields to be of 
"LONG" type.

Formatted fields should always be of a STRING type.


> Invalid field type of Format record path function
> -------------------------------------------------
>
>                 Key: NIFI-15803
>                 URL: https://issues.apache.org/jira/browse/NIFI-15803
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 2.8.0
>            Reporter: Alaksiej Ščarbaty
>            Assignee: Alaksiej Ščarbaty
>            Priority: Major
>
> The {{format()}} RecordPath function preserves the source field's data type 
> (e.g., LONG, INT) on the returned {{FieldValue}} instead of using STRING.
> When used with {{UpdateRecord}} to write a formatted timestamp into a new 
> field, the destination field inherits the source's numeric type, which is 
> incorrect.
> E.g. record:
> { "event_time": 1234567890 }
> expression in _UpdateRecord:_ 
> __/DATE = format(/event_time, 'yyy-MM-dd')_
> causes {{{}NumberFormatException{}}}, as writer expects the "DATE" fields to 
> be of "LONG" type.
> Formatted fields should always be of a STRING type.
> *A concern:* this is a bug fix, but it's a breaking change. If someone 
> expects that original data type is returned from format, the flow might break.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to