Skip to content

Commit

Permalink
Fix code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gimantha committed Sep 23, 2024
1 parent 1415c26 commit 8c8f74d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions langlib/lang.query/src/main/ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -652,17 +652,21 @@ class _GroupByFunction {
public function process() returns _Frame|error? {
lock {
if (self.groupedStream is ()) {
_StreamFunction pf = <_StreamFunction>self.prevFunc;
_StreamFunction pf = check self.prevFunc.ensureType();
_Frame? f = check pf.process();
while f is _Frame {
anydata & readonly groupingKey = (check self.getKey(f)).cloneReadOnly();
self.tbl.hasKey(key) ? self.tbl.get(key).frames.push(f) : self.tbl.add({groupingKey: key, frames: [f]});
if self.tbl.hasKey(groupingKey) {
self.tbl.get(groupingKey).frames.push(f);
} else {
self.tbl.add({groupingKey, frames: [f]});
}
f = check pf.process();
}
self.groupedStream = self.convertToStream(self.tbl);
}

stream<_Frame> s = <stream<_Frame>>self.groupedStream;
stream<_Frame> s = check self.groupedStream.ensureType();
record {|_Frame value;|}|error? next = s.next();
return next is record {|_Frame value;|} ? next.value : next;
}
Expand Down

0 comments on commit 8c8f74d

Please sign in to comment.