Repository: polarsignals/frostdb (go)

Issue:
why the test case " Benchmark_Table_Insert_100Rows_100Iters_100Writers" cannot pass  tests? 
Hi, frostdb is a great project, I use newest frostdb to benchmark table instert, i found  Benchmark_Table_Insert_100Rows_100Iters_100Writers(table_test.go) can't pass, output below wrong:
    table_test.go:278: 
        	Error Trace:	/media/vdc/workspace/src/github.com/polarsignals/frostdb/table_test.go:278
        	            				/media/vdc/workspace/src/github.com/polarsignals/frostdb/table_test.go:177
        	Error:      	Not equal: 
        	            	expected: 1000000
        	            	actual  : 528400
        	Test:       	Benchmark_Table_Insert_100Rows_100Iters_100Writers
--- FAIL: Benchmark_Table_Insert_100Rows_100Iters_100Writers-8

Benchmark_Table_Insert_1000Rows_10Iters_10Writers and Benchmark_Table_Insert_100Rows_1000Iters_1Writers  are passed

Pull request description:
fix missing compaction parts
Fixes #584 

Patch:
diff --git a/parts/part.go b/parts/part.go
index e7cd9f5..0d5cb29 100644
--- a/parts/part.go
+++ b/parts/part.go
@@ -306,6 +306,7 @@ func FindMaximumNonOverlappingSet(schema *dynparquet.Schema, parts []*Part) ([]*
 	}
 	nonOverlapping := make([]*Part, 0, len(parts))
 	overlapping := make([]*Part, 0, len(parts))
+	var missing *Part
 	for i := 1; i < len(parts); i++ {
 		start, err := parts[i].Least()
 		if err != nil {
@@ -334,6 +335,10 @@ func FindMaximumNonOverlappingSet(schema *dynparquet.Schema, parts []*Part) ([]*
 			// The current part must be removed. Don't update prevEnd or prev,
 			// this will be used in the next iteration and must stay the same.
 			overlapping = append(overlapping, parts[i])
+
+			if i == len(parts)-1 { // This is the last iteration mark this one as missing
+				missing = parts[prev]
+			}
 		}
 	}
 	if len(overlapping) == 0 || overlapping[len(overlapping)-1] != parts[len(parts)-1] {
@@ -342,6 +347,8 @@ func FindMaximumNonOverlappingSet(schema *dynparquet.Schema, parts []*Part) ([]*
 		// previous part is in the overlapping slice). The last part must be
 		// appended to nonOverlapping.
 		nonOverlapping = append(nonOverlapping, parts[len(parts)-1])
+	} else if missing != nil {
+		overlapping = append(overlapping, missing)
 	}
 	return nonOverlapping, overlapping, nil
 }


Test patch:
diff --git a/parts/part_test.go b/parts/part_test.go
index f0e4f64..622957f 100644
--- a/parts/part_test.go
+++ b/parts/part_test.go
@@ -74,6 +74,12 @@ func TestFindMaximumNonOverlappingSet(t *testing.T) {
 			expectedNonOverlapping: []rng{{1, 3}, {4, 5}, {6, 7}},
 			expectedOverlapping:    []rng{{2, 4}},
 		},
+		{
+			name:                   "OnlyTwoOverlap",
+			ranges:                 []rng{{1, 3}, {2, 4}},
+			expectedNonOverlapping: []rng{},
+			expectedOverlapping:    []rng{{2, 4}, {1, 3}},
+		},
 	} {
 		t.Run(tc.name, func(t *testing.T) {
 			parts := make([]*Part, len(tc.ranges))