org.apache.pig.scripting.groovy
Class GroovyUtils
java.lang.Object
org.apache.pig.scripting.groovy.GroovyUtils
public class GroovyUtils
- extends Object
Method Summary |
static Object |
groovyToPig(Object groovyObject)
Converts an object created on the Groovy side to its Pig counterpart. |
static Object |
pigToGroovy(Object pigObject)
Converts an object created on the Pig side to its Groovy counterpart. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GroovyUtils
public GroovyUtils()
groovyToPig
public static Object groovyToPig(Object groovyObject)
throws ExecException
- Converts an object created on the Groovy side to its Pig counterpart.
The conversions are as follow:
Groovy Pig
Object[] Tuple
groovy.lang.Tuple Tuple
org.apache.pig.data.Tuple Tuple
org.apache.pig.data.DataBag DataBag
java.util.Map Map
java.util.List DataBag
Byte/Short/Integer int
Long long
Float float
Double double
BigInteger BigInteger
BigDecimal BigDecimal
String chararray
byte[] DataByteArray (copy)
Boolean boolean
org.joda.time.DateTime org.joda.time.DateTime
null null
anything else raises an exception
- Parameters:
groovyObject
- Groovy object to convert
- Returns:
- the Pig counterpart of groovyObject
- Throws:
ExecException
pigToGroovy
public static Object pigToGroovy(Object pigObject)
throws ExecException
- Converts an object created on the Pig side to its Groovy counterpart.
The conversions are as follow:
Pig Groovy
Tuple groovy.lang.tuple
DataBag groovy.lang.Tuple containing the bag's size and an iterator on its
content
Map java.util.Map
int/long/float/double as is
chararray String
bytearray byte[] (copy)
boolean boolean
BigInteger BigInteger
BigDecimal BigDecimal
org.joda.time.DateTime org.joda.time.DateTime
null null
anything else raises an exception
- Parameters:
pigObject
-
- Returns:
- Object
- Throws:
ExecException
Copyright © 2007-2012 The Apache Software Foundation