Review Board 1.7.22


Add BigInteger and BigDecimal to Pig

Review Request #9012 - Created Jan. 17, 2013 and updated

Jonathan Coveney
add_bigint_bigdec
PIG-2764
Reviewers
pig
gates, herberts
pig-git
This patch adds big integer and big decimal support to Pig. It could use more tests, something I'd appreciate feedback on (but I wanted to make sure the core implementation is good)

 
src/org/apache/pig/backend/hadoop/HDataType.java
Diff Revision 1 Diff Revision 2
[20] 18 lines
[+20]
19

    
   
19

   
20
import java.math.BigDecimal;
20
import java.math.BigDecimal;
21
import java.math.BigInteger;
21
import java.math.BigInteger;
22
import java.util.Map;
22
import java.util.Map;
23

    
   
23

   
24
import org.joda.time.DateTime;

   
25

    
   

   
26
import org.apache.pig.PigException;
24
import org.apache.pig.PigException;
27
import org.apache.pig.backend.executionengine.ExecException;
25
import org.apache.pig.backend.executionengine.ExecException;
28
import org.apache.pig.data.DataBag;
26
import org.apache.pig.data.DataBag;
29
import org.apache.pig.data.DataType;
27
import org.apache.pig.data.DataType;
30
import org.apache.pig.data.Tuple;
28
import org.apache.pig.data.Tuple;
31
import org.apache.pig.impl.io.NullableBag;
29
import org.apache.pig.impl.io.NullableBag;
32
import org.apache.pig.impl.io.NullableBigDecimalWritable;
30
import org.apache.pig.impl.io.NullableBigDecimalWritable;
33
import org.apache.pig.impl.io.NullableBigIntegerWritable;
31
import org.apache.pig.impl.io.NullableBigIntegerWritable;
34
import org.apache.pig.impl.io.NullableBooleanWritable;
32
import org.apache.pig.impl.io.NullableBooleanWritable;
35
import org.apache.pig.impl.io.NullableBytesWritable;
33
import org.apache.pig.impl.io.NullableBytesWritable;

    
   
34
import org.apache.pig.impl.io.NullableDateTimeWritable;
36
import org.apache.pig.impl.io.NullableDoubleWritable;
35
import org.apache.pig.impl.io.NullableDoubleWritable;
37
import org.apache.pig.impl.io.NullableFloatWritable;
36
import org.apache.pig.impl.io.NullableFloatWritable;
38
import org.apache.pig.impl.io.NullableIntWritable;
37
import org.apache.pig.impl.io.NullableIntWritable;
39
import org.apache.pig.impl.io.NullableLongWritable;
38
import org.apache.pig.impl.io.NullableLongWritable;
40
import org.apache.pig.impl.io.NullableDateTimeWritable;

   
41
import org.apache.pig.impl.io.NullableText;
39
import org.apache.pig.impl.io.NullableText;
42
import org.apache.pig.impl.io.NullableTuple;
40
import org.apache.pig.impl.io.NullableTuple;
43
import org.apache.pig.impl.io.PigNullableWritable;
41
import org.apache.pig.impl.io.PigNullableWritable;

    
   
42
import org.joda.time.DateTime;
44

    
   
43

   
45
/**
44
/**
46
 * A class of helper methods for converting from pig data types to hadoop
45
 * A class of helper methods for converting from pig data types to hadoop
47
 * data types, and vice versa.
46
 * data types, and vice versa.
48
 */
47
 */
[+20] [20] 162 lines
[+20] [+] public static PigNullableWritable getWritableComparableTypes(byte type) throws ExecException{
211
        case DataType.BIGINTEGER:
210
        case DataType.BIGINTEGER:
212
            wcKey = bigIntWrit;
211
            wcKey = bigIntWrit;
213
            break;
212
            break;
214
        case DataType.BIGDECIMAL:
213
        case DataType.BIGDECIMAL:
215
            wcKey = bigDecWrit;
214
            wcKey = bigDecWrit;

    
   
215
            break;
216
        case DataType.DATETIME:
216
        case DataType.DATETIME:
217
            wcKey = dtWrit;
217
            wcKey = dtWrit;
218
            break;
218
            break;
219
        case DataType.TUPLE:
219
        case DataType.TUPLE:
220
            wcKey = defTup;
220
            wcKey = defTup;
[+20] [20] 49 lines
src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/builtin/TextLoader.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/data/DataReaderWriter.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/data/DataType.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/data/DefaultTuple.java
Diff Revision 1 Diff Revision 2
 
src/org/apache/pig/data/SizeUtil.java
Diff Revision 1 Diff Revision 2
 
  1. src/org/apache/pig/backend/hadoop/HDataType.java: Loading...
  2. src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java: Loading...
  3. src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java: Loading...
  4. src/org/apache/pig/builtin/TextLoader.java: Loading...
  5. src/org/apache/pig/data/DataReaderWriter.java: Loading...
  6. src/org/apache/pig/data/DataType.java: Loading...
  7. src/org/apache/pig/data/DefaultTuple.java: Loading...
  8. src/org/apache/pig/data/SizeUtil.java: Loading...