Review Board 1.7.22


HIVE-1734. Implement map_keys() and map_values() UDFs

Review Request #1082 - Created July 12, 2011 and updated

Carl Steinbach
trunk
HIVE-1734
Reviewers
hive
hive-git
This patch adds map_keys(map) and map_values(map) UDFs.

 
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
Revision 16a207e 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;
162
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIndex;
162
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFIndex;
163
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFInstr;
163
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFInstr;
164
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFLocate;
164
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFLocate;
165
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMap;
165
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMap;

    
   
166
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMapKeys;

    
   
167
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFMapValues;
166
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd;
168
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd;
167
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
169
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual;
168
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan;
170
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan;
169
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan;
171
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan;
170
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan;
172
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan;
[+20] [20] 243 lines
[+20]
414
    registerGenericUDF("locate", GenericUDFLocate.class);
416
    registerGenericUDF("locate", GenericUDFLocate.class);
415
    registerGenericUDF("elt", GenericUDFElt.class);
417
    registerGenericUDF("elt", GenericUDFElt.class);
416
    registerGenericUDF("concat_ws", GenericUDFConcatWS.class);
418
    registerGenericUDF("concat_ws", GenericUDFConcatWS.class);
417
    registerGenericUDF("array_contains", GenericUDFArrayContains.class);
419
    registerGenericUDF("array_contains", GenericUDFArrayContains.class);
418
    registerGenericUDF("sentences", GenericUDFSentences.class);
420
    registerGenericUDF("sentences", GenericUDFSentences.class);

    
   
421
    registerGenericUDF("map_keys", GenericUDFMapKeys.class);

    
   
422
    registerGenericUDF("map_values", GenericUDFMapValues.class);
419

    
   
423

   
420
    // Generic UDTF's
424
    // Generic UDTF's
421
    registerGenericUDTF("explode", GenericUDTFExplode.class);
425
    registerGenericUDTF("explode", GenericUDTFExplode.class);
422
    registerGenericUDTF("json_tuple", GenericUDTFJSONTuple.class);
426
    registerGenericUDTF("json_tuple", GenericUDTFJSONTuple.class);
423
    registerGenericUDTF("parse_url_tuple", GenericUDTFParseUrlTuple.class);
427
    registerGenericUDTF("parse_url_tuple", GenericUDTFParseUrlTuple.class);
[+20] [20] 678 lines
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapValues.java
New File
 
ql/src/test/queries/clientnegative/udf_map_keys_arg_num.q
New File
 
ql/src/test/queries/clientnegative/udf_map_keys_arg_type.q
New File
 
ql/src/test/queries/clientnegative/udf_map_values_arg_num.q
New File
 
ql/src/test/queries/clientnegative/udf_map_values_arg_type.q
New File
 
ql/src/test/queries/clientpositive/udf_map_keys.q
New File
 
ql/src/test/queries/clientpositive/udf_map_values.q
New File
 
ql/src/test/results/clientnegative/udf_map_keys_arg_num.q.out
New File
 
ql/src/test/results/clientnegative/udf_map_keys_arg_type.q.out
New File
 
ql/src/test/results/clientnegative/udf_map_values_arg_num.q.out
New File
 
ql/src/test/results/clientnegative/udf_map_values_arg_type.q.out
New File
 
ql/src/test/results/clientpositive/show_functions.q.out
Revision d4f6c98 New Change
 
ql/src/test/results/clientpositive/udf_map_keys.q.out
New File
 
ql/src/test/results/clientpositive/udf_map_values.q.out
New File
 
  1. ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java: Loading...
  2. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapKeys.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFMapValues.java: Loading...
  4. ql/src/test/queries/clientnegative/udf_map_keys_arg_num.q: Loading...
  5. ql/src/test/queries/clientnegative/udf_map_keys_arg_type.q: Loading...
  6. ql/src/test/queries/clientnegative/udf_map_values_arg_num.q: Loading...
  7. ql/src/test/queries/clientnegative/udf_map_values_arg_type.q: Loading...
  8. ql/src/test/queries/clientpositive/udf_map_keys.q: Loading...
  9. ql/src/test/queries/clientpositive/udf_map_values.q: Loading...
  10. ql/src/test/results/clientnegative/udf_map_keys_arg_num.q.out: Loading...
  11. ql/src/test/results/clientnegative/udf_map_keys_arg_type.q.out: Loading...
  12. ql/src/test/results/clientnegative/udf_map_values_arg_num.q.out: Loading...
  13. ql/src/test/results/clientnegative/udf_map_values_arg_type.q.out: Loading...
  14. ql/src/test/results/clientpositive/show_functions.q.out: Loading...
  15. ql/src/test/results/clientpositive/udf_map_keys.q.out: Loading...
  16. ql/src/test/results/clientpositive/udf_map_values.q.out: Loading...