Interface LogicalType

All Known Implementing Classes:
LogicalType.BsonType, LogicalType.DateType, LogicalType.DecimalType, LogicalType.EnumType, LogicalType.Float16Type, LogicalType.GeographyType, LogicalType.GeometryType, LogicalType.IntervalType, LogicalType.IntType, LogicalType.JsonType, LogicalType.ListType, LogicalType.MapType, LogicalType.NullType, LogicalType.StringType, LogicalType.TimestampType, LogicalType.TimeType, LogicalType.UuidType, LogicalType.VariantType

Logical types that provide semantic meaning to physical types. Sealed interface allows for parameterized types (e.g., DECIMAL with scale/precision).

Construct a member through the static factory of the same name — string(), decimal(int, int), and so on. The parameterless factories return a shared instance, so calling one twice yields the same object.

Each implementation's toString() renders the Parquet-style annotation token shown in schema dumps and metadata views — STRING, LIST, DECIMAL(10, 2), TIMESTAMP(MICROS, UTC), and so on — not the default record representation.

See Also:
  • Method Details

    • string

      static LogicalType.StringType string()
      The STRING annotation, for a UTF-8 encoded string.
    • nullType

      static LogicalType.NullType nullType()
      The NULL annotation, for a column whose every value is null.
    • enumType

      static LogicalType.EnumType enumType()
      The ENUM annotation, for an enum stored as a UTF-8 string.
    • uuid

      static LogicalType.UuidType uuid()
      The UUID annotation, for a UUID stored as a 16-byte fixed-length byte array.
    • date

      static LogicalType.DateType date()
      The DATE annotation, for a calendar date in days since the Unix epoch.
    • json

      static LogicalType.JsonType json()
      The JSON annotation, for a JSON document stored as a UTF-8 string.
    • bson

      static LogicalType.BsonType bson()
      The BSON annotation, for a BSON document stored as a byte array.
    • interval

      static LogicalType.IntervalType interval()
      The INTERVAL annotation, for an interval stored as a 12-byte fixed-length byte array.
    • float16

      static LogicalType.Float16Type float16()
      The FLOAT16 annotation, for an IEEE 754 half-precision float stored as a 2-byte fixed-length byte array.
    • intType

      static LogicalType.IntType intType(int bitWidth, boolean isSigned)
      The INT annotation, for an integer of a given bit width and signedness.
      Parameters:
      bitWidth - number of bits (8, 16, 32, or 64)
      isSigned - true for signed integers, false for unsigned
    • decimal

      static LogicalType.DecimalType decimal(int precision, int scale)
      The DECIMAL annotation, for a decimal of a given precision and scale.
      Parameters:
      precision - total number of digits (must be positive)
      scale - number of digits after the decimal point
    • time

      static LogicalType.TimeType time(boolean isAdjustedToUTC, LogicalType.TimeUnit unit)
      The TIME annotation, for a time of day of a given resolution.
      Parameters:
      isAdjustedToUTC - true if the value is normalized to UTC
      unit - time resolution (millis, micros, or nanos)
    • timestamp

      static LogicalType.TimestampType timestamp(boolean isAdjustedToUTC, LogicalType.TimeUnit unit)
      The TIMESTAMP annotation, for a timestamp of a given resolution.
      Parameters:
      isAdjustedToUTC - true if the value is normalized to UTC
      unit - time resolution (millis, micros, or nanos)
    • list

      static LogicalType.ListType list()
      The LIST annotation, for a group holding a repeated element.
    • map

      static LogicalType.MapType map()
      The MAP annotation, for a group holding key-value pairs.
    • variant

      static LogicalType.VariantType variant(int specVersion)
      The VARIANT annotation, for a group holding a self-describing, semi-structured value.
      Parameters:
      specVersion - spec version declared by the writer (currently always 1)
    • geometry

      static LogicalType.GeometryType geometry(String crs)
      The GEOMETRY annotation, for planar geospatial values in a given CRS.
      Parameters:
      crs - geospatial coordinate reference system, OGC:CRS84 when null
    • geography

      static LogicalType.GeographyType geography(String crs, LogicalType.EdgeInterpolationAlgorithm edgeInterpolation)
      The GEOGRAPHY annotation, for geodesic geospatial values in a given CRS.
      Parameters:
      crs - geospatial coordinate reference system, OGC:CRS84 when null
      edgeInterpolation - geodesic formulation, LogicalType.EdgeInterpolationAlgorithm.SPHERICAL when null