-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNOW-1313648 GO - Verify value bindings for all field types while exceeding CLIENT_STAGE_ARRAY_BINDING_THRESHOLD #1297
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1297 +/- ##
==========================================
- Coverage 82.20% 82.19% -0.01%
==========================================
Files 55 55
Lines 13636 13657 +21
==========================================
+ Hits 11209 11225 +16
- Misses 2427 2432 +5 ☔ View full report in Codecov by Sentry. |
@@ -874,6 +874,132 @@ func TestBulkArrayBinding(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestSNOW1313648(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a better name?
@@ -874,6 +874,132 @@ func TestBulkArrayBinding(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestSNOW1313648(t *testing.T) { | |||
arrayInsertTable := "Snow1313648Insert" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the same, this is just a regular feature that we can name instead of using Jira ID.
interfaceArrayTable := "Snow1313648stageInterface" | ||
|
||
runDBTest(t, func(dbt *DBTest) { | ||
dbt.mustExec(fmt.Sprintf("create or replace table %v (c1 integer, c2 string, c3 timestamp_ltz, c4 timestamp_tz, c5 timestamp_ntz, c6 date, c7 time, c8 binary)", arrayInsertTable)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also boolean and double?
someTime := time.Date(1, time.January, 1, 12, 34, 56, 123456789, time.UTC) | ||
someDate := time.Date(2024, time.March, 18, 0, 0, 0, 0, time.UTC) | ||
testingDate := time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC) | ||
someBinary := []byte{0x01, 0x02, 0x03} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use just 'a', 'b'
, but your version is also fine :)
binArr[i] = someBinary | ||
} | ||
dbt.mustExec(fmt.Sprintf("insert into %v values (?, ?, ?, ?, ?, ?, ?, ?)", arrayInsertTable), Array(&intArr), Array(&strArr), Array(<zArr, TimestampLTZType), Array(&tzArr, TimestampTZType), Array(&ntzArr, TimestampNTZType), Array(&dateArr, DateType), Array(&timeArr, TimeType), Array(&binArr)) | ||
dbt.mustExec("ALTER SESSION SET CLIENT_STAGE_ARRAY_BINDING_THRESHOLD = 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work? I thought this was an internal parameter.
t.Fatal(err) | ||
} | ||
|
||
assertEqualE(t, i, bi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all values are empty/zeros this comparison succeeds. Maybe it would be better to compare with given values?
interfaceArrayTable := "Snow1313648stageInterface" | ||
|
||
runDBTest(t, func(dbt *DBTest) { | ||
dbt.mustExec(fmt.Sprintf("create or replace table %v (c1 integer, c2 string, c3 timestamp_ltz, c4 timestamp_tz, c5 timestamp_ntz, c6 date, c7 time, c8 binary)", arrayInsertTable)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good practice (I know that missing in many tests) to defer dropping the table.
testingDate := time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC) | ||
someBinary := []byte{0x01, 0x02, 0x03} | ||
|
||
numRows := 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if such a small number is good enough. There may be a lot of problems with greater number (like 100k) that do not exist with 5 rows. Let's try to increase it and decide if it is not too slow.
|
||
func convertTimeToTimeStamp(x time.Time, t snowflakeType) string { | ||
unixTime, _ := new(big.Int).SetString(fmt.Sprintf("%d", x.Unix()), 10) | ||
m, _ := new(big.Int).SetString(strconv.FormatInt(1e9, 10), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should propagate the errors here?
tmNanos, _ := new(big.Int).SetString(fmt.Sprintf("%d", x.Nanosecond()), 10) | ||
if t == timestampTzType { | ||
_, offset := x.Zone() | ||
return fmt.Sprintf("%v %v", unixTime.Add(unixTime, tmNanos), offset/60+1440) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously it operated on original time (x
in this context), is it intentional to use unixTime
here? Your change seems rational to me, but wanted to double check.
Description
SNOW-313648 Please explain the changes you made here.
Checklist