rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.08k stars 161 forks source link

[core] use Relation::Name's key for rejecting duped combine nodes #562

Closed solnic closed 5 years ago

solnic commented 5 years ago

Refs #548

It turned out using Relation#eql? (which is based on dataset and name) is actually broken. First of all Relation::Name is equalized only on relation and dataset attributes, so if there's an alias involved, it will not work. It was too risky to fix it now because it's possible there's some code that relies on this equality behavior. It is something to address in 6.0.0. I fixed it anyway in #563

There's also another risk - equalizing on Relation#dataset may result in materialization of the dataset. I remember it happened in some cases in the past, that's why it was much better to use Relation::Name#key to figure out which nodes are duplicated. In theory, you can have more than one node with the same key but different datasets, but you would have to do this manually.

@joelvh - I reckon this should fix your problems

@v-kolesnikov - there's a big chance this will fix your problems too