question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Distinct() does not work for complex types

See original GitHub issue

The same test case of DistinctBy should pass without providing any key selector, I wanted to refactor the Distinct function some time ago using this trick:

return new List([...new Set(this._elements)])

Nevertheless, this does not work either, help would be much appreciated.

cc: @abbasmhd @IngoBleile

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
kutyelcommented, Mar 3, 2017

What about this comparison, would it be more performant?

/**
 * Determine if two objects are equal
 */
private _equals<T, U>(x: T, y: U): boolean {
    const keys = Object.keys(x);
    return keys.length === Object.keys(y).length && keys.every(k => this[k] === y[k]);
}

cc: @fredrik-lundin @vendethiel

1reaction
rhyekcommented, Apr 27, 2017

What about using deep-equal?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mysql DISTINCT() does not work as expected - Stack Overflow
DISTINCT should be used thus: SELECT DISTINCT a,b,c FROM t;. without a GROUP BY. It will find all the (a,b,c) in the table,...
Read more >
84320: DISTINCT clause does not work in GROUP_CONCAT
Description: Distinct clause in GROUP_CONCAT fails to work when multiple unique trees are required. I see that multiple values are repeated ...
Read more >
Adding Distinct to findAll Query is not working [DATAJPA-680]
With this error: Error creating bean with name 'activityRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.
Read more >
The xml data type cannot be selected as DISTINCT because it ...
I m using SQL Server 2005. How should i reframe the query to select distinct rows from the table getting the 'data' column...
Read more >
COUNT(), DISTINCT and NULLs - Snowflake Community
DISTINCT : Return Distinct number of records from the column or distinct combinations of column values if multiple columns are specified. The ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found