pig tutorial - apache pig tutorial - Apache Pig Bag & Tuple Functions - pig latin - apache pig - pig hadoop



What is Bag & Tuple Functions in Apache Pig ?

  • Tuple: A tuple is a set of fields. Here Id and product_name form a tuple. Tuples are represented by braces. Example: (10, iphone).
  • enclosed by (), items separated by ","
  • Non-empty tuple: (item1,item2,item3)
  • Empty tuple is valid: ()
  • Bag: A bag is collection of tuples. Bag is represented by flower braces. Exa enclosed by (), items separated by ","
  • enclosed by {}, tuples separated by ","
  • Non-empty bag: {code}{(tuple1),(tuple2),(tuple3)}{code}
  • Empty bag is valid: {}
 apache pig bag & tuple functions

Learn apache pig - apache pig tutorial - apache pig bag & tuple functions - apache pig examples - apache pig programs

  • The list of Bag and Tuple functions.
S.no Syntax Functions & Description
1 TOBAG (expression [, expression …]) TOBAG() To convert two or more expressions intoa bag.
2 TOP (topN,column,relation) TOP() To get the top N tuples of a relation.
3 TOTUPLE (expression [, expression …]) TOTUPLE() To convert one or more expressions into a tuple.
4 TOMAP (key-expression, value-expression [, key-expression, value-expression …]) TOMAP()To convert the key-value pairs into a Map.

Related Searches to Apache Pig Bag & Tuple Functions