Class TemporalMetadatas

java.lang.Object
dev.vortex.api.proto.TemporalMetadatas

public final class TemporalMetadatas extends Object
Utility class for creating and parsing temporal metadata in Vortex protocol buffers. Provides constants for time units and methods for serializing/deserializing timestamp metadata including time zone information. This class handles the binary format used to encode temporal type information in the Vortex data format.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.google.common.base.Supplier<byte[]>
    Supplier for date metadata with days precision.
    static final com.google.common.base.Supplier<byte[]>
    Supplier for date metadata with milliseconds precision.
    static final com.google.common.base.Supplier<byte[]>
    Supplier for time metadata with microseconds precision.
    static final com.google.common.base.Supplier<byte[]>
    Supplier for time metadata with milliseconds precision.
    static final com.google.common.base.Supplier<byte[]>
    Supplier for time metadata with nanoseconds precision.
    static final com.google.common.base.Supplier<byte[]>
    Supplier for time metadata with seconds precision.
    static byte
    Time unit constant representing days precision.
    static byte
    Time unit constant representing microseconds precision.
    static byte
    Time unit constant representing milliseconds precision.
    static byte
    Time unit constant representing nanoseconds precision.
    static byte
    Time unit constant representing seconds precision.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte
    getTimeUnit(byte[] serializedMetadata)
    Extract the time unit byte from the serialized metadata.
    getTimeZone(byte[] serializedMetadata)
    Read from a serialized metadata representation into a time zone string.
    static byte[]
    timestamp(byte timeUnit, Optional<String> timeZone)
    Creates serialized timestamp metadata with the specified time unit and optional time zone.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TIME_UNIT_NANOS

      public static byte TIME_UNIT_NANOS
      Time unit constant representing nanoseconds precision.
    • TIME_UNIT_MICROS

      public static byte TIME_UNIT_MICROS
      Time unit constant representing microseconds precision.
    • TIME_UNIT_MILLIS

      public static byte TIME_UNIT_MILLIS
      Time unit constant representing milliseconds precision.
    • TIME_UNIT_SECONDS

      public static byte TIME_UNIT_SECONDS
      Time unit constant representing seconds precision.
    • TIME_UNIT_DAYS

      public static byte TIME_UNIT_DAYS
      Time unit constant representing days precision.
    • DATE_DAYS

      public static final com.google.common.base.Supplier<byte[]> DATE_DAYS
      Supplier for date metadata with days precision.
    • DATE_MILLIS

      public static final com.google.common.base.Supplier<byte[]> DATE_MILLIS
      Supplier for date metadata with milliseconds precision.
    • TIME_SECONDS

      public static final com.google.common.base.Supplier<byte[]> TIME_SECONDS
      Supplier for time metadata with seconds precision.
    • TIME_MILLIS

      public static final com.google.common.base.Supplier<byte[]> TIME_MILLIS
      Supplier for time metadata with milliseconds precision.
    • TIME_MICROS

      public static final com.google.common.base.Supplier<byte[]> TIME_MICROS
      Supplier for time metadata with microseconds precision.
    • TIME_NANOS

      public static final com.google.common.base.Supplier<byte[]> TIME_NANOS
      Supplier for time metadata with nanoseconds precision.
  • Method Details

    • timestamp

      public static byte[] timestamp(byte timeUnit, Optional<String> timeZone)
      Creates serialized timestamp metadata with the specified time unit and optional time zone. The resulting byte array contains the time unit as the first byte, followed by a little-endian uint16 length field, and then the UTF-8 encoded time zone string (if present).
      Parameters:
      timeUnit - the time unit for the timestamp, must be between TIME_UNIT_NANOS and TIME_UNIT_SECONDS (exclusive of TIME_UNIT_DAYS)
      timeZone - optional time zone identifier string
      Returns:
      serialized timestamp metadata as a byte array
      Throws:
      RuntimeException - if timeUnit is invalid for timestamps
    • getTimeUnit

      public static byte getTimeUnit(byte[] serializedMetadata)
      Extract the time unit byte from the serialized metadata.
      Parameters:
      serializedMetadata - the serialized temporal metadata byte array
      Returns:
      the time unit byte from the first position of the metadata
      Throws:
      RuntimeException - if the time unit byte is invalid
    • getTimeZone

      public static Optional<String> getTimeZone(byte[] serializedMetadata)
      Read from a serialized metadata representation into a time zone string. Parses the time zone information from the serialized metadata, reading the length as a little-endian uint16 and then decoding the UTF-8 time zone string.
      Parameters:
      serializedMetadata - the serialized temporal metadata byte array
      Returns:
      Optional containing the time zone string, or empty if no time zone was specified