

# Table formats, file formats, and SerDes in DuckDB

With DuckDB, you can read and write Hive tables and Apache Iceberg tables in the AWS Glue Data Catalog, and you can read data files directly from Amazon S3. Whether DuckDB can read a table depends on the table format, the SerDe (serializer and deserializer) that the table uses, and how the files are compressed.

The examples in this topic use a database named `sales_db` and files under `s3://amzn-s3-demo-bucket/`. To run the examples, replace these names with your own database and Amazon S3 location. Athena engine version 3 created most of the tables with CTAS queries. The tables hold orders from the same small set, and the `amount` column holds the order total in US dollars (USD).

## Supported SerDes and file formats
<a name="athena-duckdb-data-formats-serdes"></a>

The following table lists the SerDes that tables in the AWS Glue Data Catalog can use, and whether DuckDB reads and writes them. Write means `CREATE TABLE`, CTAS, and `INSERT INTO`.


| Data format | Read | Write | SerDe | 
| --- | --- | --- | --- | 
| Apache Parquet | Yes | Yes | `ParquetHiveSerDe` | 
| Apache Avro | Yes | Yes | `AvroSerDe` | 
| CSV, TSV, and other delimited text | Yes | Yes | `LazySimpleSerDe` | 
| CSV with quoted fields | Yes | Yes | `OpenCSVSerde` | 
| JSON | Yes | Yes | `JsonSerDe` (the Hive JSON SerDe) | 
| JSON | Yes | No | `JsonSerDe` (the OpenX JSON SerDe) | 
| Apache ORC | No | No | `OrcSerde` | 
| Amazon Ion | No | No | `IonHiveSerDe` | 
| Regex | No | No | `RegexSerDe` | 
| Grok | No | No | `GrokSerDe` | 
| RCFile | No | No | `LazyBinaryColumnarSerDe` | 
| CloudTrail logs | No | No | `CloudTrailSerde`, or a JSON SerDe with the input format `CloudTrailInputFormat` | 
| Hadoop SequenceFile | No | No | `LazySimpleSerDe` with the input format `SequenceFileInputFormat` | 

The SerDe column gives the last part of the class name in the table's SerDe serialization library. For example, `ParquetHiveSerDe` stands for `org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe`.

When a query reads a table whose SerDe DuckDB doesn't support, the query fails with an error that names the SerDe. A query of a CloudTrail table fails with an error that says that CloudTrail log tables aren't supported. For more information about these SerDes in Athena engine version 3, see [Choose a SerDe for your data](supported-serdes.md).

Tables stored as SequenceFile are the exception. DuckDB reads their files as plain text, so a query of such a table doesn't fail but returns wrong values. `INSERT INTO` such a table fails.

