Mapper: map to target path only if input path is not null
I’m building a pipeline to update some existing data, and I have a Mapper mapping from source input fields to destination target fields. The input data is incomplete – i.e., there are a lot of fields that can be null
on any given input document. For some fields in the input document, if the value is null
, I want to ignore it, but if the value is non-null I want to write it to the corresponding target field. The goal here is to avoid overwriting non-null values in the target data with null
.
Examples:
Input $first_name == null
→ ignore, do not write to $First_Name
field in target
Input $first_name == 'Bob'
→ write to $First_Name
field in target
It would be really cool if there was a way to configure mappings to ignore null values directly in the Mapper, but I’m not seeing how that can be done. Any suggestions for how to do this (either with something I’m missing in the Mapper or with a combination of other snaps)?