# [Pig Wiki] Update of "PigTypesFunctionalSpec" by SanthoshSrinivasan

```Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Pig Wiki" for change
```
The following page has been changed by SanthoshSrinivasan:
http://wiki.apache.org/pig/PigTypesFunctionalSpec

------------------------------------------------------------------------------
==== Numeric Equals and Notequals (==, !=) ====
||                 || '''bag''' || '''tuple''' || '''map''' || '''int''' ||
'''long''' || '''float''' || '''double''' || '''chararray''' || '''bytearray'''
||
|| '''bag'''       || error     || error       || error     || error     ||
error      || error       || error        || error           || error     ||
- || '''tuple'''     ||           || Tuple A is equal to tuple B iff they have
the same size s, and for all 0 <= i < s A[i] = = B[i] || error || error ||
error  || error   || error    || error       || error     ||
+ || '''tuple'''     ||           || boolean (Tuple A is equal to tuple B iff
they have the same size s, and for all 0 <= i < s A[i] = = B[i]) || error ||
error || error  || error   || error    || error       || error     ||
- || '''map'''       ||           ||             || Map A is equal to map B iff
A and B have the same number of entries, and for every key k1 in A with a value
of v1, there is a key k2 in B with a value of v2, such that k1 = = k2 and v1 =
= v2 || error || error  || error   || error    || error       || error     ||
+ || '''map'''       ||           ||             || boolean (Map A is equal to
map B iff A and B have the same number of entries, and for every key k1 in A
with a value of v1, there is a key k2 in B with a value of v2, such that k1 = =
k2 and v1 = = v2) || error || error  || error   || error    || error       ||
error     ||
- || '''int'''       ||           ||             ||           || yes       ||
yes        || yes         || yes          || error           || as int    ||
+ || '''int'''       ||           ||             ||           || boolean
|| boolean        || boolean         || boolean          || error           ||
boolean (bytearray cast as int)    ||
- || '''long'''      ||           ||             ||           ||           ||
yes        || yes         || yes          || error           || as long   ||
+ || '''long'''      ||           ||             ||           ||           ||
boolean        || boolean         || boolean          || error           ||
boolean (bytearray cast as long)   ||
- || '''float'''     ||           ||             ||           ||           ||
|| yes         || yes          || error           || as float  ||
+ || '''float'''     ||           ||             ||           ||           ||
|| boolean         || boolean          || error           || boolean
(bytearray cast as float)  ||
- || '''double'''    ||           ||             ||           ||           ||
||             || yes          || error           || as double ||
+ || '''double'''    ||           ||             ||           ||           ||
||             || boolean         || error           || boolean
(bytearray cast as double) ||
- || '''chararray''' ||           ||             ||           ||           ||
||             ||              || yes             || as chararray ||
+ || '''chararray''' ||           ||             ||           ||           ||
||             ||              || boolean             || boolean
(bytearray cast as chararray) ||
- || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || yes       ||
+ || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || boolean       ||

[[Anchor(String_equality_and_Inequality_Comparators.)]]
==== String Equality and Inequality Comparators. ====
@@ -276, +276 @@

|| '''bag'''       || error     || error       || error     || error     ||
error      || error       || error        || error           || error     ||
|| '''tuple'''     ||           || error       || error     || error     ||
error      || error       || error        || error           || error     ||
|| '''map'''       ||           ||             || error     || error     ||
error      || error       || error        || error           || error     ||
- || '''int'''       ||           ||             ||           || yes       ||
yes        || yes         || yes          || error           || as int    ||
+ || '''int'''       ||           ||             ||           || boolean
|| boolean        || boolean         || boolean          || error           ||
boolean (bytearray cast as int)    ||
- || '''long'''      ||           ||             ||           ||           ||
yes        || yes         || yes          || error           || as long   ||
+ || '''long'''      ||           ||             ||           ||           ||
boolean        || boolean         || boolean          || error           ||
boolean (bytearray cast as long)   ||
- || '''float'''     ||           ||             ||           ||           ||
|| yes         || yes          || error           || as float  ||
+ || '''float'''     ||           ||             ||           ||           ||
|| boolean         || boolean          || error           || boolean
(bytearray cast as float)  ||
- || '''double'''    ||           ||             ||           ||           ||
||             || yes          || error           || as double ||
+ || '''double'''    ||           ||             ||           ||           ||
||             || boolean          || error           || boolean
(bytearray cast as double) ||
- || '''chararray''' ||           ||             ||           ||           ||
||             ||              || yes             || as chararray ||
+ || '''chararray''' ||           ||             ||           ||           ||
||             ||              || boolean             || boolean
(bytearray cast as chararray) ||
- || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || yes       ||
+ || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || boolean       ||

[[Anchor(MATCHES)]]
==== MATCHES ====
||                 || '''chararray''' || '''bytearray''' ||
- || '''chararray''' || yes             || as chararray    ||
+ || '''chararray''' || boolean             || boolean (bytearray cast as
chararray)    ||
- || '''bytearray''' ||                 || yes             ||
+ || '''bytearray''' ||                 || boolean             ||

