Skip to main content
Solved

Strict left join

  • January 27, 2020
  • 5 replies
  • 319 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?

 

Best answer by bwn

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

Forum|alt.badge.img+2
  • 719 replies
  • January 28, 2020

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.


  • Author
  • 30 replies
  • January 28, 2020

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.


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • 562 replies
  • Best Answer
  • January 28, 2020

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.


  • Author
  • 30 replies
  • January 28, 2020

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?


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • 562 replies
  • January 28, 2020

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.