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
Fix #2865: Thread should have its own message and posts should only be the replies #2944
Conversation
…should only be the replies
Schema Change Detected. Needs ingestion-core version bump Please run |
user.setRoles(fields.contains("roles") ? getRoles(user) : null); | ||
user.setOwns(fields.contains("owns") ? getOwns(user) : null); | ||
user.setFollows(fields.contains("follows") ? getFollows(user) : null); | ||
if (fields != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that Fields is never null and we use Fields.EMPTY_FIELDS instead.
Is there a place where this assumption is not valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. We don't pass null anywhere for Fields. Removed this null check in the latest patch.
if (uniqueValues.add(t)) { | ||
threads.add(EntityUtil.validate(t, dao.feedDAO().findById(t), Thread.class)); | ||
private List<Thread> limitPostsInThreads(List<Thread> threads, int limitPosts) { | ||
if (limitPosts == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If limit is 0, we return all posts?
Should we do t.withPosts(null)
when limit = 0? As in return 0 posts per thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this patch, both t.withPosts(null)
and t.withPosts(0)
will return all the posts in the thread. Do you think we should add support for returning just the thread with 0 posts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was possibly misled when I saw that we don't return 0 posts when limit is 0.
From a UX point of view, it seems like we'll always need a non-zero number of posts to show our users. So this logic is good.
May be add a comment to this line indicating the above, for future reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second thought:
May be also check what is the behavior with pagination and do something similar here.
What happens if we put limit 0 for pagination of GET /tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For pagination:
@Parameter(description = "Limit the number tables returned. (1 to 1000000, default = 10)")
@DefaultValue("10")
@Min(1)
@Max(1000000)
@QueryParam("limit")
So all we have to do is document the API accordingly similar to the one above (in FeedResource.java)
Indicate that if limit = 0 it returns everything. -- so this is clear to end users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, added a comment and unit test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the min and max limits in the API for limitPosts and updated the tests. Please take another look. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better with API docs - thanks for incorporating this (especially as I was thinking back and forth through this and providing feedback on the fly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic looks good.
Need to enhance the feeds threadlist API documentation so that the limit values are clear to the end user.
[catalog] Kudos, SonarCloud Quality Gate passed! |
[open-metadata-ingestion] Kudos, SonarCloud Quality Gate passed! |
Test failure from possible flaky test
Will address this separately. |
Test failure is not related to this patch. So, merging it into main. Thanks, @mithmatt for the quick review. |
Describe your changes :
See #2865
Type of change :
Checklist:
Reviewers