[SNOW-3203938] Fix ai_parse_document_basic test#4109
[SNOW-3203938] Fix ai_parse_document_basic test#4109sfc-gh-mrek wants to merge 4 commits intomainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
e6900b3 to
5fe5853
Compare
| session.sql( | ||
| "ALTER SESSION SET AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR = FALSE" | ||
| ).collect() |
There was a problem hiding this comment.
we normally do not do this because our tests run in parallel and it might pollute other test
There was a problem hiding this comment.
So how can I control the behaviour based on the parameter?
For a bit we'll live in a world where user can have AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR either enabled or disabled. It changes the response format for the default ai_parse_document behavior (as i explained in linked doc, the metadata is moved out of the value object for AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR=false).
Also, as this parameter is currently opt in, based on the account cofiguration tests will either succeed or fail if we leave the metadata check.
Should there be an assumption that moving forward metadata won't be at top level so the check should be simply removed (even though for some accounts it can still be here?).
This doesn't look like a good change, but at the same time is the safest one if we can't use session params to fully control functions behavior :)
Co-authored-by: Jonathan Shi <[email protected]>
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-3203938
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
With latest changes related to the new error handling, basic parse document tests started failing because metadata key is mising in the response.
This is expected behaviour, more details can be found here.
I've modified tests to use session parameter, to test both legacy and new response without error details (the bcr process lasts ~3 months, so during this time both combinations will be available for clients).
It affects ai_parse_document only, as for other functions the value didn't change.
New response type is {value:, error}, but when response error details are disabled, value is extracted.
In case of ai_parse_document, metadata was moved to the root level of the response {value,metadata,error} making it absent in value.
As a follow-up, it would be a good idea to cover new error handling with error details in these tests.