[[Anchor(IS_NULL_)]]
==== IS NULL  ====
@@ -307, +307 @@

|| '''bag'''       || error     || error       || error     || not yet   ||
not yet    || not yet     || not yet      || error           || error
||
|| '''tuple'''     ||           || error       || error     || not yet   ||
not yet    || not yet     || not yet      || error           || error
||
|| '''map'''       ||           ||             || error     || error     ||
error      || error       || error        || error           || error
||
- || '''int'''       ||           ||             ||           || yes       ||
yes        || yes         || yes          || error           || as int
||
+ || '''int'''       ||           ||             ||           || int       ||
long        || float         || double          || error           || int
(bytearray cast as int)          ||
- || '''long'''      ||           ||             ||           ||           ||
yes        || yes         || yes          || error           || as long
||
+ || '''long'''      ||           ||             ||           ||           ||
long        || float         || double          || error           || long
(bytearray cast as long)         ||
- || '''float'''     ||           ||             ||           ||           ||
|| yes         || yes          || error           || as float        ||
+ || '''float'''     ||           ||             ||           ||           ||
|| float         || double          || error           || float
(bytearray cast as float)        ||
- || '''double'''    ||           ||             ||           ||           ||
||             || yes          || error           || as double       ||
+ || '''double'''    ||           ||             ||           ||           ||
||             || double          || error           || double
(bytearray cast as double)       ||
|| '''chararray''' ||           ||             ||           ||           ||
||             ||              || error           || error           ||
- || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || as double
||
+ || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || double (bytearray
cast as double)           ||

[[Anchor(Modulo)]]
==== Modulo ====
This is a new operator, `%`, it is valid only for integer types.

||                 || '''int''' || '''long''' || '''bytearray''' ||
- || '''int'''       || yes       || yes        || as int          ||
+ || '''int'''       || int       || long        || int (bytearray cast as int)
||
- || '''long'''      ||           || yes        || as long         ||
+ || '''long'''      ||           || long        || long (bytearray cast as
long)         ||
|| '''bytearray''' ||           ||            || error           ||

We may choose not to implement the mod operator right away, as there are no
@@ -335, +335 @@

|| '''bag'''       || error     || error       || error     || error     ||
error      || error       || error        || error           || error
||
|| '''tuple'''     ||           || not yet     || error     || error     ||
error      || error       || error        || error           || error
||
|| '''map'''       ||           ||             || error     || error     ||
error      || error       || error        || error           || error
||
- || '''int'''       ||           ||             ||           || yes       ||
yes        || yes         || yes          || error           || as int
||
+ || '''int'''       ||           ||             ||           || int       ||
long        || float         || double          || error           || int
(bytearray cast as int)          ||
- || '''long'''      ||           ||             ||           ||           ||
yes        || yes         || yes          || error           || as long
||
+ || '''long'''      ||           ||             ||           ||           ||
long        || float         || double          || error           || long
(bytearray cast as long)         ||
- || '''float'''     ||           ||             ||           ||           ||
|| yes         || yes          || error           || as float        ||
+ || '''float'''     ||           ||             ||           ||           ||
|| float         || double          || error           || float
(bytearray cast as float)        ||
- || '''double'''    ||           ||             ||           ||           ||
||             || yes          || error           || as double       ||
+ || '''double'''    ||           ||             ||           ||           ||
||             || double          || error           || double
(bytearray cast as double)       ||
|| '''chararray''' ||           ||             ||           ||           ||
||             ||              || error           || error           ||
- || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || as double
||
+ || '''bytearray''' ||           ||             ||           ||           ||
||             ||              ||                 || double (bytearray
cast as double)           ||

[[Anchor(Concat)]]
=== Concat ===
@@ -348, +348 @@

A new operator concat will be added for chararrays.
||                 || '''chararray''' || '''bytearray''' ||
- || '''chararray''' || yes             || as chararray    ||
+ || '''chararray''' || chararray             || chararray (bytearray cast as
chararray)    ||
- || '''bytearray''' ||                 || yes             ||
+ || '''bytearray''' ||                 || bytearray             ||

[[Anchor(Unary_Operators)]]
=== Unary Operators ===
@@ -360, +360 @@

|| '''bag'''           || error ||
|| '''tuple'''         || error ||
|| '''map'''           || error ||
- || '''int'''           || yes   ||
+ || '''int'''           || int   ||
- || '''long'''          || yes   ||
+ || '''long'''          || long   ||
- || '''float'''         || yes   ||
+ || '''float'''         || float   ||
- || '''double'''        || yes   ||
+ || '''double'''        || double   ||
|| '''chararray'''     || error ||
- || '''bytearray'''     || as double ||
+ || '''bytearray'''     || double (as double) ||

[[Anchor(Size_)]]
==== Size  ====
```