'Returns the maximum value for all partitions in a table. Works only
for tables that have a single partition key. For subpartitioned
table, we recommend using signal tables.
>>> hh = HiveMetastoreHook()
>>> t = \'static_babynames_partitioned\'
>>> hh.max_partition(schema=\'airflow\', table_name=t)
\'2015-01-01\''

def max_partition(self, schema, table_name, field=None, filter=None):

    parts = self.get_partitions(schema, table_name, filter)
    if (not parts):
        return None
    elif (len(parts[0]) == 1):
        field = list(parts[0].keys())[0]
    elif (not field):
        raise AirflowException('Please    specify    the    field    you    want    the    max    value    for')
    return max([p[field] for p in parts])
