diff --git a/pyathena/polars/result_set.py b/pyathena/polars/result_set.py index bd1e10505..3eab3059b 100644 --- a/pyathena/polars/result_set.py +++ b/pyathena/polars/result_set.py @@ -456,9 +456,7 @@ def _get_parquet_storage_options(connection: Connection[Any]) -> dict[str, Any]: fsspec. The credentials are frozen when the options are created. Args: - connection: The connection whose session and region the reads use. The - chunk readers give the connection that they took when they were - created, as ``close()`` releases the result set's connection. + connection: The connection whose session and region the reads use. Returns: Dictionary with AWS credentials and region for S3 access. @@ -606,9 +604,12 @@ def _create_dataframe_iterator(self) -> PolarsDataFrameIterator: For unload queries, it replaces the metadata with the schema of the Parquet files, as ``_as_polars()`` does, before the chunks are read. - The chunk readers take the state that they need, such as the output location, - the column names, and the connection, when they are created. The credentials - are frozen at the first read. + The result set calls this method when it is created, in ``execute()`` or in the + future that ``AsyncPolarsCursor.execute()`` returns. The requests that prepare + the reads are made then, before the first fetch, and raise their errors there: + the size check of a CSV result file, and the data manifest and the Parquet + schema of an UNLOAD result. The schema sets the metadata and is passed to + ``_iter_parquet_chunks()``. The chunks themselves are read lazily. Returns: PolarsDataFrameIterator that reads each chunk lazily.