Review Board 1.7.22


HIVE-2272: add TIMESTAMP data type

Review Request #1135 - Created July 15, 2011 and updated

Franklin Hu
HIVE-2272
Reviewers
hive
heyongqiang, nzhang, sdong
hive
Adds TIMESTAMP type to serde2 with both string (LazySimple) and binary (LazyBinary) serialization.
Supports SQL style jdbc timestamps of the format with nanosecond precision
YYYY-MM-DD HH:MM:SS[.fff...]
Wrote some unit tests for string/binary serialization. Also ran against test data and looked consistent

Diff revision 2

This is not the most recent revision of the diff. The latest diff is revision 7. See what's changed.

1 2 3 4 5 6 7
1 2 3 4 5 6 7

  1. trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java: Loading...
  2. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java: Loading...
  3. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java: Loading...
  4. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java: Loading...
  5. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDate.java: Loading...
  6. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateAdd.java: Loading...
  7. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateDiff.java: Loading...
  8. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateSub.java: Loading...
  9. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java: Loading...
  10. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java: Loading...
  11. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java: Loading...
  12. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java: Loading...
  13. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java: Loading...
  14. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToBoolean.java: Loading...
  15. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToByte.java: Loading...
  16. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToDouble.java: Loading...
  17. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToFloat.java: Loading...
  18. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java: Loading...
  19. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java: Loading...
  20. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java: Loading...
This diff has been split across 4 pages: 1 2 3 4 >
trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
Revision 1146895 New Change
[20] 119 lines
[+20]
120
import org.apache.hadoop.hive.ql.udf.UDFUnixTimeStamp;
120
import org.apache.hadoop.hive.ql.udf.UDFUnixTimeStamp;
121
import org.apache.hadoop.hive.ql.udf.UDFUpper;
121
import org.apache.hadoop.hive.ql.udf.UDFUpper;
122
import org.apache.hadoop.hive.ql.udf.UDFWeekOfYear;
122
import org.apache.hadoop.hive.ql.udf.UDFWeekOfYear;
123
import org.apache.hadoop.hive.ql.udf.UDFYear;
123
import org.apache.hadoop.hive.ql.udf.UDFYear;
124
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage;
124
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage;
125
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEWAHBitmap;

   
126
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFBridge;
125
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFBridge;
127
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCollectSet;
126
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCollectSet;
128
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFContextNGrams;
127
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFContextNGrams;
129
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCorrelation;
128
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCorrelation;
130
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCount;
129
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCount;
131
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCovariance;
130
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCovariance;
132
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCovarianceSample;
131
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCovarianceSample;

    
   
132
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEWAHBitmap;
133
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
133
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator;
134
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFHistogramNumeric;
134
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFHistogramNumeric;
135
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFMax;
135
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFMax;
136
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFMin;
136
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFMin;
137
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFParameterInfo;
137
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFParameterInfo;
[+20] [20] 7 lines
[+20]
145
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFVarianceSample;
145
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFVarianceSample;
146
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFnGrams;
146
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFnGrams;
147
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
147
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
148
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFArray;
148
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFArray;
149
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFArrayContains;
149
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFArrayContains;
150
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapAnd;
Moved to 154

   
151
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapOr;
Moved to 155

   
152
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapEmpty;

   
153
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge;
150
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge;
154
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCase;
151
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCase;
155
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCoalesce;
152
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFCoalesce;
156
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFConcatWS;
153
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFConcatWS;
Moved from 150

    
   
154
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapAnd;
Moved from 151

    
   
155
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapEmpty;

    
   
156
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFEWAHBitmapOr;
157
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFElt;
157
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFElt;
158
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFField;
158
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFField;
159
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFHash;
159
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFHash;
160
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIf;
160
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIf;
161
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn;
161
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn;
[+20] [20] 16 lines
[+20]
178
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSentences;
178
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSentences;
179
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSize;
179
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSize;
180
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSplit;
180
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFSplit;
181
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFStringToMap;
181
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFStringToMap;
182
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFStruct;
182
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFStruct;

    
   
183
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFTimestamp;
183
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFUnion;
184
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFUnion;
184
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFWhen;
185
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFWhen;
185
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
186
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
186
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTFExplode;
187
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTFExplode;
187
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple;
188
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple;
[+20] [20] 177 lines
[+20]
365
    registerUDF(Constants.DOUBLE_TYPE_NAME, UDFToDouble.class, false,
366
    registerUDF(Constants.DOUBLE_TYPE_NAME, UDFToDouble.class, false,
366
        UDFToDouble.class.getSimpleName());
367
        UDFToDouble.class.getSimpleName());
367
    registerUDF(Constants.STRING_TYPE_NAME, UDFToString.class, false,
368
    registerUDF(Constants.STRING_TYPE_NAME, UDFToString.class, false,
368
        UDFToString.class.getSimpleName());
369
        UDFToString.class.getSimpleName());
369

    
   
370

   

    
   
371
    registerGenericUDF(Constants.TIMESTAMP_TYPE_NAME,

    
   
372
        GenericUDFTimestamp.class);

    
   
373

   
370
    // Aggregate functions
374
    // Aggregate functions
371
    registerGenericUDAF("max", new GenericUDAFMax());
375
    registerGenericUDAF("max", new GenericUDAFMax());
372
    registerGenericUDAF("min", new GenericUDAFMin());
376
    registerGenericUDAF("min", new GenericUDAFMin());
373

    
   
377

   
374
    registerGenericUDAF("sum", new GenericUDAFSum());
378
    registerGenericUDAF("sum", new GenericUDAFSum());
[+20] [20] 207 lines
[+20] [+] static void registerNumericType(String typeName, int level) {
582
    registerNumericType(Constants.INT_TYPE_NAME, 3);
586
    registerNumericType(Constants.INT_TYPE_NAME, 3);
583
    registerNumericType(Constants.BIGINT_TYPE_NAME, 4);
587
    registerNumericType(Constants.BIGINT_TYPE_NAME, 4);
584
    registerNumericType(Constants.FLOAT_TYPE_NAME, 5);
588
    registerNumericType(Constants.FLOAT_TYPE_NAME, 5);
585
    registerNumericType(Constants.DOUBLE_TYPE_NAME, 6);
589
    registerNumericType(Constants.DOUBLE_TYPE_NAME, 6);
586
    registerNumericType(Constants.STRING_TYPE_NAME, 7);
590
    registerNumericType(Constants.STRING_TYPE_NAME, 7);

    
   
591
    registerNumericType(Constants.TIMESTAMP_TYPE_NAME, 8);
587
  }
592
  }
588

    
   
593

   
589
  /**
594
  /**
590
   * Find a common class that objects of both TypeInfo a and TypeInfo b can
595
   * Find a common class that objects of both TypeInfo a and TypeInfo b can
591
   * convert to. This is used for comparing objects of type a and type b.
596
   * convert to. This is used for comparing objects of type a and type b.
[+20] [20] 510 lines
trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDate.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateAdd.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateDiff.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateSub.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToBoolean.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToByte.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToDouble.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToFloat.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java
Revision 1146895 New Change
 
trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java
Revision 1146895 New Change
 
  1. trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java: Loading...
  2. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java: Loading...
  3. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java: Loading...
  4. trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java: Loading...
  5. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDate.java: Loading...
  6. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateAdd.java: Loading...
  7. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateDiff.java: Loading...
  8. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateSub.java: Loading...
  9. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java: Loading...
  10. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java: Loading...
  11. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java: Loading...
  12. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java: Loading...
  13. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java: Loading...
  14. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToBoolean.java: Loading...
  15. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToByte.java: Loading...
  16. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToDouble.java: Loading...
  17. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToFloat.java: Loading...
  18. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToInteger.java: Loading...
  19. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToLong.java: Loading...
  20. trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToShort.java: Loading...
This diff has been split across 4 pages: 1 2 3 4 >