Support Questions

Find answers, ask questions, and share your expertise

Nifi : Could not rename file

avatar

Hi ,

When I am trying to Overwriting File then getting below error

filenotreplaced.png

is there any alternative solution to "replace"(Delete existing "parquet" file and put new file )

1 ACCEPTED SOLUTION

avatar
Master Guru
@Paresh Baldaniya

We cannot change the existing filename in HDFS but we can do alternate solution in NiFi as below.

You need to use UpdateAttribute processor before PutParquet processor.

Update Attribute

we are going to update the filename before putparquet processor so that everytime when file goes to putparquet processor will have same file name every time.

Add new property to Update attribute processor

filename

desired_parquet_filename.prq

Configs:-

45621-update.png

PutParquet:-

So we are going to have same filename everytime and in this processor we need to change

Overwrite Files property to True //if the same filename exists in the directory processor will replace the existing file with new file

Configs:-

45622-putparquet.png

Flow:-

1.GetFile
2.UpdateAttribute //change the filename by adding filename property
3.PutParquet //change the Overwrite files property to true

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.

View solution in original post

1 REPLY 1

avatar
Master Guru
@Paresh Baldaniya

We cannot change the existing filename in HDFS but we can do alternate solution in NiFi as below.

You need to use UpdateAttribute processor before PutParquet processor.

Update Attribute

we are going to update the filename before putparquet processor so that everytime when file goes to putparquet processor will have same file name every time.

Add new property to Update attribute processor

filename

desired_parquet_filename.prq

Configs:-

45621-update.png

PutParquet:-

So we are going to have same filename everytime and in this processor we need to change

Overwrite Files property to True //if the same filename exists in the directory processor will replace the existing file with new file

Configs:-

45622-putparquet.png

Flow:-

1.GetFile
2.UpdateAttribute //change the filename by adding filename property
3.PutParquet //change the Overwrite files property to true

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.