Solved

Strict left join

  • 28 January 2020
  • 5 replies
  • 56 views

Hi there,

I have two tables that I want to merge using feature joiner. I am doing a left join. I want all the rows of the left table to come in the output table. When I ran the program, most of the rows from the left table, however, I found that about 100 records went into the rejected output field. When I investigated I found that the column I used from the left table to join has null values and that goes into the rejected output field. Could anyone guide me on how could I make sure that all records from left table come to the output table?

 

icon

Best answer by bwn 28 January 2020, 02:54

View original

5 replies

Badge +2

Hi @muhammad_yasir,

I'm not sure if there is a simple solution here, but I think you have two options.

Option 1:

If you would like you continue using the FeatureJoiner I think you will have to change your null values so that they can be processed. You can do this using the NullAttributeMapper, set the selected attribute to the one you are joining on and Map To = 'Empty String' or 'New Value'. These features would now come out of the Joined port and if necessary you could revert this change after the join.

Option 2:

Replace the FeatureJoiner with a FeatureMerger, this has more configurable parameters and there is an option for handling Null keys. However the FeatureMerger does not perform a complete left join so even if you set Reject Null and Missing Keys to know all these features will pass from the UnmergedRequestor output port so you will have to pass this along with the Merged features to your downstream workflow.

Hi @muhammad_yasir,

I'm not sure if there is a simple solution here, but I think you have two options.

Option 1:

If you would like you continue using the FeatureJoiner I think you will have to change your null values so that they can be processed. You can do this using the NullAttributeMapper, set the selected attribute to the one you are joining on and Map To = 'Empty String' or 'New Value'. These features would now come out of the Joined port and if necessary you could revert this change after the join.

Option 2:

Replace the FeatureJoiner with a FeatureMerger, this has more configurable parameters and there is an option for handling Null keys. However the FeatureMerger does not perform a complete left join so even if you set Reject Null and Missing Keys to know all these features will pass from the UnmergedRequestor output port so you will have to pass this along with the Merged features to your downstream workflow.

Option1 did not produce the desired result. In fact, the output gives more record numbers than the left table. I don't want to replace faturejoiner with featurejoiner.

Badge +3

When dealing with Null, Missing or Empty values on either the Left or Right Hand side, use an AttributeFilter like so. AttributeFilter works well because it is bulk mode enabled and is very fast, and as FeatureJoiner is also bulk mode enabled the 2 Transformers combined produce the best performance.

When dealing with Null, Missing or Empty values on either the Left or Right Hand side, use an AttributeFilter like so. AttributeFilter works well because it is bulk mode enabled and is very fast, and as FeatureJoiner is also bulk mode enabled the 2 Transformers combined produce the best performance.

What did you use at the end to merge the result in the example?

Badge +3

What did you use at the end to merge the result in the example?

The Junction Transformer shown at the end. With FeatureJoiner also set to Left Join mode, the Features arriving at the Junction will be all Joined and Unjoined Left Hand Side features.

Reply