Skip to content

Commit

Permalink
Rebase to upstream v3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-fleming committed Jan 31, 2024
1 parent faf13a4 commit a92acb2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 165 deletions.
163 changes: 0 additions & 163 deletions .github/workflows/code-quality-checks.yml

This file was deleted.

16 changes: 14 additions & 2 deletions src/databricks/sql/thrift_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
DATABRICKS_REASON_HEADER = "x-databricks-reason-phrase"

TIMESTAMP_AS_STRING_CONFIG = "spark.thriftserver.arrowBasedRowSet.timestampAsString"

# HACK!
THRIFT_SOCKET_TIMEOUT = os.getenv("THRIFT_SOCKET_TIMEOUT", None)

DEFAULT_SOCKET_TIMEOUT = float(900)

# see Connection.__init__ for parameter descriptions.
Expand Down Expand Up @@ -227,7 +231,12 @@ def __init__(
**additional_transport_args, # type: ignore
)

timeout = kwargs.get("_socket_timeout", DEFAULT_SOCKET_TIMEOUT)
timeout = THRIFT_SOCKET_TIMEOUT or kwargs.get(
"_socket_timeout", DEFAULT_SOCKET_TIMEOUT
)
# HACK!
logger.info(f"Setting timeout HACK! to {timeout}")

# setTimeout defaults to 15 minutes and is expected in ms
self._transport.setTimeout(timeout and (float(timeout) * 1000.0))

Expand Down Expand Up @@ -637,7 +646,10 @@ def _create_arrow_table(self, t_row_set, lz4_compressed, schema_bytes, descripti
num_rows,
) = convert_column_based_set_to_arrow_table(t_row_set.columns, description)
elif t_row_set.arrowBatches is not None:
(arrow_table, num_rows,) = convert_arrow_based_set_to_arrow_table(
(
arrow_table,
num_rows,
) = convert_arrow_based_set_to_arrow_table(
t_row_set.arrowBatches, lz4_compressed, schema_bytes
)
else:
Expand Down

0 comments on commit a92acb2

Please sign in to comment.