Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LINQ LeftJoin and RightJoin #110872

Merged
merged 1 commit into from
Dec 23, 2024
Merged

Implement LINQ LeftJoin and RightJoin #110872

merged 1 commit into from
Dec 23, 2024

Conversation

roji
Copy link
Member

@roji roji commented Dec 20, 2024

Closes #110292

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 14 changed files in this pull request and generated 2 comments.

Files not reviewed (7)
  • src/libraries/System.Linq.Queryable/tests/System.Linq.Queryable.Tests.csproj: Language not supported
  • src/libraries/System.Linq/src/System.Linq.csproj: Language not supported
  • src/libraries/System.Linq/tests/System.Linq.Tests.csproj: Language not supported
  • src/libraries/System.Linq/ref/System.Linq.cs: Evaluated as low risk
  • src/libraries/System.Linq.Queryable/ref/System.Linq.Queryable.cs: Evaluated as low risk
  • src/libraries/System.Linq/tests/JoinTests.cs: Evaluated as low risk
  • src/libraries/System.Linq.Queryable/tests/JoinTests.cs: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/libraries/System.Linq/src/System/Linq/RightJoin.cs:43

  • The IsEmptyArray method is not defined in the provided code. Ensure that this method is defined and works as expected.
if (IsEmptyArray(inner))

src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs:245

  • The DynamicDependency attribute should be corrected to use the format: DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(Enumerable)).
[DynamicDependency("LeftJoin`4", typeof(Enumerable))]

src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs:260

  • The nullable type for q is not necessary. Use a simple cast instead: IQueryable q = source as IQueryable;
IQueryable<TSource>? q = source as IQueryable<TSource>;

@roji roji requested a review from eiriktsarpalis December 20, 2024 18:15
Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@roji
Copy link
Member Author

roji commented Dec 23, 2024

Hey @eiriktsarpalis, thanks for the quick reviewing.

Re the styling nits, I basically tried to follow the existing code (Join implementation and tests) for maximum consistency, although there are indeed many opportunities for syntax modernization (namespace declaration, using declaration, the new collection initializers...). I'm happy to make the code more modern for Left/RightJoin in this PR only as you suggest (at which point things would be inconsistent), or I can submit a separate PR later to do some syntax cleanup for System.Linq as a whole - whatever you prefer.

@eiriktsarpalis
Copy link
Member

Re the styling nits

That's fine, they're all optional. Assuming we do add enforcement in the future I'm guessing they would be updated in bulk anyway.

@roji roji merged commit 9c1bae3 into dotnet:main Dec 23, 2024
83 checks passed
@roji roji deleted the LeftRightJoin branch December 23, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: Introduce LeftJoin LINQ operator
2 participants