A physical data type is the low-level representation used to store a value on disk in a Parquet file. Parquet supports a small set of physical types, including Boolean, integers of various sizes, and byte arrays. Logical types add metadata that tells readers how to interpret those stored values: a date, for example, can be stored as a numeric INT32 value while being exposed as DATE. section 5.4 section 5.5
Use physical types deliberately when converting and inspecting data:
- Convert source values to precise logical types before writing Parquet; parsing ranking_date with %Y%m%d produces a DATE rather than leaving it as an integer. section 5.4
- Inspect the user-facing schema with DESCRIBE, then inspect the on-disk representation with parquet_schema. section 5.5
- Choose the smallest numeric physical type that can hold the data when performance matters, because smaller numerical values support more parallel vector operations. section 5.5
Dates stored as integers
A Parquet schema can expose ranking_date as DATE while storing it physically as INT32 with DATE metadata. Text columns such as name_first use BYTE_ARRAY with UTF8 interpretation, while rank and points use INT64.
┌───────────────┬────────────┬────────────────┬──────────────┐ │ name │ type │ converted_type │ logical_type │ │ varchar │ varchar │ varchar │ varchar │ ├───────────────┼────────────┼────────────────┼──────────────┤ │ duckdb_schema │ │ │ │ │ ranking_date │ INT32 │ DATE │ │ │ rank │ INT64 │ INT_64 │ │ │ points │ INT64 │ INT_64 │ │ │ player_id │ INT64 │ INT_64 │ │ │ name_first │ BYTE_ARRAY │ UTF8 │ │ │ name_last │ BYTE_ARRAY │ UTF8 │ │ │ hand │ BYTE_ARRAY │ UTF8 │ │ │ dob │ INT32 │ DATE │ │ │ ioc │ BYTE_ARRAY │ UTF8 │ │ │ height │ INT64 │ INT_64 │ │ ├───────────────┴────────────┴────────────────┴──────────────┤ │ 11 rows 4 columns │ └────────────────────────────────────────────────────────────┘
Inspect the relationship between each column's physical type and its converted or logical interpretation. section 5.5
