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
Add query building API for the $fill
aggregation pipeline stage
#965
Conversation
The PR was refactored. A single pipeline stage specification is no longer used. Instead
|
JAVA-4394
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.
This is a tricky API as the syntax seems to suggest optional values first - which is different to our (Java driver) general approach.
I found the name FillComputation surprising as it represents the output field in the syntax. Did you try any other names? I can only suggest FillOutput then type name is more closely linked to the field it represents.
This is only true if we want to accept
We had this exact discussion for Ross, is your proposal to rename |
I agree the naming is difficult / problematic - sorry to rehash old ground. I noticed Looking at the naming:
Personally I think I prefer: Regardless of naming I'll rereview in the morning. I'm also happy to delay naming decisions (as a separate ticket) until Jeff is back to see if we can get consensus. |
I am fine with
Let's defer: JAVA-4665. |
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.
LGTM!
I had one question that is just for my learning - no action needed.
.append('doc', new Document('field2', 3))] | ||
getCollectionHelper().insertDocuments(docs) | ||
String resultField = 'result' | ||
LinkedList<Bson> stages = [ |
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.
Q - why linkedlist over just List?
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.
Indeed, I could have get by with the List
interface. Done.
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.
lgtm
Just a trivial doc suggestion.
} | ||
|
||
/** | ||
* Creates a {@code $fill} pipeline stage, which sets values to fields when they are {@link BsonType#NULL Null} or missing. |
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.
* Creates a {@code $fill} pipeline stage, which sets values to fields when they are {@link BsonType#NULL Null} or missing. | |
* Creates a {@code $fill} pipeline stage, which assigns values to fields when they are {@link BsonType#NULL Null} or missing. |
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.
Done. This change was also needed in the Scala code.
JAVA-4394
The new API:
WindowedComputations.locf
for$locf
WindowedComputations.linearFill
for$linearFill
Aggregates.fill
for$fill
The server-side syntax document is here.
You may see how the API usage looks like, or play with it in
AggregatesFunctionalSpecification.'$setWindowFields'
AggregatesFunctionalSpecification.'$fill'
JAVA-4394