How to judge if two Dataset are equal

I don's sure this is a bug or not.Suppose I have a dataset

dataset =
Dataset[{{"a", 10}, {"b", 11}, {"c", 12}, {"d", 5}, {"e", 99}}]


Then we do two same operation on it.

{set1 = dataset[All, <|"col1" -> 1, "col2" -> 2|>],
set2 = dataset[Map[AssociationThread[{"col1", "col2"} -> #] &]]}


As we see,we get two data set totally.But in some time,we can not judge it just by our eyes.Let use == or === to test it.

set1 == set2


set1 === set2


False

Of course Equal @@ Normal /@ {set1, set2} works well,but the Normal don't judge two Dataset instead of two List actually.So I have two question here:

1. Why the == and === will fail here?
2. Is there any method can judge two datasets are same or not?
• For part 1 compare FullForm@set1 and FullForm@set2. You seem to have answered part 2 yourself. Jul 8, 2017 at 3:57
• It's enough to make you hate metadata. Datasets are becoming a language unto itself. Aug 14, 2017 at 22:20

The difference is in the "ID" part of the FullForm of the datasets, not in the data. So, if you want to compare the data portion, you can use the function:

compareDatasets[s1_Dataset, s2_Dataset] :=
SameQ @@ (Cases[# // FullForm, HoldPattern@Dataset[a_, ___] :> a] & /@ {s1, s2})


We can test it on the datasets provided in the OP:

compareDatasets[set1, set2]


True

compareDatasets[set1, dataset[Map[AssociationThread[{"col1", "col3"} -> #] &]]]


False

• Yes, the IDs are different (in a system´s point of view), but from a users point of view, the Datasets are equal, so maybe a Query like "DatasetEqualQ" may be useful to increase the usability of Datasets. Maybe we see this in an upcoming version Jul 15, 2017 at 20:28
• This jumps through a lot of hoops where Equal @@ Normal /@ {set1, set2} is sufficient and included in the OP. Aug 14, 2017 at 22:00
• I just think the Equal should be True。But the Same give False
– yode
Aug 15, 2017 at 2:13