mark-bathori commented on PR #8280:
URL: https://github.com/apache/nifi/pull/8280#issuecomment-1905894244

   Thanks a lot @exceptionfactory for commenting on this. I'm happy to discuss 
possible solutions for this task since I was thinking a lot about how should 
this be implemented properly.
   
   I was also considering the constructor parameter solution, my main concern 
was that usually when we are creating a `Record` ( e.g. through a 
`RecordReader`) we don't know how other components would like to use it so we 
can't determine if it should be created in case-sensitive or insensitive way. 
Possible solution could be if it is modifiable on the `Record` and maybe track 
the state with a boolean. 
   
   Possible solution with the current approach could be if we set the original 
case-sensitive `Map` to be also **lazy-initialized**. This would solve the 
duplicated storing issue. There could be further restriction added so only one 
type of map can be initialized at once but both could be supported if needed.
   
   I can also see further improvements in the current `SimpleRecordSchema` 
implementation in terms of memory usage. Currently it stores the schema fields 
in a `List` (**fields**) and also in a `Map` (**fieldMap**) where the key is 
the name of the record field and the value is the `RecordField` object. Since 
the `RecordField` object is stored twice it could be changed to store the index 
of the `RecordField` in the field list as the map's value instead of the 
RecordField itself.
   
   I agree on moving this only to the `SimplRecordeSchema` implementation if we 
don't want to add this on interface level.
   
   What is your opinion about these?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to