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

When paginating over groups, some groups are skipped when specifying an OrderBy Clause #784

Open
matt-tyler-qoria opened this issue Oct 14, 2024 · 0 comments
Assignees
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@matt-tyler-qoria
Copy link

Describe the bug

I attempted to paginate over a very large number of groups using an iterator.

e.g.

func MakeGroupIterator(ctx context.Context, client *msgraphsdk.GraphServiceClient) (Iterator[*models.Group], error) {
	result, err := client.Groups().Get(ctx, &groups.GroupsRequestBuilderGetRequestConfiguration{
		QueryParameters: &groups.GroupsRequestBuilderGetQueryParameters{
			Orderby: []string{"displayName"},
			Select:  []string{"displayName", "description", "id", "objectId", "visibility"},
		},
	})
	if err != nil {
		return nil, err
	}

	it, err := msgraphcore.NewPageIterator[*models.Group](result, client.GetAdapter(), models.CreateGroupCollectionResponseFromDiscriminatorValue)
	if err != nil {
		return nil, err
	}
	return it.Iterate, nil
}

However, I've noticed its not functioning correctly when ordering by display name. It skips over entire ranges and as such there are groups missing from the complete collection - as if its using the last ID to fetch a page, as opposed to the displayName.

If I do not specify the Orderby parameter, everything works correctly.

The entire collection consists of approximately 260,000 groups. When using Orderby, there were roughly 30,000 groups missing.

I'm unsure as to whether this is an issue with the SDK, or with the graph service itself.

I could this being perfectly reasonably behaviour but I was unable to find it documented anywhere.

Expected behavior

All groups are returned via pagination, regardless of the orderby clause

OR

there is some warning somewhere that pagination does not function correctly when specifying an orderby clause.

How to reproduce

Paginate over a group set as above.

I'm unsure as to level of the data that would be required for this to be noticeable.

SDK Version

v1.43.0

Latest version known to work for scenario above?

No response

Known Workarounds

Do not specify an orderby clause when attempting to paginate through a full set of groups.

Debug output

NA

Configuration

Mac OS / ARM 64
Debian x64

Other information

No response

@matt-tyler-qoria matt-tyler-qoria added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 14, 2024
@rkodev rkodev self-assigned this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

2 participants