-
Notifications
You must be signed in to change notification settings - Fork 27
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-692945: refactoring for resultset C wrapper #724
base: master-2.0.0
Are you sure you want to change the base?
Conversation
52a9e80
to
0c5b00a
Compare
0c5b00a
to
a6b3a3e
Compare
include/snowflake/client.h
Outdated
@@ -443,9 +453,9 @@ typedef struct SF_STMT { | |||
char request_id[SF_UUID4_LEN]; | |||
SF_ERROR_STRUCT error; | |||
SF_CONNECT *connection; | |||
void *qrf; | |||
QueryResultFormat_t qrf; |
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.
is this change compatible for users? our public API is changing there - don't we need * anymore?
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 was void* and I don't think application would use it without knowing the actual data type it points to.
It was actually pointing to QueryResultFormat_t
type which was dynamically allocated, having the enum data directly would make much more sense.
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.
And that't the reason why we cannot merge it even now - right?
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.
A part of. Would like to have 2 approvals (which is required when merging to master) although merging to master-2.0.0 doesn't really need that.
a6b3a3e
to
3f2906d
Compare
@sfc-gh-dstempniak Please help to check what's the failure with |
@sfc-gh-ext-simba-hx One test failed on Macaarch64:
After rerun it succeeded:
|
cpp/lib/result_set.cpp
Outdated
} | ||
QueryResultFormat query_result_format = | ||
static_cast<Snowflake::Client::ResultSet*>(rs)->getResultFormat(); | ||
switch (query_result_format){ |
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.
Use virtual destructor instead of casting
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.
done
cpp/lib/result_set.cpp
Outdated
{ | ||
switch (*query_result_format) | ||
ERROR_IF_NULL(rs); | ||
QueryResultFormat query_result_format = |
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.
use virtual function
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.
done
cpp/lib/result_set.cpp
Outdated
return rs_json_create(json_rowset, metadata, tz_string); | ||
#ifndef SF_WIN32 | ||
case SF_ARROW_FORMAT: | ||
return new Snowflake::Client::ResultSetArrow(json_rowset, metadata, std::string(tz_string)); |
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.
Create factory method in ResultSet?
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.
done
cpp/lib/result_set.cpp
Outdated
return rs_arrow_create_with_chunk((NON_JSON_RESP*)initial_chunk, metadata, tz_string); | ||
case JSON_FORMAT: | ||
return rs_json_create((cJSON*)initial_chunk, metadata, tz_string); | ||
#ifndef SF_WIN32 |
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.
Create factory method in ResultSet?
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.
done
Preparing for adding multiple statements support, refactoring on the resultset C wrapper. Remove unnecessary code and make it more cleaner for adding new feature.