Skip to content

Commit

Permalink
try to recreate the issue with UUID to solve snowflakedb#1209
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronosMasterOfAllTime committed Dec 9, 2024
1 parent 56beb83 commit d3aaee0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ func TestValueToString(t *testing.T) {
assertEqualE(t, *bv.value, "[1,2]")
})

t.Run("UUID - should return string", func(t *testing.T) {
u := uuid.New()
bv, err := valueToString(u, textType, nil)
assertNilF(t, err)
assertEmptyStringE(t, bv.format)
assertEqualE(t, *bv.value, u.String())
})

bv, err = valueToString(&testValueToStringStructuredObject{s: "some string", i: 123, date: time.Date(2024, time.May, 24, 0, 0, 0, 0, time.UTC)}, timestampLtzType, params)
assertNilF(t, err)
assertEqualE(t, bv.format, "json")
Expand Down Expand Up @@ -2175,7 +2183,7 @@ func TestSmallTimestampBinding(t *testing.T) {

rows := sct.mustQueryContext(ctx, "SELECT ?", parameters)
defer func() {
assertNilF(t, rows.Close())
assertNilF(t, rows.Close())
}()

scanValues := make([]driver.Value, 1)
Expand Down Expand Up @@ -2213,7 +2221,7 @@ func TestTimestampConversionWithoutArrowBatches(t *testing.T) {
query := fmt.Sprintf("SELECT '%s'::%s(%v)", tsStr, tp, scale)
rows := sct.mustQueryContext(ctx, query, nil)
defer func() {
assertNilF(t, rows.Close())
assertNilF(t, rows.Close())
}()

if rows.Next() {
Expand Down Expand Up @@ -2295,7 +2303,7 @@ func TestTimestampConversionWithArrowBatchesMicrosecondPassesForDistantDates(t *
t.Fatalf("failed to query: %v", err)
}
defer func() {
assertNilF(t, rows.Close())
assertNilF(t, rows.Close())
}()

// getting result batches
Expand Down Expand Up @@ -2356,7 +2364,7 @@ func TestTimestampConversionWithArrowBatchesAndWithOriginalTimestamp(t *testing.
query := fmt.Sprintf("SELECT '%s'::%s(%v)", tsStr, tp, scale)
rows := sct.mustQueryContext(ctx, query, []driver.NamedValue{})
defer func() {
assertNilF(t, rows.Close())
assertNilF(t, rows.Close())
}()

// getting result batches
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/aws/smithy-go v1.20.2
github.com/gabriel-vasile/mimetype v1.4.2
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/uuid v1.3.1
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/sirupsen/logrus v1.9.3
golang.org/x/crypto v0.22.0
Expand Down

0 comments on commit d3aaee0

Please sign in to comment.