@@ -302,74 +302,6 @@ def get_allowed_session_configurations() -> List[str]:
302
302
"""
303
303
return list (ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP .keys ())
304
304
305
- def _get_schema_bytes (self , sea_response ) -> Optional [bytes ]:
306
- """
307
- Extract schema bytes from the SEA response.
308
-
309
- For ARROW format, we need to get the schema bytes from the first chunk.
310
- If the first chunk is not available, we need to get it from the server.
311
-
312
- Args:
313
- sea_response: The response from the SEA API
314
-
315
- Returns:
316
- bytes: The schema bytes or None if not available
317
- """
318
- import requests
319
- import lz4 .frame
320
-
321
- # Check if we have the first chunk in the response
322
- result_data = sea_response .get ("result" , {})
323
- external_links = result_data .get ("external_links" , [])
324
-
325
- if not external_links :
326
- return None
327
-
328
- # Find the first chunk (chunk_index = 0)
329
- first_chunk = None
330
- for link in external_links :
331
- if link .get ("chunk_index" ) == 0 :
332
- first_chunk = link
333
- break
334
-
335
- if not first_chunk :
336
- # Try to fetch the first chunk from the server
337
- statement_id = sea_response .get ("statement_id" )
338
- if not statement_id :
339
- return None
340
-
341
- chunks_response = self .get_chunk_links (statement_id , 0 )
342
- if not chunks_response .external_links :
343
- return None
344
-
345
- first_chunk = chunks_response .external_links [0 ].__dict__
346
-
347
- # Download the first chunk to get the schema bytes
348
- external_link = first_chunk .get ("external_link" )
349
- http_headers = first_chunk .get ("http_headers" , {})
350
-
351
- if not external_link :
352
- return None
353
-
354
- # Use requests to download the first chunk
355
- http_response = requests .get (
356
- external_link ,
357
- headers = http_headers ,
358
- verify = self .ssl_options .tls_verify ,
359
- )
360
-
361
- if http_response .status_code != 200 :
362
- raise Error (f"Failed to download schema bytes: { http_response .text } " )
363
-
364
- # Extract schema bytes from the Arrow file
365
- # The schema is at the beginning of the file
366
- data = http_response .content
367
- if sea_response .get ("manifest" , {}).get ("result_compression" ) == "LZ4_FRAME" :
368
- data = lz4 .frame .decompress (data )
369
-
370
- # Return the schema bytes
371
- return data
372
-
373
305
def _results_message_to_execute_response (self , sea_response , command_id ):
374
306
"""
375
307
Convert a SEA response to an ExecuteResponse and extract result data.
@@ -412,13 +344,6 @@ def _results_message_to_execute_response(self, sea_response, command_id):
412
344
)
413
345
description = columns if columns else None
414
346
415
- # Extract schema bytes for Arrow format
416
- schema_bytes = None
417
- format = manifest_data .get ("format" )
418
- if format == "ARROW_STREAM" :
419
- # For ARROW format, we need to get the schema bytes
420
- schema_bytes = self ._get_schema_bytes (sea_response )
421
-
422
347
# Check for compression
423
348
lz4_compressed = manifest_data .get ("result_compression" ) == "LZ4_FRAME"
424
349
@@ -473,7 +398,7 @@ def _results_message_to_execute_response(self, sea_response, command_id):
473
398
has_been_closed_server_side = False ,
474
399
lz4_compressed = lz4_compressed ,
475
400
is_staging_operation = False ,
476
- arrow_schema_bytes = schema_bytes ,
401
+ arrow_schema_bytes = None ,
477
402
result_format = manifest_data .get ("format" ),
478
403
)
479
404
0 commit comments