Skip to main content
Extracts the year from a date or timestamp value and returns it as the number of years since 1970, according to the Iceberg partition transforms specification.

Syntax

ICEBERG_YEAR(<value>)

Parameters

ParameterDescriptionSupported input types
<value>The date or timestamp value to extract the year from.DATE, TIMESTAMP, TIMESTAMPTZ

Return type

INTEGER Returns the number of years since 1970. For dates before 1970, returns a negative value.

Remarks

The ICEBERG_YEAR function can be used in the PARTITION BY clause of CREATE ICEBERG TABLE commands.
CREATE ICEBERG TABLE events
  PARTITION BY (iceberg_year(event_date))
  AS SELECT * FROM source_events
WITH LOCATION = my_iceberg_location;

Example

SELECT iceberg_year('2025-12-15'::DATE) AS year_partition;
Returns:
year_partition
55