

# Differences from Athena engine version 3 for query results

If you have applications that work with Athena engine version 3 query results, review the following differences before you move them to a DuckDB workgroup.

You can try individual queries on DuckDB before you move a whole workgroup. To run a single query on DuckDB from an Athena engine version 3 workgroup, see [Override the engine for a single query](duckdb-engine-override.md). To move a workgroup to DuckDB, see [SQL differences from Athena v3](duckdb-functions-and-schemas.md).

## Storage and encryption
<a name="athena-duckdb-query-results-differences-storage"></a>

Storing and encrypting query results differs in the following ways:
+ New DuckDB workgroups use managed query results by default. Workgroups that you migrate from Athena engine version 3 keep their query result location.
+ If you store query results in your own Amazon S3 bucket (a customer managed bucket), they can be encrypted with server-side encryption with Amazon S3 managed keys (SSE-S3) or with AWS KMS keys (SSE-KMS). Client-side encryption with AWS KMS keys (CSE-KMS) is not supported.
+ With SSE-S3, query results use the default encryption of the bucket. If your bucket policy requires the `x-amz-server-side-encryption: AES256` request header, use SSE-KMS, or remove that condition from the policy.
+ Workgroup encryption settings apply only to query results. Data that CTAS, `INSERT INTO`, and `COPY TO` statements write uses the default encryption of the destination bucket.
+ Query result reuse is not supported.
+ Every query writes its result files directly under the query result location.
+ `SHOW`, `DESCRIBE`, and `EXPLAIN` write a `.csv` result file and a `.csv.metadata` file instead of a `.txt` file.

## Reading results
<a name="athena-duckdb-query-results-differences-reading"></a>

Reading query results differs in the following ways:
+ To stream results as Apache Arrow, use the `GetQueryResultStream` API. `GetQueryResultStream` is supported only for workgroups that use managed query results.
+ To read DuckDB query results, use JDBC or ODBC drivers version 4.0.0 or later, or the ADBC driver. Earlier JDBC and ODBC driver versions can't read DuckDB results.
+ `ColumnInfo.Type` uses DuckDB type names, such as `VARCHAR` and `INTEGER`, instead of Trino type names, such as `varchar` and `integer`.
+ DuckDB names a column without a name after its expression, such as `(1 + 1)`, instead of `_col0`.
+ DuckDB formats values the way it writes CSV, for example `nan` and `inf` for floating-point special values. For more information, see [How result values are formatted](duckdb-query-results-read.md#athena-duckdb-query-results-read-formatting).
+ `SHOW`, `DESCRIBE`, and `EXPLAIN` return a structured result with a header row instead of plain text. If your code parses the plain-text output, update it.

## Downloading and exporting results
<a name="athena-duckdb-query-results-differences-export"></a>

Downloading and exporting query results differs in the following ways:
+ For managed query results larger than 200 MB, the console downloads the first 200 MB of the result. With Athena engine version 3, the console blocks the download and offers a sample.
+ To write results to your own files, use `COPY ... TO` or `CREATE TABLE AS SELECT` instead of `UNLOAD`.