Apache Hive : HPL/SQL - MIN_PART_DATE Function

Last updated: August 12, 2026

Apache Hive : HPL/SQL - MIN_PART_DATE Function

MIN_PART_DATE function finds the minimum value for the specified partition column of type DATE.

Syntax:

MIN_PART_DATE([db_name.]table_name [, column_name [, part_col=filter, ...]]); 

Parameters:

ParameterTypeValueDescription
[dbname.]table_nameVARCHARIdentifier, variable or expressionTable name
column_nameVARCHARIdentifier, variable or expressionPartition column name
part_col=filterPartition filter

Notes:

  • If column name is not specified, the first partition column is used
  • Partition filter applied before finding the minimum value

Return Value:

  • The minimum date for the specified partition
  • NULL if the table or partition do not exist, or the table is empty

Return Type:

DATE.

Example 1:

Table db.orders is partitioned by local_date and has the following partitions:

Partitions
local_date=2014-12-02
local_date=2014-12-03
local_date=2014-12-04

Find the minimum value of the partition:

MIN_PART_DATE(db.orders); 

Result: 2014-12-02

Example 2:

Table db.sales is partitioned by country and local_date and has the following partitions:

Partitions
country=US/local_date=2014-12-02
country=US/local_date=2014-12-03
country=UK/local_date=2014-12-04

Find the minimum value for local_date partition column for country US:

MIN_PARTITION_DATE(db.sales, local_date, country='US'); 

Result: 2014-12-02

Compatibility: HPL/SQL extension.

See also: