Pig Datatypes

Numeric datatypes

int

  • Singned 32-bit integer
  • Example: 8 (or) 5 (or) any number

long

  • Singned 64-bit integer
  • Example: 5L (or) 5l

float

  • 32-bit floating point
  • Example: 5.5F (or) 5.5f (or) 5.0f (or) any number with decimal 

    (early version, recently float has been dropped)

double

  • 64-bit floating point
  • Example: 10.5 (or) 5.0 (or) 1.5 (or) 1.5e2 (or) 1.5E2 (or) any number with decimal

Non-numeric or Arrays datatype

chararray 

  • character array(string)
  • Example: 'karpagaraj' or 'hello there' or any string

bytearray

  • blob
  • Example: any binary data

Non-numeric datatype

  • boolean
    • true or false (case sensitive)
  • datetime
    • Example 1970-01-01T00:00:00.000+00:00
  • null
    • unknown or data missing or any data element can be null.

Complex datatype

tuple

  • ordered set of fields
  • Example: (1,3) like that

bag

  • collection of tuples
  • Example: {(1,3),(4,6)}

map

  • collection of tuples: set of key/value pairs
  • Example: [k1#v1, k2#v2]

atom 

  • any single value in Pig Latin, irrespective of their data, type is known as "Atom".
  • A piece of data or a simple atomic value is known as a "field". 
  • It is a simple atomic data value. It is stored as a string but can be used as either a string or a number. 
  • Various atomic values of Pig are int, long, float, double, chararray, and byte array.
  • Example − 'raja' or '30'

Comments

Popular posts from this blog

Hive File Formats

HDFS Infographic

Why We Need Hadoop?