Skip to content

Commit 90f831d

Browse files
Merge branch 'main' into feat/otel-add-cqpp
2 parents 8580774 + f1c0106 commit 90f831d

File tree

5 files changed

+59
-9
lines changed

5 files changed

+59
-9
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.80.3"
2+
".": "4.81.0"
33
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.81.0](https://github.com/cloudquery/plugin-sdk/compare/v4.80.3...v4.81.0) (2025-05-19)
9+
10+
11+
### Features
12+
13+
* Remove reflect methods ([#2129](https://github.com/cloudquery/plugin-sdk/issues/2129)) ([bd277cc](https://github.com/cloudquery/plugin-sdk/commit/bd277cca0af25def7dda7d5cc8d6f8ec762ecb76))
14+
815
## [4.80.3](https://github.com/cloudquery/plugin-sdk/compare/v4.80.2...v4.80.3) (2025-05-19)
916

1017

examples/simple_plugin/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.24.1
66

77
require (
88
github.com/apache/arrow-go/v18 v18.2.0
9-
github.com/cloudquery/plugin-sdk/v4 v4.80.2
9+
github.com/cloudquery/plugin-sdk/v4 v4.81.0
1010
github.com/rs/zerolog v1.34.0
1111
)
1212

scheduler/scheduler.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"math"
78
"sync"
89
"time"
910

@@ -305,18 +306,16 @@ func shardTableClients(tableClients []tableClient, shard *shard) []tableClient {
305306
if shard == nil || len(tableClients) == 0 {
306307
return tableClients
307308
}
309+
308310
num := int(shard.num)
309311
total := int(shard.total)
310-
chunkSize := len(tableClients) / total
311-
if chunkSize == 0 {
312-
chunkSize = 1
313-
}
312+
313+
chunkSize := int(math.Ceil(float64(len(tableClients)) / float64(total)))
314+
314315
chunks := lo.Chunk(tableClients, chunkSize)
315316
if num > len(chunks) {
316317
return nil
317318
}
318-
if len(chunks) > total && num == total {
319-
return append(chunks[num-1], chunks[num]...)
320-
}
319+
321320
return chunks[num-1]
322321
}

scheduler/scheduler_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ func Test_shardTableClients(t *testing.T) {
559559
expected: []tableClient{
560560
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_1"}},
561561
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_2"}},
562+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_3"}},
562563
},
563564
},
564565
{
@@ -571,9 +572,52 @@ func Test_shardTableClients(t *testing.T) {
571572
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
572573
},
573574
shard: &shard{num: 2, total: 2},
575+
expected: []tableClient{
576+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_4"}},
577+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
578+
},
579+
},
580+
{
581+
name: "uneven split 1 of 3",
582+
tableClients: []tableClient{
583+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_1"}},
584+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_2"}},
585+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_3"}},
586+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_4"}},
587+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
588+
},
589+
shard: &shard{num: 1, total: 3},
590+
expected: []tableClient{
591+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_1"}},
592+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_2"}},
593+
},
594+
},
595+
{
596+
name: "uneven split 2 of 3",
597+
tableClients: []tableClient{
598+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_1"}},
599+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_2"}},
600+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_3"}},
601+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_4"}},
602+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
603+
},
604+
shard: &shard{num: 2, total: 3},
574605
expected: []tableClient{
575606
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_3"}},
576607
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_4"}},
608+
},
609+
},
610+
{
611+
name: "uneven split 3 of 3",
612+
tableClients: []tableClient{
613+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_1"}},
614+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_2"}},
615+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_3"}},
616+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_4"}},
617+
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
618+
},
619+
shard: &shard{num: 3, total: 3},
620+
expected: []tableClient{
577621
{client: &testExecutionClient{}, table: &schema.Table{Name: "table_5"}},
578622
},
579623
},

0 commit comments

Comments
 (0)