Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

String Types

Misc Types

  • BOOLEANSTRING
  • BINARY (Note: Only available starting with Hive 0.8.0)

...

String literals can be expressed with either single quotes (') or double quotes ("). Hive uses C-style escaping within the strings.

Varchar

Anchor
varchar
varchar

Varchar types are created with a length specifier (between 1 and 65355), which defines the maximum number of characters allowed in the character string. If a string value being converted/assigned to a varchar value exceeds the length specifier, the string is silently truncated. Character length is determined by the number of code points contained by the character string.

Like string, trailing whitespace is significant in varchar and will affect comparison results.

Info
titleLimitations

Non-generic UDFs cannot directly use varchar type as input arguments or return values. String UDFs can be created instead, and the varchar values will be converted to strings and passed to the UDF. To use varchar arguments directly or to return varchar values, create a GenericUDF.
There may be other contexts which do not support varchar, if they rely on reflection-based methods for retrieving type information. This includes some SerDe implementations.

Info
titleVersion

Varchar datatype was introduced in Hive 0.12.0 (HIVE-4844).

Timestamps

Anchor
timestamp
timestamp

...