Skip to content

Commit 667c0d0

Browse files
committed
fix for bazel tests
1 parent a2cef93 commit 667c0d0

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

dumpling/export/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ go_library(
1717
"retry.go",
1818
"sql.go",
1919
"sql_type.go",
20+
"sql_util.go",
2021
"status.go",
22+
"string_chunking.go",
2123
"task.go",
2224
"util.go",
2325
"writer.go",
@@ -86,6 +88,7 @@ go_test(
8688
"sql_test.go",
8789
"sql_type_test.go",
8890
"status_test.go",
91+
"string_chunking_test.go",
8992
"util_for_test.go",
9093
"util_test.go",
9194
"writer_serial_test.go",

dumpling/export/sql_util.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ func interpolateStringBoundary(minBytes, maxBytes []byte, ratio float64) string
133133
}
134134

135135
// Extend shorter string with null bytes for comparison
136-
min := make([]byte, maxLen)
137-
max := make([]byte, maxLen)
138-
copy(min, minBytes)
139-
copy(max, maxBytes)
136+
minVal := make([]byte, maxLen)
137+
maxVal := make([]byte, maxLen)
138+
copy(minVal, minBytes)
139+
copy(maxVal, maxBytes)
140140

141141
result := make([]byte, maxLen)
142-
for i := 0; i < maxLen; i++ {
142+
for i := range maxLen {
143143
// Interpolate each byte position
144-
minByte := float64(min[i])
145-
maxByte := float64(max[i])
144+
minByte := float64(minVal[i])
145+
maxByte := float64(maxVal[i])
146146
interpolated := minByte + (maxByte-minByte)*ratio
147147
result[i] = byte(interpolated)
148148
}
@@ -292,17 +292,17 @@ func buildCursorWhereClause(columnNames []string, boundary []string) string {
292292
}
293293
}
294294

295-
var conditions []string
295+
conditions := make([]string, 0, len(quotedCols))
296296

297297
// Generate OR conditions for cursor-based pagination
298298
// col1 > val1 OR (col1 = val1 AND col2 > val2) OR (col1 = val1 AND col2 = val2 AND col3 > val3) ...
299-
for i := 0; i < len(quotedCols); i++ {
299+
for i := range quotedCols {
300300
var condition strings.Builder
301301

302302
// Add equality conditions for previous columns
303303
if i > 0 {
304304
condition.WriteString("(")
305-
for j := 0; j < i; j++ {
305+
for j := range i {
306306
if j > 0 {
307307
condition.WriteString(" AND ")
308308
}
@@ -355,17 +355,17 @@ func buildUpperBoundWhereClause(columnNames []string, upperBoundary []string) st
355355
}
356356
}
357357

358-
var conditions []string
358+
conditions := make([]string, 0, len(quotedCols))
359359

360360
// Generate OR conditions for upper bound
361361
// col1 < val1 OR (col1 = val1 AND col2 < val2) OR (col1 = val1 AND col2 = val2 AND col3 < val3) ...
362-
for i := 0; i < len(quotedCols); i++ {
362+
for i := range quotedCols {
363363
var condition strings.Builder
364364

365365
// Add equality conditions for previous columns
366366
if i > 0 {
367367
condition.WriteString("(")
368-
for j := 0; j < i; j++ {
368+
for j := range i {
369369
if j > 0 {
370370
condition.WriteString(" AND ")
371371
}

dumpling/export/string_chunking.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ func (d *Dumper) streamStringChunks(tctx *tcontext.Context, conn *BaseConn, meta
151151
var currentBoundary []string
152152
err := conn.QuerySQL(tctx, func(rows *sql.Rows) error {
153153
// We're selecting all ORDER BY columns, not just chunking fields
154-
values := make([]interface{}, len(orderByColumns))
155-
scanArgs := make([]interface{}, len(orderByColumns))
154+
values := make([]any, len(orderByColumns))
155+
scanArgs := make([]any, len(orderByColumns))
156156
for j := range values {
157157
scanArgs[j] = &values[j]
158158
}

0 commit comments

Comments
 (0)