From 2618d1a1c519b0d89db4b79ed1f428a051696c7e Mon Sep 17 00:00:00 2001 From: elianddb Date: Wed, 10 Sep 2025 17:48:32 +0000 Subject: [PATCH 1/4] add tests --- .../doltcore/sqle/enginetest/dolt_queries.go | 28 +++++++++++++++++++ integration-tests/bats/sql-batch.bats | 23 +++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go index 464b9568a8..8470e4758f 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go @@ -6571,6 +6571,33 @@ var DoltAutoIncrementTests = []queries.ScriptTest{ }, }, }, + { + // https://github.com/dolthub/dolt/issues/9817 + Name: "Bitwise operations with negative numbers", + SetUpScript: []string{}, + Assertions: []queries.ScriptTestAssertion{ + { + Query: "SELECT (-1) & (-1)", + Expected: []sql.Row{{uint64(18446744073709551615)}}, + }, + { + Query: "SELECT (-2) & (-2)", + Expected: []sql.Row{{uint64(18446744073709551614)}}, + }, + { + Query: "SELECT (-1) & (-2)", + Expected: []sql.Row{{uint64(18446744073709551614)}}, + }, + { + Query: "SELECT (-1) | 0", + Expected: []sql.Row{{uint64(18446744073709551615)}}, + }, + { + Query: "SELECT -1 ^ 0", + Expected: []sql.Row{{uint64(18446744073709551615)}}, + }, + }, + }, } var DoltCherryPickTests = []queries.ScriptTest{ @@ -8358,3 +8385,4 @@ end; }, }, } + diff --git a/integration-tests/bats/sql-batch.bats b/integration-tests/bats/sql-batch.bats index c274e8977a..4c15157667 100644 --- a/integration-tests/bats/sql-batch.bats +++ b/integration-tests/bats/sql-batch.bats @@ -180,3 +180,26 @@ SQL [ "$status" -eq 0 ] [[ "$output" =~ "$EXPECTED" ]] || false } + +# https://github.com/dolthub/dolt/issues/9817 +@test "sql-batch: bitwise operations with negative numbers" { + run dolt sql -q "SELECT (-1) & (-1)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false + + run dolt sql -q "SELECT (-2) & (-2)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551614" ]] || false + + run dolt sql -q "SELECT (-1) & (-2)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551614" ]] || false + + run dolt sql -q "SELECT (-1) | 0" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false + + run dolt sql -q "SELECT -1 ^ 0" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false +} From 7c104932726d5e8ed9a83942d6b8ef62c21749e1 Mon Sep 17 00:00:00 2001 From: elianddb Date: Wed, 10 Sep 2025 13:32:05 -0700 Subject: [PATCH 2/4] rm extra tests --- .../doltcore/sqle/enginetest/dolt_queries.go | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go index 8470e4758f..464b9568a8 100644 --- a/go/libraries/doltcore/sqle/enginetest/dolt_queries.go +++ b/go/libraries/doltcore/sqle/enginetest/dolt_queries.go @@ -6571,33 +6571,6 @@ var DoltAutoIncrementTests = []queries.ScriptTest{ }, }, }, - { - // https://github.com/dolthub/dolt/issues/9817 - Name: "Bitwise operations with negative numbers", - SetUpScript: []string{}, - Assertions: []queries.ScriptTestAssertion{ - { - Query: "SELECT (-1) & (-1)", - Expected: []sql.Row{{uint64(18446744073709551615)}}, - }, - { - Query: "SELECT (-2) & (-2)", - Expected: []sql.Row{{uint64(18446744073709551614)}}, - }, - { - Query: "SELECT (-1) & (-2)", - Expected: []sql.Row{{uint64(18446744073709551614)}}, - }, - { - Query: "SELECT (-1) | 0", - Expected: []sql.Row{{uint64(18446744073709551615)}}, - }, - { - Query: "SELECT -1 ^ 0", - Expected: []sql.Row{{uint64(18446744073709551615)}}, - }, - }, - }, } var DoltCherryPickTests = []queries.ScriptTest{ @@ -8385,4 +8358,3 @@ end; }, }, } - From 2f7bf94d432f34b8e1d6555c061e8168e4d7ebe9 Mon Sep 17 00:00:00 2001 From: elianddb Date: Wed, 10 Sep 2025 13:52:12 -0700 Subject: [PATCH 3/4] add gms ver and mv tests --- go/go.mod | 2 +- go/go.sum | 2 ++ integration-tests/bats/sql-batch.bats | 23 ----------------------- integration-tests/bats/types.bats | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/go/go.mod b/go/go.mod index f80937c4ca..94e4c54770 100644 --- a/go/go.mod +++ b/go/go.mod @@ -61,7 +61,7 @@ require ( github.com/dolthub/dolt-mcp v0.2.1-0.20250827202412-9d0f6e658fba github.com/dolthub/eventsapi_schema v0.0.0-20250725194025-a087efa1ee55 github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 - github.com/dolthub/go-mysql-server v0.20.1-0.20250909231122-5fb8788af3dd + github.com/dolthub/go-mysql-server v0.20.1-0.20250910204816-4fa662877fc6 github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 github.com/edsrzf/mmap-go v1.2.0 github.com/esote/minmaxheap v1.0.0 diff --git a/go/go.sum b/go/go.sum index 9243bf27c6..a71230742a 100644 --- a/go/go.sum +++ b/go/go.sum @@ -215,6 +215,8 @@ github.com/dolthub/go-icu-regex v0.0.0-20250820171420-f2b78f56ce9f h1:oSA8CptGeC github.com/dolthub/go-icu-regex v0.0.0-20250820171420-f2b78f56ce9f/go.mod h1:kpsRG+a196Y69zsAFL0RkQICII9a571lcaxhvQnmrdY= github.com/dolthub/go-mysql-server v0.20.1-0.20250909231122-5fb8788af3dd h1:FdOA59vPc2ilQAnQlXNfFSeVkCTHPa4m8Gl2KmOErTs= github.com/dolthub/go-mysql-server v0.20.1-0.20250909231122-5fb8788af3dd/go.mod h1:ymoHIRZoZKO1EH9iUGcq4E6XyIpUaMgZz3ZPeWa828w= +github.com/dolthub/go-mysql-server v0.20.1-0.20250910204816-4fa662877fc6 h1:nZKH5tCM4nQRMJpLWUbbYwYL6Uyhhhj1AMG3pN3DTOQ= +github.com/dolthub/go-mysql-server v0.20.1-0.20250910204816-4fa662877fc6/go.mod h1:ymoHIRZoZKO1EH9iUGcq4E6XyIpUaMgZz3ZPeWa828w= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= diff --git a/integration-tests/bats/sql-batch.bats b/integration-tests/bats/sql-batch.bats index 4c15157667..c274e8977a 100644 --- a/integration-tests/bats/sql-batch.bats +++ b/integration-tests/bats/sql-batch.bats @@ -180,26 +180,3 @@ SQL [ "$status" -eq 0 ] [[ "$output" =~ "$EXPECTED" ]] || false } - -# https://github.com/dolthub/dolt/issues/9817 -@test "sql-batch: bitwise operations with negative numbers" { - run dolt sql -q "SELECT (-1) & (-1)" -r csv - [ "$status" -eq 0 ] - [[ "$output" =~ "18446744073709551615" ]] || false - - run dolt sql -q "SELECT (-2) & (-2)" -r csv - [ "$status" -eq 0 ] - [[ "$output" =~ "18446744073709551614" ]] || false - - run dolt sql -q "SELECT (-1) & (-2)" -r csv - [ "$status" -eq 0 ] - [[ "$output" =~ "18446744073709551614" ]] || false - - run dolt sql -q "SELECT (-1) | 0" -r csv - [ "$status" -eq 0 ] - [[ "$output" =~ "18446744073709551615" ]] || false - - run dolt sql -q "SELECT -1 ^ 0" -r csv - [ "$status" -eq 0 ] - [[ "$output" =~ "18446744073709551615" ]] || false -} diff --git a/integration-tests/bats/types.bats b/integration-tests/bats/types.bats index 40955a466d..af312588db 100644 --- a/integration-tests/bats/types.bats +++ b/integration-tests/bats/types.bats @@ -1610,3 +1610,26 @@ SQL run dolt sql -q "select * from information_schema.COLUMNS where table_name = 'test' and column_name = 'v';" -r csv [[ "$output" =~ 'test,v,2,,YES,year,,,,,,,,year,"","","insert,references,select,update","","",' ]] || false } + +# https://github.com/dolthub/dolt/issues/9817 +@test "types: bitwise operations return uint64 with signed numbers" { + run dolt sql -q "SELECT (-1) & (-1)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false + + run dolt sql -q "SELECT (-2) & (-2)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551614" ]] || false + + run dolt sql -q "SELECT (-1) & (-2)" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551614" ]] || false + + run dolt sql -q "SELECT (-1) | 0" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false + + run dolt sql -q "SELECT -1 ^ 0" -r csv + [ "$status" -eq 0 ] + [[ "$output" =~ "18446744073709551615" ]] || false +} \ No newline at end of file From e4619ee3cb7ba54a816cde1e755d44e413e51be0 Mon Sep 17 00:00:00 2001 From: elianddb Date: Wed, 10 Sep 2025 21:02:26 +0000 Subject: [PATCH 4/4] [ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh --- go/go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go/go.sum b/go/go.sum index a71230742a..2e83186c13 100644 --- a/go/go.sum +++ b/go/go.sum @@ -213,8 +213,6 @@ github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U= github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0= github.com/dolthub/go-icu-regex v0.0.0-20250820171420-f2b78f56ce9f h1:oSA8CptGeCEdTdD9LFtv8x4juDfdaLKsx1eocyaj1bE= github.com/dolthub/go-icu-regex v0.0.0-20250820171420-f2b78f56ce9f/go.mod h1:kpsRG+a196Y69zsAFL0RkQICII9a571lcaxhvQnmrdY= -github.com/dolthub/go-mysql-server v0.20.1-0.20250909231122-5fb8788af3dd h1:FdOA59vPc2ilQAnQlXNfFSeVkCTHPa4m8Gl2KmOErTs= -github.com/dolthub/go-mysql-server v0.20.1-0.20250909231122-5fb8788af3dd/go.mod h1:ymoHIRZoZKO1EH9iUGcq4E6XyIpUaMgZz3ZPeWa828w= github.com/dolthub/go-mysql-server v0.20.1-0.20250910204816-4fa662877fc6 h1:nZKH5tCM4nQRMJpLWUbbYwYL6Uyhhhj1AMG3pN3DTOQ= github.com/dolthub/go-mysql-server v0.20.1-0.20250910204816-4fa662877fc6/go.mod h1:ymoHIRZoZKO1EH9iUGcq4E6XyIpUaMgZz3ZPeWa828w= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI=