Customizing Time Zones

Starting in Impala 3.1, you can customize the time zone definitions used in Impala.
Upgrading custom IANA time zone database:
  1. Download latest IANA time zone database distribution:
    git clone https://github.com/eggert/tz
    Alternatively, download a specific tzdb version from:
     https://www.iana.org/time-zones/repository
  2. Build timezone tools:
    cd tz
    make TOPDIR=tzdata install
  3. Generate the compiled binary time zone database:
    ./zic -d ./tzdata/etc/zoneinfo africa antarctica asia australasia backward backzone etcetera europe factory northamerica pacificnew southamerica systemv
  4. Create zip archive:
    pushd ./tzdata/etc
    zip -r zoneinfo.zip zoneinfo
    popd
  5. Copy the time zone database to HDFS:
    hdfs dfs -mkdir -p /tzdb/latest
    hdfs dfs -copyFromLocal ./tzdata/etc/zoneinfo.zip /tzdb/latest
  6. Set the ‑‑hdfs_zone_info_zip startup flag to /tzdb/latest/zoneinfo.zip as an impalad safety valve.
  7. Perform a full restart of Impala service.

Configuring custom time zone aliases:

  1. Create a tzalias.conf config file that contains time zone alias definitions formatted as ALIAS = DEFINITION. For example:
    #
    # Define aliases for existing timezone names:
    #
    Universal Coordinated Time = UTC
    Mideast/Riyadh89 = Asia/Riyadh
    PDT = America/Los_Angeles
    #
    # Define aliases as UTC offsets in seconds:
    #
    GMT-01:00 = 3600
    GMT+01:00 = -3600
  2. Copy the config file to HDFS:
    hdfs dfs -mkdir -p /tzdb
    hdfs dfs -copyFromLocal tzalias.conf /tzdb
  3. Set the ‑‑hdfs_zone_alias_conf startup flag to /tzdb/tzalias.conf as an impalad safety valve.
  4. Perform a full restart of Impala service.

Added in: Impala 3.1