For more information about the properties of each SerDe that DuckDB reads, see [Delimited text (LazySimpleSerDe)](#athena-duckdb-data-formats-lazysimpleserde), [Quoted CSV (OpenCSVSerde)](#athena-duckdb-data-formats-opencsvserde), and [JSON](#athena-duckdb-data-formats-json).

The following SQL query reads an ORC table.

```sql
SELECT * FROM sales_db.orders_orc
```

The query fails with an error that says that tables with the ORC SerDe aren't supported.

The following SQL query reads the Parquet table that Athena engine version 3 wrote. Amounts are in US dollars (USD).

```sql
SELECT order_id, customer, amount, notes
FROM sales_db.orders_parquet
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | notes | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | `gift wrap` | 
| `2` | `Carlos Salazar` | `75.00` | `NULL` | 
| `3` | `Mary Major` | `42.25` | `leave at door` | 
| `4` | `John Stiles` | `310.00` | `fragile` | 

## Table formats
<a name="athena-duckdb-data-formats-table-formats"></a>

With DuckDB, you can use the following table formats in the AWS Glue Data Catalog:
+ Hive tables, partitioned or not, in the file formats that [Supported SerDes and file formats](#athena-duckdb-data-formats-serdes) marks as readable. DuckDB reads bucketed Hive tables, but it can't create them, and `INSERT INTO` a bucketed table fails.
+ Apache Iceberg tables with Parquet data files. The Iceberg tables that DuckDB creates use Parquet data files. A query of an Iceberg table whose data files are ORC or Avro fails with an error that says that the file format isn't supported.

DuckDB doesn't read or write the following tables. A query of one of them fails with an error that names the table format:
+ Delta Lake tables
+ Apache Hudi tables
+ Tables that use `SymlinkTextInputFormat` to list their data files in manifest files
+ Tables that use partition projection (`projection.enabled` set to `true`)

To read a table that uses partition projection with DuckDB, register its partitions in the AWS Glue Data Catalog and set `projection.enabled` to `false`. This change also applies to Athena engine version 3, which then reads only the partitions registered in the AWS Glue Data Catalog. For more information about partition projection, see [Use partition projection with Amazon Athena](partition-projection.md).

The following SQL query reads a Hive table that is partitioned by `region`.

```sql
SELECT region, count(*) AS orders
FROM sales_db.orders_by_region
GROUP BY region
ORDER BY region
```

The query returns the following results.


| region | orders | 
| --- | --- | 
| `east` | `2` | 
| `north` | `1` | 
| `west` | `1` | 

The following SQL query reads a table that the AWS Glue Data Catalog marks as a Delta Lake table.

```sql
SELECT * FROM sales_db.orders_delta
```

The query fails with an error that says that Delta Lake tables aren't supported.

The following SQL query reads an Iceberg table that Athena engine version 3 created with ORC data files.

```sql
SELECT * FROM sales_db.orders_iceberg_orc
```

The query fails with an error that says that the file format isn't supported. To read the data, use Athena engine version 3 to copy it into an Iceberg table with Parquet data files, for example with a CTAS query.

## Compression
<a name="athena-duckdb-data-formats-compression"></a>

The following table lists the compression codecs that DuckDB reads and writes for each file format.


| File format | Reads | Writes | 
| --- | --- | --- | 
| Parquet | Snappy, GZIP, ZSTD, Brotli, LZ4\_RAW, and uncompressed files | Snappy (the default), GZIP, and ZSTD | 
| Avro | Snappy, Deflate, bzip2, ZSTD, and uncompressed files | Uncompressed (the default), Snappy, Deflate, bzip2, and ZSTD | 
| CSV, other delimited text, and JSON | gzip (`.gz`), Zstandard (`.zst`), and uncompressed files | Uncompressed (the default), gzip, and Zstandard | 

Parquet and Avro files record their codec, so DuckDB reads them whatever their file names are. For text and JSON files, DuckDB goes by the file name extension. It decompresses files whose names end in `.gz` or `.zst`. It can't read files whose names end in `.bz2` (bzip2) or `.lz4` (LZ4), and the query fails with an error that names the compression type. It reads every other file as uncompressed text.

DuckDB can't read text and JSON files compressed with Snappy (`.snappy`). Because it reads them as uncompressed text, the query fails with an error that says that the file isn't valid UTF-8 or isn't valid JSON.

The following SQL query reads a CSV table whose files Athena engine version 3 compressed with bzip2.

```sql
SELECT * FROM sales_db.orders_text_bzip2
```

The query fails with an error that says that the bzip2 compression type isn't supported.

To choose the codec of the files that DuckDB writes, set `write_compression` when you create the table. The value is not case-sensitive. When you insert rows into a Parquet, text, or JSON table that Athena engine version 3 created, DuckDB uses the compression that the table records. If the table records a codec that DuckDB can't write, such as bzip2 for text, the `INSERT` statement fails. For more information about compression in Athena engine version 3, see [Use compression in Athena](compression-formats.md).

The following SQL statement creates a JSON table whose files are compressed with gzip. Amounts are in US dollars (USD).

```sql
CREATE TABLE sales_db.orders_gzip (
    order_id INTEGER,
    customer VARCHAR,
    amount DECIMAL(10,2)
) WITH (
    type = 'HIVE',
    format = 'json',
    write_compression = 'gzip',
    location = 's3://amzn-s3-demo-bucket/tables/gzip/'
)
```

The statement returns no rows.

The following SQL statement adds two orders to the table. Amounts are in US dollars (USD).

```sql
INSERT INTO sales_db.orders_gzip VALUES
    (1, 'Jane Doe', 120.50),
    (2, 'Carlos Salazar', 75.00)
```

The statement returns no rows.

The following SQL query lists the files of the table and checks their names.

```sql
SELECT
    count(*) AS files,
    bool_and(file LIKE '%.json.gz') AS all_gzip
FROM glob('s3://amzn-s3-demo-bucket/tables/gzip/*')
```

The query returns the following result.


| files | all\_gzip | 
| --- | --- | 
| `1` | `true` | 

## Delimited text (LazySimpleSerDe)
<a name="athena-duckdb-data-formats-lazysimpleserde"></a>

Tables that use `org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe` hold one row per line, with fields separated by a delimiter. DuckDB creates this kind of table when you set `format = 'csv'` without a `quote` or `escape` property. The SerDe doesn't treat quotation marks as special, so a quoted field keeps its quotation marks.

The following table shows how DuckDB handles the SerDe properties and table properties of these tables.


| Property | How DuckDB handles it | 
| --- | --- | 
| `field.delim` | Sets the field delimiter. Tables that you create with `format = 'csv'` use a comma unless you set the `delimiter` property. | 
| `serialization.null.format` | Sets the text that stands for `NULL`. The default is `\N`. | 
| `escape.delim` | Sets the escape character. Reads remove it, and writes add it before each delimiter in a value. To set it in `CREATE TABLE`, use the quoted key `'escape.delim'`, because the `escape` property creates a quoted CSV table. | 
| `skip.header.line.count` | Skips that many lines at the start of each file. When the value is `1`, writes start each file with a line of column names. When it is more than `1`, `INSERT` fails. | 
| `timestamp.formats` | Sets the patterns that DuckDB parses `TIMESTAMP` values with, for example `millis` for milliseconds since the epoch. | 
| `skip.footer.line.count` | Not supported. Queries of the table fail. | 
| `serialization.encoding` | Only UTF-8 is supported. Queries of a table with another encoding fail. | 

A field that doesn't fit the column type reads as `NULL`. Columns of type `ARRAY`, `MAP`, or `STRUCT` aren't supported, and a query of a table that has one fails.

The following SQL query reads a table whose files use a vertical bar as the delimiter, `NA` as the `NULL` text, and one header line. Amounts are in US dollars (USD).

```sql
SELECT * FROM sales_db.orders_pipe ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | notes | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | `gift wrap` | 
| `2` | `Carlos Salazar` | `NULL` | `NULL` | 
| `3` | `Mary Major` | `42.25` | `leave at door` | 

When a value that you insert holds the field delimiter or a line break, or equals the `NULL` text, the whole `INSERT` statement fails. If the table has an escape character, DuckDB escapes the delimiter, so the table can store values that hold it. A quoted CSV table can also store values that hold the delimiter. To store values that hold line breaks, use a Parquet table.

The following SQL statement creates a CSV table.

```sql
CREATE TABLE sales_db.orders_csv (
    order_id INTEGER,
    customer VARCHAR,
    notes VARCHAR
) WITH (
    type = 'HIVE',
    format = 'csv',
    location = 's3://amzn-s3-demo-bucket/tables/orders_csv/'
)
```

The statement returns no rows.

The following SQL statement inserts a value that holds a comma.

```sql
INSERT INTO sales_db.orders_csv VALUES
    (1, 'Jane Doe', 'gift wrap, fragile')
```

The statement fails with an error that says that a value holds the field delimiter or a line break, or is the `NULL` text.

## Quoted CSV (OpenCSVSerde)
<a name="athena-duckdb-data-formats-opencsvserde"></a>

Tables that use `org.apache.hadoop.hive.serde2.OpenCSVSerde` can hold fields in quotation marks, so a value can hold the delimiter. DuckDB creates this kind of table when you set `format = 'csv'` and a `quote` or `escape` property. When it writes the table, it puts every value in quotation marks, and it writes `NULL` as an empty field without quotation marks. A value that holds a line break makes the `INSERT` statement fail.

Keep the following in mind for these tables:
+ The SerDe properties `separatorChar`, `quoteChar`, and `escapeChar` set the delimiter, the quotation character, and the escape character. The defaults are a comma, a double quotation mark, and the quotation character. When `escapeChar` isn't set, DuckDB also treats a backslash as an escape character, so `C:\temp` reads as `C:temp`.
+ The SerDe has no `NULL` value. An empty field reads as an empty string.
+ A field that doesn't fit the column type makes the query fail, and so does an empty field in a column that isn't a string. To read such fields as `NULL`, set the table property `use.null.for.invalid.data` to `true`.
+ When you insert `NULL` into a column that isn't a string, DuckDB writes an empty field. Later queries that read that column fail unless the table sets `use.null.for.invalid.data` to `true`.
+ A `BOOLEAN` field reads as `true` when it holds `true` in any letter case. Any other value reads as `false`, even with `use.null.for.invalid.data`.
+ A `TIMESTAMP` field holds milliseconds since 1970-01-01 00:00:00 UTC, and a `DATE` field holds days since 1970-01-01. DuckDB writes these columns the same way.

The following SQL query reads the rows with notes from a table whose file has quoted fields and a header line. Amounts are in US dollars (USD).

```sql
SELECT order_id, customer, amount, notes
FROM sales_db.orders_opencsv
WHERE notes <> ''
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | notes | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | `gift wrap, fragile` | 
| `3` | `Mary Major` | `42.25` | `leave at door` | 

The following SQL statement creates a CSV table with quoted fields.

```sql
CREATE TABLE sales_db.orders_quoted (
    order_id INTEGER,
    customer VARCHAR,
    notes VARCHAR
) WITH (
    type = 'HIVE',
    format = 'csv',
    quote = '"',
    location = 's3://amzn-s3-demo-bucket/tables/quoted/'
)
```

The statement returns no rows.

The following SQL statement inserts a value that holds a comma, and a `NULL` value.

```sql
INSERT INTO sales_db.orders_quoted VALUES
    (1, 'Jane Doe', 'gift wrap, fragile'),
    (2, 'Carlos Salazar', NULL)
```

The statement returns no rows.

The following SQL query reads the rows back. It shows the length of each value, which includes the comma, and checks whether the `NULL` value came back as `NULL` or as an empty string.

```sql
SELECT
    order_id,
    length(notes) AS notes_length,
    notes IS NULL AS notes_is_null,
    notes = '' AS notes_is_empty
FROM sales_db.orders_quoted
ORDER BY order_id
```

The query returns the following results.


| order\_id | notes\_length | notes\_is\_null | notes\_is\_empty | 
| --- | --- | --- | --- | 
| `1` | `18` | `false` | `false` | 
| `2` | `0` | `false` | `true` | 

## JSON
<a name="athena-duckdb-data-formats-json"></a>

DuckDB reads tables that use the Hive JSON SerDe (`org.apache.hive.hcatalog.data.JsonSerDe`) or the OpenX JSON SerDe (`org.openx.data.jsonserde.JsonSerDe`). Each line of a file must hold one JSON object. A JSON object that spans several lines makes the query fail. Keys match column names whatever their case. Columns of type `ARRAY`, `MAP`, and `STRUCT` are supported.

When you create a JSON table, DuckDB uses the Hive JSON SerDe. It can't insert rows into a table that uses the OpenX JSON SerDe.

The following table shows how DuckDB handles the SerDe properties of the OpenX JSON SerDe.


| Property | How DuckDB handles it | 
| --- | --- | 
| `ignore.malformed.json` | With `true`, a line that isn't valid JSON reads as a row of `NULL` values, and a value that doesn't fit its column reads as `NULL`. Otherwise, either one makes the query fail. | 
| `case.insensitive` | With `false`, keys must match column names exactly. The default is `true`. | 
| `use.null.for.invalid.data` | With `true`, a value that doesn't fit its column reads as `NULL`, for example `"eleven"` in an `INT` column. Otherwise, the query fails, unless `ignore.malformed.json` is `true`. | 
| `mapping.`{{column\_name}} | DuckDB ignores it and reads each column from the key with the column's own name. | 
| `dots.in.keys` | DuckDB ignores it. For example, a `user_id` column reads as `NULL` when the file has the key `user.id`. | 

Keep the following in mind when you read JSON tables with either SerDe:
+ A number with a fractional part reads into an integer column rounded to the nearest whole number, not truncated. A value exactly halfway between two whole numbers rounds to the even one. For example, `0.54` reads as `1`, `2.5` reads as `2`, `3.5` reads as `4`, and `-1.7` reads as `-2`.
+ In a `BOOLEAN` column, the number `1` and the string `"yes"` read as `true`.
+ A string that holds a whole number, such as `"51"`, reads into an `INT` column as that number.
+ A `TIMESTAMP` value must be text, such as `2026-10-01 12:34:56.789`. A number, such as seconds or milliseconds since 1970-01-01, makes the query fail. DuckDB ignores the `timestamp.formats` SerDe property of the Hive JSON SerDe, so a value such as `10/01/2026 12:34` makes the query fail even when `timestamp.formats` matches it.
+ When a `TIMESTAMP` value has a time zone offset, DuckDB drops the offset. For example, `2026-10-01 12:34:00+02:00` reads as `2026-10-01 12:34:00`.
+ A JSON object in a string column reads as its JSON text, such as `{"k":1}`.
+ A key that appears twice in one object makes the query fail. With the OpenX JSON SerDe and `ignore.malformed.json` set to `true`, the column gets the first of the two values.
+ Two JSON objects on one line make the query fail. With the OpenX JSON SerDe and `ignore.malformed.json` set to `true`, the line reads as a row of `NULL` values, so neither object is read.
+ DuckDB skips empty lines.

The following SQL query reads a table that sets `ignore.malformed.json` to `true` and maps the `ship_city` column to the key `ship.city`. One line of the file isn't JSON.

```sql
SELECT * FROM sales_db.orders_openx ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | ship\_city | 
| --- | --- | --- | 
| `1` | `Jane Doe` | `NULL` | 
| `2` | `Carlos Salazar` | `NULL` | 
| `3` | `Mary Major` | `NULL` | 
| `NULL` | `NULL` | `NULL` | 

The line that isn't JSON comes back as a row of `NULL` values. The `ship_city` column is `NULL` in every row, because DuckDB doesn't apply the mapping.

The following SQL query reads the JSON table that Athena engine version 3 wrote with the Hive JSON SerDe. Amounts are in US dollars (USD).

```sql
SELECT order_id, customer, amount, order_date
FROM sales_db.orders_json
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | order\_date | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | `2026-10-01` | 
| `2` | `Carlos Salazar` | `75.00` | `2026-10-01` | 
| `3` | `Mary Major` | `42.25` | `2026-10-02` | 
| `4` | `John Stiles` | `310.00` | `2026-10-03` | 

## Avro
<a name="athena-duckdb-data-formats-avro"></a>

DuckDB reads each Avro file with the schema stored in the file. It matches the file's fields to the table columns by name, so the column order can differ.

The following SQL query reads the Avro table that Athena engine version 3 wrote. Amounts are in US dollars (USD).

```sql
SELECT order_id, customer, amount, shipped_at
FROM sales_db.orders_avro
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | shipped\_at | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | `2026-10-01 09:15:00` | 
| `2` | `Carlos Salazar` | `75.00` | `2026-10-01 17:40:30.25` | 
| `3` | `Mary Major` | `42.25` | `2026-10-02 08:05:00` | 
| `4` | `John Stiles` | `310.00` | `NULL` | 

## Read data in formats that DuckDB doesn't support
<a name="athena-duckdb-data-formats-unsupported"></a>

For ORC and Ion tables, use Athena engine version 3 to rewrite the data in Parquet with a CTAS query, and then query the new table. For tables of text logs, you can often read the files directly with the functions that read files, as the following examples show.

CloudTrail log files hold one JSON object per file, with the events in its `Records` array. The following SQL query reads the events with the [`read_json` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json) and turns each one into a row with the [`unnest` function](duckdb-functions-list-ranges-and-unnesting.md#athena-duckdb-functions-list-unnest).

```sql
SELECT
    r.eventTime AS event_time,
    r.eventName AS event_name,
    r.userIdentity.userName AS user_name
FROM (
    SELECT unnest(Records) AS r
    FROM read_json(
        's3://amzn-s3-demo-bucket/cloudtrail/**/*.json.gz'
    )
)
ORDER BY event_time
```

The query returns the following results.


| event\_time | event\_name | user\_name | 
| --- | --- | --- | 
| `2026-10-01 09:15:00+00` | `GetObject` | `JaneDoe` | 
| `2026-10-01 09:16:12+00` | `StartQueryExecution` | `CarlosSalazar` | 

A table that uses the Regex SerDe describes the fields of a log line with a regular expression. The following SQL query reads the lines of a web server log with the [`read_text` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-text) and splits them into fields with the [`regexp_extract` function](duckdb-functions-string-regular-expressions.md#athena-duckdb-functions-string-regexp-extract).

```sql
WITH lines AS (
    SELECT unnest(string_split(content, chr(10))) AS line
    FROM read_text(
        's3://amzn-s3-demo-bucket/logs/access.log'
    )
),
fields AS (
    SELECT regexp_extract(
        line,
        '^(\S+) .*"(\S+) (\S+) [^"]*" (\d+)',
        ['client', 'method', 'path', 'status']
    ) AS r
    FROM lines
    WHERE line <> ''
)
SELECT r.client, r.method, r.path, r.status
FROM fields
ORDER BY r.client
```

The query returns the following results.


| client | method | path | status | 
| --- | --- | --- | --- | 
| `192.0.2.10` | `GET` | `/index.html` | `200` | 
| `198.51.100.7` | `POST` | `/cart` | `302` | 
| `203.0.113.42` | `GET` | `/missing` | `404` | 

## Read files directly from Amazon S3
<a name="athena-duckdb-data-formats-direct-reads"></a>

To read files without a table, call a function that reads files with an `s3://` path, or name a file path in the `FROM` clause. These functions include the [`read_parquet` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-parquet), the [`read_csv` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-csv), the [`read_json` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-json), and the [`read_avro` function](duckdb-functions-table-file-readers.md#athena-duckdb-functions-table-read-avro).

These functions accept paths with wildcards such as `*`. These reads use the IAM permissions of the principal that runs the query, and they don't use table definitions from the AWS Glue Data Catalog.

The following SQL query reads the gzip-compressed CSV files of a Hive table directly.

```sql
SELECT order_id, customer, shipped_at, notes
FROM read_csv(
    's3://amzn-s3-demo-bucket/tables/orders_text/*',
    header = false,
    columns = {
        'order_id': 'INTEGER',
        'customer': 'VARCHAR',
        'region': 'VARCHAR',
        'amount': 'DECIMAL(10,2)',
        'order_date': 'DATE',
        'shipped_at': 'TIMESTAMP',
        'notes': 'VARCHAR'
    },
    nullstr = '\N'
)
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | shipped\_at | notes | 
| --- | --- | --- | --- | 
| `1` | `Jane Doe` | `2026-10-01 09:15:00` | `gift wrap` | 
| `2` | `Carlos Salazar` | `2026-10-01 17:40:30.25` | `NULL` | 
| `3` | `Mary Major` | `2026-10-02 08:05:00` | `leave at door` | 
| `4` | `John Stiles` | `NULL` | `fragile` | 

The `header` option says that the files have no header line. The `columns` option names each field of the files in order, with its type. The `nullstr` option names the text that the table uses for `NULL`.

The following SQL query names a Parquet file in the `FROM` clause. Amounts are in US dollars (USD).

```sql
SELECT *
FROM 's3://amzn-s3-demo-bucket/data/orders.parquet'
ORDER BY order_id
```

The query returns the following results.


| order\_id | customer | amount | 
| --- | --- | --- | 
| `1` | `Jane Doe` | `120.50` | 
| `2` | `Carlos Salazar` | `75.00` | 
| `3` | `Mary Major` | `42.25` | 

If you name a file that doesn't exist, the error says that the Amazon S3 bucket doesn't exist, even when the bucket exists. If a path with wildcards matches no files, the error says that no files match the pattern. Error messages don't include the path, so check the path in the query when you get either error.

The following SQL query reads a file that doesn't exist.

```sql
SELECT count(*) AS orders
FROM read_parquet(
    's3://amzn-s3-demo-bucket/data/missing.parquet'
)
```

The query fails with an error that says that the specified Amazon S3 bucket doesn't exist.

## Choose the format of a new table
<a name="athena-duckdb-data-formats-create"></a>

In a `CREATE TABLE` statement, the `format` property sets the file format of a Hive table: `'parquet'` (the default), `'csv'`, `'json'`, or `'avro'`. Other values, such as `'orc'`, `'textfile'`, and `'ion'`, make the statement fail.

Some properties that Athena engine version 3 CTAS queries use have other names in DuckDB, or no equivalent. The following table lists them.


| Athena engine version 3 property | DuckDB equivalent | 
| --- | --- | 
| `external_location` | `location` | 
| `partitioned_by` | A `PARTITIONED BY (`{{column}}`)` clause | 
| `field_delimiter` | `delimiter` | 
| `format = 'TEXTFILE'` | `format = 'csv'` | 
| `bucketed_by` and `bucket_count` | No equivalent. DuckDB can't create bucketed tables, and the statement fails. | 

The defaults of `format = 'csv'` differ from `TEXTFILE` in Athena engine version 3. DuckDB uses a comma and no compression, and Athena engine version 3 uses `\001` and GZIP.

Most other properties that DuckDB doesn't know become table properties in the AWS Glue Data Catalog, without an error. For example, `compression = 'zstd'` doesn't change the codec, but `write_compression = 'zstd'` does. For more information about the other properties of new tables, see [CREATE TABLE and CREATE TABLE AS statements in DuckDB](duckdb-statement-create-table.md).

## Differences from Athena engine version 3
<a name="athena-duckdb-data-formats-differences-from-engine-version-3"></a>

Keep the following differences in mind when you query the same tables with Athena engine version 3 and DuckDB:
+ DuckDB doesn't read ORC, Ion, Regex, Grok, RCFile, or CloudTrail tables, Delta Lake or Hudi tables, symlink tables, or tables that use partition projection.
+ DuckDB doesn't read Iceberg tables whose data files are ORC or Avro.
+ DuckDB doesn't support tables stored as SequenceFile.
+ DuckDB can't read delimited text tables with `ARRAY`, `MAP`, or `STRUCT` columns, which Athena engine version 3 can create.
+ DuckDB doesn't read text or JSON files compressed with bzip2, LZ4, or Snappy.
+ DuckDB doesn't apply the `mapping.*` and `dots.in.keys` properties of the OpenX JSON SerDe, or the `timestamp.formats` property of the Hive JSON SerDe.
+ In JSON tables, a number with a fractional part reads into an integer column rounded on DuckDB and truncated toward zero on Athena engine version 3. For example, `0.54` reads as `1` on DuckDB and as `0` on Athena engine version 3, and `1.5` reads as `2` and as `1`.
+ In Hive JSON tables, a string that holds a whole number, such as `"51"`, reads into an `INT` column on DuckDB. On Athena engine version 3, the query fails.
+ In JSON tables, the number `1` and the string `"yes"` read as `true` in a `BOOLEAN` column on DuckDB, and as `false` on Athena engine version 3.
+ In OpenX JSON tables, Athena engine version 3 reads a number in a `TIMESTAMP` column as seconds or milliseconds since 1970-01-01. On DuckDB, the query fails.
+ In JSON tables, DuckDB reads a `TIMESTAMP` value with a time zone offset, such as `+02:00`, and drops the offset. On Athena engine version 3, the query fails.
+ In JSON tables, a key that appears twice in one object, or two JSON objects on one line, make the query fail on DuckDB. Athena engine version 3 uses the last of the two values, and reads only the first object on the line. In OpenX JSON tables with `ignore.malformed.json` set to `true`, DuckDB uses the first of the two values, and reads a line with two objects as a row of `NULL` values.
+ DuckDB writes Parquet with Snappy by default, and text and JSON uncompressed by default. Athena engine version 3 uses GZIP for these formats by default.
+ DuckDB can't create bucketed tables. Athena engine version 3 creates them with the `bucketed_by` and `bucket_count` CTAS properties.