From 855da7da34da9509613179584653dd99c5aa4e59 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Mon, 20 Aug 2007 22:11:31 +0000 Subject: Fixed bug in GroupedCursor which discarded last group if it had one element. --- RELEASE-NOTES.txt | 1 + .../java/com/amazon/carbonado/cursor/GroupedCursor.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index e8b8e8c..4c8edb7 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -37,6 +37,7 @@ Carbonado change history - Fixed replication repair bug which threw an IllegalStateException for insert repair if only alternate keys were specified. - Fixed query descending sort order bug which produced ascending results. +- Fixed bug in GroupedCursor which discarded last group if it had one element. 1.1 to 1.1.1 ------------------------------- diff --git a/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java b/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java index daf9419..6d9afc5 100644 --- a/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java +++ b/src/main/java/com/amazon/carbonado/cursor/GroupedCursor.java @@ -137,9 +137,7 @@ public abstract class GroupedCursor extends AbstractCursor { addToGroup(groupMember); } else { G aggregate = finishGroup(); - beginGroup(mGroupLeader = groupMember); - if (aggregate != null) { mNextAggregate = aggregate; return true; @@ -150,7 +148,7 @@ public abstract class GroupedCursor extends AbstractCursor { } G aggregate = finishGroup(); - + mGroupLeader = null; if (aggregate != null) { mNextAggregate = aggregate; return true; @@ -166,6 +164,15 @@ public abstract class GroupedCursor extends AbstractCursor { throw e; } + if (mGroupLeader != null) { + G aggregate = finishGroup(); + mGroupLeader = null; + if (aggregate != null) { + mNextAggregate = aggregate; + return true; + } + } + return false; } -- cgit v1.2.3