Skip to content

Conversation

@georgios-observeinc
Copy link
Collaborator

No description provided.

p-t-u and others added 15 commits June 19, 2024 14:39
./parameters.sh > parameters.json

parameters.sh: Add ability to specify context

Allow the context to be passed in as an argument, in case the hardcoded
value does not match the user's context that they use for eng.

Change-Id: Id971712ebd6b2adc14d9bc0f3d96ffbd9ea6281f
Change-Id: I724a65a9d40e2eb8eba3757aaf92ef0ee897caa8
…ake"

Sadly this global naming approach is required by go modules.

https://stackoverflow.com/questions/55442878/organize-local-code-in-packages-using-go-modules/57314494#57314494

We should reconsider using module replace to avoid having to do surgery
on the source code.

This commit is adapted from:
1e28147 declare as the correct path
06c0a4f Re-vendored dependencies
  Change-Id: I1a51f3c5323af45624646c3539b06773dfabcd50
9b375f2 Rename module "gosnowflake" to "github.com/observeinc/gosnowflake"
  Change-Id: I8ea1ccd8e91e4ec2cee59186202fb0bba5f06c58
Change-Id: I8ce12c617a017447053af49f2c9b2e98f53998bb
So that we don't blow up the client when receiving a very large query
result.

Change-Id: Ie963ff65d4203bb3ca93500bce1553b1d843badb
This is a squash of 9 commits:

==============================================================
Expose types and stash the raw response from snowflake.

We need this to be able to do fancy, snowflake specific things
with rows returned from db queries.
Note that this doesn't solve everything b/c sqlx.Rows is a struct
instead of an interface and doesn't expose the wrapped interface
directly, but that's a problem for another time.

Change-Id: I7b8619d6136ecd80500ad246e6844a89b5563332

==============================================================
Export setter methods for ExecResponse

Change-Id: Id1a47e262a1d1b73403a302f39e82366500a3c2d

==============================================================
Export SnowflakeRestful

Add a magic comment to use the specified request ID

Allows the caller to use that request ID to get updates on the query's
progress.

Change-Id: Ibd7086facdfd7cd4327e63593e3059ede3a59f02

==============================================================
Export SnowflakeRestful

With some reflection, we can use this type to post GET requests (and
other requests) to Snowflake ourselves.

Change-Id: Ia24d542b84edc948737f05ac421c706e1c2f9a7a

==============================================================
Fix bug in requestID parsing and simplify snowflakeRestful export

Fix some issues with the two previous commits:
1) remove the panic that I put in for testing (duh!). Luckily this panic
   does not break any existing clients.
2) use export.go to export snowflakeRestful, which is simpler and less
   intrusive

Change-Id: I3a30d41dd50aa15a490aa497b88e9635831524d9

==============================================================
4. Merge upstream changes

The main merge conflict resolved was to remove the hack of putting
REQUESTID in a comment in the SQL statement now that the upstream added
a way to specify the request ID in the context.

Change-Id: I6623ea1b23a648a4a259755ec073cde7f07dcaca

==============================================================
export types/method to support Arrow development

==============================================================
export simpleTokenAccessor for testing

snowflakeRestful.Token has been replaced by TokenAccessor. In testing,
we need to provide a fake TokenAccessor, which is simpleTokenAccessor.

Exporting it means we can reuse the fake in our unit tests.

==============================================================
exporting StringToValue function
In contrast to Go's default json decoder, easyjson does not return an
io.ErrUnexpectedEOF when the io.LimitReader kicks in. Instead, it
returns a LexerError (with the concrete error message being dependant on
where the JSON string was cut off). This fix was simple: check for
LexerError and also map it to ErrResponseTooLarge.

Change-Id: Id36ccb064c0b37c07d955efefd96f17b2596f59d
We can call SetLoggerLevel() in our code, but unfortunately there are a
few loggers in the init() functions in the gosnowflake library, so the
only way to avoid spam from there is to make a change to the library
itself.

Change-Id: I0af49fc636cbe827cf27982b8ce0ad83eeaf1b91

Downgrade logging of ignored errors

Some of the error log lines in ocsp.co literally say they are ignoring
the errors. So downgrade them from logger.Error to logger.Info to reduce
spam.

Change-Id: Ic519c2f7fdd93d2f4ad75d5735bf9483899c4cd2
Several unit tests carried on after failing to query or scan query
results, causing nil-pointer derefernce errors in subsequent statements.

Change-Id: Ie5a5144daec2583e54f97cf0747665e380959890
execResponseData in Arrow format uses the new RowSetBase64 field. The
json annotation called the field "rowsetbase64" while Snowflake GS would
send JSON payloads with the field "rowsetBase64". The Go std JSON
marshaler is case insensitive, but easyjson is case sensitive. Fixed the
casing.

Change-Id: I3d2a1e11b761799f3ca1d3b3cc204c3ceec346f9
The following tests fail (upstream/reabse/both):

both upstream and rebase:
TestArrowVariousTypes
TestBindingBinary
TestBulkArrayBindingInterface
TestBindingArray
TestBindingBulkArray
TestGetQueryStatus
TestJSONVariousTypes
TestJWTAuthentication

only upstream:
TestExecWithServerSideError

only rebase:
TestPutGetFile
TestPutGetStream
TestPutGetGcsDownscopedCredential
TestWithArrowBatches:
A newly added test that produces a Segmentation fault in
sync.(*Mutex).Lock(0x0) in chunk_downloader.go:457.
--> deleted the test since the code itself is similar to
the code before

TestExecWithServerSideError:
Incorrect snowflake error. The error seems OK but the check
is wrong. So adjusted the check to pass the test.

Post-fixes on top of rebase-2023-10-26

Fixed lint/vet issues: we are now clean.
Fixed unit tests that broke in the rebase process.

The following tests fail:

* Both Upstream and Rebase
    TestArrowVariousTypes
    TestBindingBinary
    TestBulkArrayBindingInterface
    TestBindingArray
    TestBindingBulkArray
    TestGetQueryStatus
    TestHTAPOptimizations
    TestHTAPOptimizations/useHtapOptimizations=true
    TestJSONVariousTypes
    TestJWTAuthentication
    TestCreateCredentialCache

* Only Upstream
    TestInitOCSPCacheFileCreation

* Only Origin
    TestPutGetFile
    TestPutGetStream
    TestPutGetGcsDownscopedCredential

Rebased to upstream v1.7.0

The following unit tests fail:

    * Both upstream and origin
        TestBindingBulkArray
        TestGetQueryStatus
        TestHTAPOptimizations
        TestHTAPOptimizations/useHtapOptimizations=true
        TestJWTAuthentication

    * Only origin
        TestPutGetFile
        TestPutGetStream
        TestPutGetGcsDownscopedCredential
It contains changes that are not backwards compatible.
@georgios-observeinc georgios-observeinc force-pushed the master branch 5 times, most recently from ff78f99 to d438c4e Compare September 27, 2024 14:13
@georgios-observeinc georgios-observeinc force-pushed the master branch 2 times, most recently from c9df0ec to f149c68 Compare October 28, 2024 12:29
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2025
@georgios-observeinc georgios-observeinc deleted the rebase_to_1_10_fixes branch April 9, 2025 20:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants