-
Notifications
You must be signed in to change notification settings - Fork 113
Complete Fetch Phase (for INLINE
disposition and JSON_ARRAY
format)
#594
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
Merged
Merged
Changes from all commits
Commits
Show all changes
228 commits
Select commit
Hold shift + click to select a range
138c2ae
[squash from exec-sea] bring over execution phase changes
varun-edachali-dbx 3e3ab94
remove excess test
varun-edachali-dbx 4a78165
add docstring
varun-edachali-dbx 0dac4aa
remvoe exec func in sea backend
varun-edachali-dbx 1b794c7
remove excess files
varun-edachali-dbx da5a6fe
remove excess models
varun-edachali-dbx 686ade4
remove excess sea backend tests
varun-edachali-dbx 31e6c83
cleanup
varun-edachali-dbx 69ea238
re-introduce get_schema_desc
varun-edachali-dbx 66d7517
remove SeaResultSet
varun-edachali-dbx 71feef9
clean imports and attributes
varun-edachali-dbx ae9862f
pass CommandId to ExecResp
varun-edachali-dbx d8aa69e
remove changes in types
varun-edachali-dbx db139bc
add back essential types (ExecResponse, from_sea_state)
varun-edachali-dbx b977b12
fix fetch types
varun-edachali-dbx da615c0
excess imports
varun-edachali-dbx 0da04a6
reduce diff by maintaining logs
varun-edachali-dbx ea9d456
fix int test types
varun-edachali-dbx 8985c62
[squashed from exec-sea] init execution func
varun-edachali-dbx d9bcdbe
remove irrelevant changes
varun-edachali-dbx ee9fa1c
remove ResultSetFilter functionality
varun-edachali-dbx 24c6152
remove more irrelevant changes
varun-edachali-dbx 67fd101
remove more irrelevant changes
varun-edachali-dbx 271fcaf
even more irrelevant changes
varun-edachali-dbx bf26ea3
remove sea response as init option
varun-edachali-dbx ed7cf91
exec test example scripts
varun-edachali-dbx dae15e3
formatting (black)
varun-edachali-dbx db5bbea
[squashed from sea-exec] merge sea stuffs
varun-edachali-dbx d5d3699
remove excess changes
varun-edachali-dbx 6137a3d
remove excess removed docstring
varun-edachali-dbx 75b0773
remove excess changes in backend
varun-edachali-dbx 4494dcd
remove excess imports
varun-edachali-dbx 4d0aeca
remove accidentally removed _get_schema_desc
varun-edachali-dbx 7cece5e
remove unnecessary init with sea_response tests
varun-edachali-dbx 8977c06
rmeove unnecessary changes
varun-edachali-dbx 0216d7a
formatting (black)
varun-edachali-dbx d97463b
move guid_to_hex_id import to utils
varun-edachali-dbx 139e246
reduce diff in guid utils import
varun-edachali-dbx 4cb15fd
improved models and filters from cloudfetch-sea branch
varun-edachali-dbx e3ee4e4
move arrow_schema_bytes back into ExecuteResult
varun-edachali-dbx f448a8f
maintain log
varun-edachali-dbx 82ca1ee
remove un-necessary assignment
varun-edachali-dbx e96a078
remove un-necessary tuple response
varun-edachali-dbx 27158b1
remove un-ncessary verbose mocking
varun-edachali-dbx dee47f7
filters stuff (align with JDBC)
varun-edachali-dbx d3200c4
move Queue construction to ResultSert
varun-edachali-dbx 8a014f0
move description to List[Tuple]
varun-edachali-dbx 39c41ab
frmatting (black)
varun-edachali-dbx 2cd04df
reduce diff (remove explicit tuple conversion)
varun-edachali-dbx 067a019
remove has_more_rows from ExecuteResponse
varun-edachali-dbx 48c83e0
remove un-necessary has_more_rows aclc
varun-edachali-dbx 281a9e9
default has_more_rows to True
varun-edachali-dbx 192901d
return has_more_rows from ExecResponse conversion during GetRespMetadata
varun-edachali-dbx 55f5c45
remove unnecessary replacement
varun-edachali-dbx edc36b5
better mocked backend naming
varun-edachali-dbx 81280e7
remove has_more_rows test in ExecuteResponse
varun-edachali-dbx c1d3be2
introduce replacement of original has_more_rows read test
varun-edachali-dbx 5ee4136
call correct method in test_use_arrow_schema
varun-edachali-dbx b881ab0
call correct method in test_fall_back_to_hive_schema
varun-edachali-dbx 53bf715
re-introduce result response read test
varun-edachali-dbx 45a32be
simplify test
varun-edachali-dbx e3fe299
remove excess fetch_results mocks
varun-edachali-dbx e8038d3
more minimal changes to thrift_backend tests
varun-edachali-dbx 2f6ec19
move back to old table types
varun-edachali-dbx 73bc282
remove outdated arrow_schema_bytes return
varun-edachali-dbx e385d5b
backend from cloudfetch-sea
varun-edachali-dbx 484064e
remove filtering, metadata ops
varun-edachali-dbx 030edf8
raise NotImplementedErrror for metadata ops
varun-edachali-dbx 4e07f1e
align SeaResultSet with new structure
varun-edachali-dbx 65e7c6b
correct sea res set tests
varun-edachali-dbx 30f8266
add metadata commands
varun-edachali-dbx 033ae73
formatting (black)
varun-edachali-dbx 33821f4
add metadata command unit tests
varun-edachali-dbx 71b451a
minimal fetch phase intro
varun-edachali-dbx 170f339
Merge branch 'exec-resp-norm' into fetch-json-inline
varun-edachali-dbx 40f79b5
Merge branch 'sea-res-set' into fetch-json-inline
varun-edachali-dbx c038d5a
working JSON + INLINE
varun-edachali-dbx 3e22c6c
change to valid table name
varun-edachali-dbx 716304b
rmeove redundant queue init
varun-edachali-dbx e96e5b8
large query results
varun-edachali-dbx 787f1f7
Merge branch 'sea-migration' into sea-test-scripts
varun-edachali-dbx 165c4f3
remove un-necessary changes
varun-edachali-dbx a6e40d0
simplify test module
varun-edachali-dbx 52e3088
logging -> debug level
varun-edachali-dbx 641c09b
change table name in log
varun-edachali-dbx 8bd12d8
Merge branch 'sea-migration' into exec-models-sea
varun-edachali-dbx ffded6e
remove un-necessary changes
varun-edachali-dbx 227f6b3
remove un-necessary backend cahnges
varun-edachali-dbx 68657a3
remove un-needed GetChunksResponse
varun-edachali-dbx 3940eec
remove un-needed GetChunksResponse
varun-edachali-dbx 37813ba
reduce code duplication in response parsing
varun-edachali-dbx 267c9f4
reduce code duplication
varun-edachali-dbx 2967119
more clear docstrings
varun-edachali-dbx 47fd60d
introduce strongly typed ChunkInfo
varun-edachali-dbx 982fdf2
remove is_volume_operation from response
varun-edachali-dbx 9e14d48
add is_volume_op and more ResultData fields
varun-edachali-dbx be1997e
Merge branch 'exec-models-sea' into exec-phase-sea
varun-edachali-dbx e8e8ee7
Merge branch 'sea-test-scripts' into exec-phase-sea
varun-edachali-dbx 05ee4e7
add test scripts
varun-edachali-dbx 3ffa898
Merge branch 'exec-models-sea' into metadata-sea
varun-edachali-dbx 2952d8d
Revert "Merge branch 'sea-migration' into exec-models-sea"
varun-edachali-dbx 89e2aa0
Merge branch 'exec-phase-sea' into metadata-sea
varun-edachali-dbx cbace3f
Revert "Merge branch 'exec-models-sea' into exec-phase-sea"
varun-edachali-dbx c075b07
change logging level
varun-edachali-dbx c62f76d
remove un-necessary changes
varun-edachali-dbx 199402e
remove excess changes
varun-edachali-dbx 8ac574b
remove excess changes
varun-edachali-dbx 398ca70
Merge branch 'sea-migration' into exec-phase-sea
varun-edachali-dbx b1acc5b
remove _get_schema_bytes (for now)
varun-edachali-dbx ef2a7ee
redundant comments
varun-edachali-dbx 699942d
Merge branch 'sea-migration' into exec-phase-sea
varun-edachali-dbx af8f74e
remove fetch phase methods
varun-edachali-dbx 5540c5c
reduce code repetititon + introduce gaps after multi line pydocs
varun-edachali-dbx efe3881
remove unused imports
varun-edachali-dbx 36ab59b
move description extraction to helper func
varun-edachali-dbx 1d57c99
formatting (black)
varun-edachali-dbx df6dac2
add more unit tests
varun-edachali-dbx ad0e527
streamline unit tests
varun-edachali-dbx ed446a0
test getting the list of allowed configurations
varun-edachali-dbx 38e4b5c
reduce diff
varun-edachali-dbx 94879c0
reduce diff
varun-edachali-dbx 1809956
house constants in enums for readability and immutability
varun-edachali-dbx da5260c
add note on hybrid disposition
varun-edachali-dbx 0385ffb
remove redundant note on arrow_schema_bytes
varun-edachali-dbx 23963fc
align SeaResultSet with ext-links-sea
varun-edachali-dbx dd43715
remove redundant methods
varun-edachali-dbx 34a7f66
update unit tests
varun-edachali-dbx 715cc13
remove accidental venv changes
varun-edachali-dbx a0705bc
add fetchmany_arrow and fetchall_arrow
varun-edachali-dbx 1b90c4a
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx f7c11b9
remove accidental changes in sea backend tests
varun-edachali-dbx 349c021
Merge branch 'exec-phase-sea' into metadata-sea
varun-edachali-dbx 6229848
remove irrelevant changes
varun-edachali-dbx fd52356
remove un-necessary test changes
varun-edachali-dbx 64e58b0
remove un-necessary changes in thrift backend tests
varun-edachali-dbx 2903473
remove unimplemented methods test
varun-edachali-dbx b300709
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx 021ff4c
remove unimplemented method tests
varun-edachali-dbx adecd53
modify example scripts to include fetch calls
varun-edachali-dbx bfc1f01
fix sea connector tests
varun-edachali-dbx 0a2cdfd
remove unimplemented methods test
varun-edachali-dbx 90bb09c
Merge branch 'sea-migration' into exec-phase-sea
varun-edachali-dbx cd22389
remove invalid import
varun-edachali-dbx 82e0f8b
Merge branch 'sea-migration' into exec-phase-sea
varun-edachali-dbx e64b81b
Merge branch 'exec-phase-sea' into metadata-sea
varun-edachali-dbx 27564ca
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx 5ab9bbe
better align queries with JDBC impl
varun-edachali-dbx 1ab6e87
line breaks after multi-line PRs
varun-edachali-dbx f469c24
remove unused imports
varun-edachali-dbx 68ec65f
fix: introduce ExecuteResponse import
varun-edachali-dbx ffd478e
Merge branch 'sea-migration' into metadata-sea
varun-edachali-dbx f6d873d
remove unimplemented metadata methods test, un-necessary imports
varun-edachali-dbx 28675f5
introduce unit tests for metadata methods
varun-edachali-dbx 3578659
remove verbosity in ResultSetFilter docstring
varun-edachali-dbx 8713023
remove un-necessary info in ResultSetFilter docstring
varun-edachali-dbx 22dc252
remove explicit type checking, string literals around forward annotat…
varun-edachali-dbx 390f592
house SQL commands in constants
varun-edachali-dbx 28308fe
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx 2712d1c
introduce unit tests for altered functionality
varun-edachali-dbx 984e8ee
remove unused imports
varun-edachali-dbx 0ce144d
remove unused imports
varun-edachali-dbx 50cc1e2
run small queries with SEA during integration tests
varun-edachali-dbx 242307a
run some tests for sea
varun-edachali-dbx 35f1ef0
remove catalog requirement in get_tables
varun-edachali-dbx a515d26
move filters.py to SEA utils
varun-edachali-dbx 59b1330
ensure SeaResultSet
varun-edachali-dbx 293e356
Merge branch 'sea-migration' into metadata-sea
varun-edachali-dbx dd40beb
prevent circular imports
varun-edachali-dbx 14057ac
remove unused imports
varun-edachali-dbx a4d5bdb
remove cast, throw error if not SeaResultSet
varun-edachali-dbx 156421a
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx eb1a9b4
pass param as TSparkParameterValue
varun-edachali-dbx e9b1314
make SEA backend methods return SeaResultSet
varun-edachali-dbx 8ede414
use spec-aligned Exceptions in SEA backend
varun-edachali-dbx 09a1b11
remove defensive row type check
varun-edachali-dbx 5e01e7b
Merge branch 'metadata-sea' into fetch-json-inline
varun-edachali-dbx 21c389d
introduce type conversion for primitive types for JSON + INLINE
varun-edachali-dbx 734321a
Merge branch 'sea-migration' into fetch-json-inline
varun-edachali-dbx 9f0f969
remove SEA running on metadata queries (known failures
varun-edachali-dbx 04a1936
remove un-necessary docstrings
varun-edachali-dbx 278b8cd
align expected types with databricks sdk
varun-edachali-dbx 91b7f7f
link rest api reference to validate types
varun-edachali-dbx 7a5ae13
remove test_catalogs_returns_arrow_table test
varun-edachali-dbx f1776f3
fix fetchall_arrow and fetchmany_arrow
varun-edachali-dbx 6143331
remove thrift aligned test_cancel_during_execute from SEA tests
varun-edachali-dbx 8949d0c
Merge branch 'sea-migration' into fetch-json-inline
varun-edachali-dbx 5eaded4
remove un-necessary changes in example scripts
varun-edachali-dbx eeed9a1
remove un-necessary chagnes in example scripts
varun-edachali-dbx f233886
_convert_json_table -> _create_json_table
varun-edachali-dbx 68ac437
remove accidentally removed test
varun-edachali-dbx 7fd0845
remove new unit tests (to be re-added based on new arch)
varun-edachali-dbx ea7ff73
remove changes in sea_result_set functionality (to be re-added)
varun-edachali-dbx 563da71
introduce more integration tests
varun-edachali-dbx a018273
remove SEA tests in parameterized queries
varun-edachali-dbx c0e98f4
remove partial parameter fix changes
varun-edachali-dbx 7343035
remove un-necessary timestamp tests
varun-edachali-dbx ec500b6
slightly stronger typing of _convert_json_types
varun-edachali-dbx 0b3e91d
stronger typing of json utility func s
varun-edachali-dbx 7664e44
stronger typing of fetch*_json
varun-edachali-dbx db7b8e5
remove unused helper methods in SqlType
varun-edachali-dbx f75f2b5
line breaks after multi line pydocs, remove excess logs
varun-edachali-dbx e2d4ef5
line breaks after multi line pydocs, reduce diff of redundant changes
varun-edachali-dbx 21e3078
reduce diff of redundant changes
varun-edachali-dbx bb015e6
mandate ResultData in SeaResultSet constructor
varun-edachali-dbx bb948a0
return empty JsonQueue in case of empty response
varun-edachali-dbx 921a8c1
remove string literals around SeaDatabricksClient declaration
varun-edachali-dbx cc5203d
move conversion module into dedicated utils
varun-edachali-dbx cc86832
clean up _convert_decimal, introduce scale and precision as kwargs
varun-edachali-dbx 3f1fd93
use stronger typing in convert_value (object instead of Any)
varun-edachali-dbx 0bdf8f9
make Manifest mandatory
varun-edachali-dbx 28b4d7b
mandatory Manifest, clean up statement_id typing
varun-edachali-dbx 245aa77
stronger typing for fetch*_json
varun-edachali-dbx 7d21ad1
make description non Optional, correct docstring, optimize col conver…
varun-edachali-dbx 4d10dcc
fix type issues
varun-edachali-dbx 14c5625
make description mandatory, not Optional
varun-edachali-dbx 31a0e52
n_valid_rows -> num_rows
varun-edachali-dbx e86e755
remove excess print statement
varun-edachali-dbx 7035098
remove empty bytes in SeaResultSet for arrow_schema_bytes
varun-edachali-dbx 4566cb1
move SeaResultSetQueueFactory and JsonQueue into separate SEA module
varun-edachali-dbx 72a5cd3
move sea result set into backend/sea package
varun-edachali-dbx 511c449
improve docstrings
varun-edachali-dbx c21ff5e
correct docstrings, ProgrammingError -> ValueError
varun-edachali-dbx 72100b9
let type of rows by List[List[str]] for clarity
varun-edachali-dbx aab33a1
select Queue based on format in manifest
varun-edachali-dbx 9a6db30
make manifest mandatory
varun-edachali-dbx 0135d33
stronger type checking in JSON helper functions in Sea Result Set
varun-edachali-dbx cc9db8b
assign empty array to data array if None
varun-edachali-dbx bb135fc
stronger typing in JsonQueue
varun-edachali-dbx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,71 @@ | ||
from __future__ import annotations | ||
|
||
from abc import ABC | ||
from typing import List, Optional, Tuple | ||
|
||
from databricks.sql.backend.sea.backend import SeaDatabricksClient | ||
from databricks.sql.backend.sea.models.base import ResultData, ResultManifest | ||
from databricks.sql.backend.sea.utils.constants import ResultFormat | ||
from databricks.sql.exc import ProgrammingError | ||
from databricks.sql.utils import ResultSetQueue | ||
|
||
|
||
class SeaResultSetQueueFactory(ABC): | ||
@staticmethod | ||
def build_queue( | ||
sea_result_data: ResultData, | ||
manifest: ResultManifest, | ||
statement_id: str, | ||
description: List[Tuple] = [], | ||
max_download_threads: Optional[int] = None, | ||
sea_client: Optional[SeaDatabricksClient] = None, | ||
lz4_compressed: bool = False, | ||
) -> ResultSetQueue: | ||
""" | ||
Factory method to build a result set queue for SEA backend. | ||
|
||
Args: | ||
sea_result_data (ResultData): Result data from SEA response | ||
manifest (ResultManifest): Manifest from SEA response | ||
statement_id (str): Statement ID for the query | ||
description (List[List[Any]]): Column descriptions | ||
max_download_threads (int): Maximum number of download threads | ||
sea_client (SeaDatabricksClient): SEA client for fetching additional links | ||
lz4_compressed (bool): Whether the data is LZ4 compressed | ||
|
||
Returns: | ||
ResultSetQueue: The appropriate queue for the result data | ||
""" | ||
|
||
if manifest.format == ResultFormat.JSON_ARRAY.value: | ||
# INLINE disposition with JSON_ARRAY format | ||
return JsonQueue(sea_result_data.data) | ||
elif manifest.format == ResultFormat.ARROW_STREAM.value: | ||
# EXTERNAL_LINKS disposition | ||
raise NotImplementedError( | ||
"EXTERNAL_LINKS disposition is not implemented for SEA backend" | ||
) | ||
raise ProgrammingError("Invalid result format") | ||
varun-edachali-dbx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class JsonQueue(ResultSetQueue): | ||
"""Queue implementation for JSON_ARRAY format data.""" | ||
|
||
def __init__(self, data_array: Optional[List[List[str]]]): | ||
"""Initialize with JSON array data.""" | ||
self.data_array = data_array or [] | ||
self.cur_row_index = 0 | ||
self.num_rows = len(self.data_array) | ||
|
||
def next_n_rows(self, num_rows: int) -> List[List[str]]: | ||
"""Get the next n rows from the data array.""" | ||
length = min(num_rows, self.num_rows - self.cur_row_index) | ||
slice = self.data_array[self.cur_row_index : self.cur_row_index + length] | ||
self.cur_row_index += length | ||
return slice | ||
|
||
def remaining_rows(self) -> List[List[str]]: | ||
"""Get all remaining rows from the data array.""" | ||
slice = self.data_array[self.cur_row_index :] | ||
self.cur_row_index += len(slice) | ||
return slice |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.