-
Notifications
You must be signed in to change notification settings - Fork 29
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-692968: Async queries support #787
base: master
Are you sure you want to change the base?
Changes from 34 commits
763153f
974613b
a2f2701
3829b60
d947159
8ab3758
43c5653
76ac1f1
c4fa76d
387a59f
cb067ec
6cd5c78
582913e
98cb876
d3b94a0
f84fc25
97531c8
f32ada0
942ae0a
ed33af6
75e6565
9e457ae
2aaea2a
9003f03
eb4ae08
a793549
45fa5a3
734a064
67e6db3
7671e14
4efbd8b
04100c3
c89f086
8b39c03
c9d9bbb
17d6236
f298aa2
73a1a98
79a8df0
2f99bdd
31ac782
ae46e5a
fa9b3e0
32f127a
6891894
5788a0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,6 +309,26 @@ typedef enum SF_STMT_ATTRIBUTE { | |
#define SF_MULTI_STMT_COUNT_UNSET (-1) | ||
#define SF_MULTI_STMT_COUNT_UNLIMITED 0 | ||
|
||
/** | ||
* The query status | ||
*/ | ||
typedef enum SF_QUERY_STATUS { | ||
SF_QUERY_STATUS_ABORTED, | ||
SF_QUERY_STATUS_ABORTING, | ||
SF_QUERY_STATUS_BLOCKED, | ||
SF_QUERY_STATUS_DISCONNECTED, | ||
SF_QUERY_STATUS_FAILED_WITH_ERROR, | ||
SF_QUERY_STATUS_FAILED_WITH_INCIDENT, | ||
SF_QUERY_STATUS_NO_DATA, | ||
SF_QUERY_STATUS_RUNNING, | ||
SF_QUERY_STATUS_QUEUED, | ||
SF_QUERY_STATUS_QUEUED_REPAIRING_WAREHOUSE, | ||
SF_QUERY_STATUS_RESTARTED, | ||
SF_QUERY_STATUS_RESUMING_WAREHOUSE, | ||
SF_QUERY_STATUS_SUCCESS, | ||
SF_QUERY_STATUS_UNKNOWN | ||
} SF_QUERY_STATUS; | ||
|
||
/** | ||
* Snowflake Error | ||
*/ | ||
|
@@ -526,8 +546,10 @@ typedef struct SF_STMT { | |
void* multi_stmt_result_ids; | ||
int64 multi_stmt_count; | ||
int64 paramset_size; | ||
sf_bool array_bind_supported; | ||
sf_bool array_bind_supported; | ||
int64 affected_rows; | ||
sf_bool is_async; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we add brief description - is_async means that the query is async |
||
sf_bool is_async_initialized; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does it mean that the async is initialized? is query running now, or we fetched data when true? |
||
|
||
/** | ||
* User realloc function used in snowflake_fetch | ||
|
@@ -589,6 +611,15 @@ typedef struct SF_TIMESTAMP { | |
SF_DB_TYPE ts_type; | ||
} SF_TIMESTAMP; | ||
|
||
/** | ||
* Query metadata | ||
*/ | ||
typedef struct SF_QUERY_METADATA { | ||
SF_QUERY_STATUS status; | ||
char *qid; | ||
char *stats; | ||
} SF_QUERY_METADATA; | ||
|
||
/** | ||
* Initializes an SF_QUERY_RESPONSE_CAPTURE struct. | ||
* Note that these need to be released by calling snowflake_query_result_capture_term(). | ||
|
@@ -683,6 +714,25 @@ SF_STATUS STDCALL snowflake_get_attribute( | |
*/ | ||
SF_STMT *STDCALL snowflake_stmt(SF_CONNECT *sf); | ||
|
||
/** | ||
* Creates sf SNOWFLAKE_STMT context for async queries. | ||
* | ||
* @param sf The SF_CONNECT context. | ||
* @param query_id the query id of the async query. | ||
* | ||
* @return sfstmt SNOWFLAKE_STMT context for async queries. | ||
*/ | ||
SF_STMT* STDCALL snowflake_create_async_query_result(SF_CONNECT *sf, const char *query_id); | ||
|
||
/** | ||
* Get the status of a query | ||
* | ||
* @param sfstmt The SF_STMT context. | ||
* | ||
* @return The query status. | ||
*/ | ||
SF_QUERY_STATUS STDCALL snowflake_get_query_status(SF_STMT *sfstmt); | ||
|
||
/** | ||
* Frees the memory used by a SF_QUERY_RESULT_CAPTURE struct. | ||
* Note that this only frees the struct itself, and *not* the underlying | ||
|
@@ -845,6 +895,14 @@ snowflake_stmt_get_attr(SF_STMT *sfstmt, SF_STMT_ATTRIBUTE type, void **value); | |
*/ | ||
SF_STATUS STDCALL snowflake_execute(SF_STMT *sfstmt); | ||
|
||
/** | ||
* Executes a statement asynchronously. | ||
* @param sfstmt SNOWFLAKE_STMT context. | ||
* | ||
* @return 0 if success, otherwise an errno is returned. | ||
*/ | ||
SF_STATUS STDCALL snowflake_async_execute(SF_STMT *sfstmt); | ||
|
||
/** | ||
* Executes a statement with capture. | ||
* @param sfstmt SNOWFLAKE_STMT context. | ||
|
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.
Please fix the formatting here