Friday, August 16, 2019

Pig Latin

The Pig Latin is a data flow language used by Apache Pig to analyze the data in Hadoop. It is a textual language that abstracts the programming from the Java MapReduce idiom into a notation.

Pig Latin Statements

The Pig Latin statements are used to process the data. It is an operator that accepts a relation as an input and generates another relation as an output.
  • It can span multiple lines.
  • Each statement must end with a semi-colon.
  • It may include expression and schemas.
  • By default, these statements are processed using multi-query execution

Pig Latin Conventions

ConventionDescription
( )The parenthesis can enclose one or more items. It can also be used to indicate the tuple data type.
Example - (10, xyz, (3,6,9))
[ ]The straight brackets can enclose one or more items. It can also be used to indicate the map data type.
Example - [INNER | OUTER]
{ }The curly brackets enclose two or more items. It can also be used to indicate the bag data type
Example - { block | nested_block }
...The horizontal ellipsis points indicate that you can repeat a portion of the code.
Example - cat path [path ...]

Latin Data Types

Simple Data Types

TypeDescription
intIt defines the signed 32-bit integer.
Example - 2
longIt defines the signed 64-bit integer.
Example - 2L or 2l
floatIt defines 32-bit floating point number.
Example - 2.5F or 2.5f or 2.5e2f or 2.5.E2F
doubleIt defines 64-bit floating point number.
Example - 2.5 or 2.5 or 2.5e2f or 2.5.E2F
chararrayIt defines character array in Unicode UTF-8 format.
Example - javatpoint
bytearrayIt defines the byte array.
booleanIt defines the boolean type values.
Example - true/false
datetimeIt defines the values in datetime order.
Example - 1970-01- 01T00:00:00.000+00:00
bigintegerIt defines Java BigInteger values.
Example - 5000000000000
bigdecimalIt defines Java BigDecimal values.
Example - 52.232344535345
Complex Types
TypeDescription
tupleIt defines an ordered set of fields.
Example - (15,12)
bagIt defines a collection of tuples.
Example - {(15,12), (12,15)}
mapIt defines a set of key-value pairs.
Example - [open#apache]


No comments:

Post a Comment

Lab 09: Publish and subscribe to Event Grid events

  Microsoft Azure user interface Given the dynamic nature of Microsoft cloud tools, you might experience Azure UI changes that occur after t...