forked from databricks/databricks-sql-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fix: The HasNext() function for Go driver arrow record iterator r…
…eturning EOF for empty resultset. Essentially, the HasNext() logic was assuming there were records in the result set in the case that the original return from executing the statement didn't specify, or if there were direct results. Updated arrowRecordIterator.HasNext() to check state of underlying iterators. This handles the case of direct results that contain no records. Updated resultPageIterator.HasNext() to try fetching a result page if necessary to determine if there are more records. Added tests for empty result sets with direct results enabled and disabled. Signed-off-by: Raymond Cypher <[email protected]>
- Loading branch information
1 parent
91dced9
commit 5f9163e
Showing
5 changed files
with
288 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
internal/rows/testdata/zeroRows/zeroRowsDirectResults.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"operationHandle": { | ||
"operationId": { | ||
"guid": "Ae6w6uAWEI+vWuB+fjGvOA==", | ||
"secret": "M41SnYJyRuuEgstBlGaDnQ==", | ||
"executionVersion": 0 | ||
}, | ||
"operationType": "EXECUTE_STATEMENT", | ||
"hasResultSet": true | ||
}, | ||
"directResults": { | ||
"operationStatus": { | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"operationState": "FINISHED_STATE", | ||
"operationStarted": 1705023332453, | ||
"operationCompleted": 1705023332599, | ||
"idempotencyType": "IDEMPOTENT", | ||
"statementTimeout": 172800 | ||
}, | ||
"resultSetMetadata": { | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"schema": { | ||
"columns": [ | ||
{ | ||
"columnName": "id", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "INT_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 1, | ||
"comment": "" | ||
}, | ||
{ | ||
"columnName": "deleted", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "BOOLEAN_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 2, | ||
"comment": "" | ||
}, | ||
{ | ||
"columnName": "name", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "STRING_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 3, | ||
"comment": "" | ||
} | ||
] | ||
}, | ||
"resultFormat": "ARROW_BASED_SET", | ||
"lz4Compressed": false, | ||
"arrowSchema": "/////2ACAAAQAAAAAAAKAA4ABgANAAgACgAAAAAABAAQAAAAAAEKAAwAAAAIAAQACgAAAAgAAAAIAAAAAAAAAAMAAABsAQAArAAAAAQAAACy/v//FAAAAIgAAACIAAAAAAAFAYQAAAACAAAAQAAAAAQAAABo/v//CAAAABQAAAAIAAAAInN0cmluZyIAAAAAFwAAAFNwYXJrOkRhdGFUeXBlOkpzb25UeXBlAKD+//8IAAAAEAAAAAYAAABTVFJJTkcAABYAAABTcGFyazpEYXRhVHlwZTpTcWxOYW1lAAAAAAAAXP///wQAAABuYW1lAAAAAFb///8UAAAAiAAAAIwAAAAAAAYBiAAAAAIAAABAAAAABAAAAAz///8IAAAAFAAAAAkAAAAiYm9vbGVhbiIAAAAXAAAAU3Bhcms6RGF0YVR5cGU6SnNvblR5cGUARP///wgAAAAQAAAABwAAAEJPT0xFQU4AFgAAAFNwYXJrOkRhdGFUeXBlOlNxbE5hbWUAAAAAAAAEAAQABAAAAAcAAABkZWxldGVkAAAAEgAYABQAEwASAAwAAAAIAAQAEgAAABQAAACMAAAAlAAAAAAAAgGYAAAAAgAAAEgAAAAEAAAAyP///wgAAAAUAAAACQAAACJpbnRlZ2VyIgAAABcAAABTcGFyazpEYXRhVHlwZTpKc29uVHlwZQAIAAwACAAEAAgAAAAIAAAADAAAAAMAAABJTlQAFgAAAFNwYXJrOkRhdGFUeXBlOlNxbE5hbWUAAAAAAAAIAAwACAAHAAgAAAAAAAABIAAAAAIAAABpZAAAAAAAAA==", | ||
"cacheLookupResult": "LOCAL_CACHE_HIT", | ||
"uncompressedBytes": 0, | ||
"compressedBytes": 0, | ||
"isStagingOperation": false, | ||
"reasonForNoCloudFetch": "CLOUD_FETCH_SUPPORT", | ||
"cacheLookupLatency": 4, | ||
"remoteResultCacheEnabled": true, | ||
"isServerless": true, | ||
"truncatedByThriftLimit": false | ||
}, | ||
"resultSet": { | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"hasMoreRows": false, | ||
"results": { | ||
"startRowOffset": 0, | ||
"rows": [] | ||
} | ||
}, | ||
"closeOperation": { | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
} | ||
} | ||
}, | ||
"executionRejected": false, | ||
"maxClusterCapacity": 10, | ||
"queryCost": 0.5, | ||
"currentClusterLoad": 1, | ||
"idempotencyType": "IDEMPOTENT", | ||
"remoteResultCacheEnabled": true, | ||
"isServerless": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"hasMoreRows": false, | ||
"results": { | ||
"startRowOffset": 0, | ||
"rows": [] | ||
}, | ||
"resultSetMetadata": { | ||
"status": { | ||
"statusCode": "SUCCESS_STATUS" | ||
}, | ||
"schema": { | ||
"columns": [ | ||
{ | ||
"columnName": "id", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "INT_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 1, | ||
"comment": "" | ||
}, | ||
{ | ||
"columnName": "deleted", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "BOOLEAN_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 2, | ||
"comment": "" | ||
}, | ||
{ | ||
"columnName": "name", | ||
"typeDesc": { | ||
"types": [ | ||
{ | ||
"primitiveEntry": { | ||
"type": "STRING_TYPE" | ||
} | ||
} | ||
] | ||
}, | ||
"position": 3, | ||
"comment": "" | ||
} | ||
] | ||
}, | ||
"resultFormat": "ARROW_BASED_SET", | ||
"lz4Compressed": false, | ||
"arrowSchema": "/////2ACAAAQAAAAAAAKAA4ABgANAAgACgAAAAAABAAQAAAAAAEKAAwAAAAIAAQACgAAAAgAAAAIAAAAAAAAAAMAAABsAQAArAAAAAQAAACy/v//FAAAAIgAAACIAAAAAAAFAYQAAAACAAAAQAAAAAQAAABo/v//CAAAABQAAAAIAAAAInN0cmluZyIAAAAAFwAAAFNwYXJrOkRhdGFUeXBlOkpzb25UeXBlAKD+//8IAAAAEAAAAAYAAABTVFJJTkcAABYAAABTcGFyazpEYXRhVHlwZTpTcWxOYW1lAAAAAAAAXP///wQAAABuYW1lAAAAAFb///8UAAAAiAAAAIwAAAAAAAYBiAAAAAIAAABAAAAABAAAAAz///8IAAAAFAAAAAkAAAAiYm9vbGVhbiIAAAAXAAAAU3Bhcms6RGF0YVR5cGU6SnNvblR5cGUARP///wgAAAAQAAAABwAAAEJPT0xFQU4AFgAAAFNwYXJrOkRhdGFUeXBlOlNxbE5hbWUAAAAAAAAEAAQABAAAAAcAAABkZWxldGVkAAAAEgAYABQAEwASAAwAAAAIAAQAEgAAABQAAACMAAAAlAAAAAAAAgGYAAAAAgAAAEgAAAAEAAAAyP///wgAAAAUAAAACQAAACJpbnRlZ2VyIgAAABcAAABTcGFyazpEYXRhVHlwZTpKc29uVHlwZQAIAAwACAAEAAgAAAAIAAAADAAAAAMAAABJTlQAFgAAAFNwYXJrOkRhdGFUeXBlOlNxbE5hbWUAAAAAAAAIAAwACAAHAAgAAAAAAAABIAAAAAIAAABpZAAAAAAAAA==", | ||
"cacheLookupResult": "LOCAL_CACHE_HIT", | ||
"uncompressedBytes": 0, | ||
"compressedBytes": 0, | ||
"isStagingOperation": false, | ||
"reasonForNoCloudFetch": "CLOUD_FETCH_SUPPORT", | ||
"cacheLookupLatency": 2, | ||
"remoteResultCacheEnabled": true, | ||
"isServerless": true, | ||
"truncatedByThriftLimit": false | ||
} | ||
} |