Review Board 1.7.22


ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringExpr.java
New File

    
   
1
/**

    
   
2
 * Licensed to the Apache Software Foundation (ASF) under one

    
   
3
 * or more contributor license agreements.  See the NOTICE file

    
   
4
 * distributed with this work for additional information

    
   
5
 * regarding copyright ownership.  The ASF licenses this file

    
   
6
 * to you under the Apache License, Version 2.0 (the

    
   
7
 * "License"); you may not use this file except in compliance

    
   
8
 * with the License.  You may obtain a copy of the License at

    
   
9
 *

    
   
10
 *     http://www.apache.org/licenses/LICENSE-2.0

    
   
11
 *

    
   
12
 * Unless required by applicable law or agreed to in writing, software

    
   
13
 * distributed under the License is distributed on an "AS IS" BASIS,

    
   
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

    
   
15
 * See the License for the specific language governing permissions and

    
   
16
 * limitations under the License.

    
   
17
 */

    
   
18

   

    
   
19
package org.apache.hadoop.hive.ql.exec.vector.expressions;

    
   
20

   

    
   
21
/** 

    
   
22
 * String expression evaluation helper functions

    
   
23
 */

    
   
24
public class StringExpr {

    
   
25
  

    
   
26
  /* Compare two strings from two byte arrays each 

    
   
27
   * with their own start position and length. 

    
   
28
   * Use lexicographic unsigned byte value order. 

    
   
29
   * This is what's used for UTF-8 sort order.

    
   
30
   * Return negative value if arg1 < arg2, 0 if arg1 = arg2, 

    
   
31
   * positive if arg1 > arg2.

    
   
32
   */

    
   
33
  public static int compare(byte[] arg1, int start1, int len1, byte[] arg2, int start2, int len2) {

    
   
34
    for (int i = 0; i < len1 && i < len2; i++) {

    
   
35
      int b1 = arg1[i + start1] & 0xff; 

    
   
36
      int b2 = arg2[i + start2] & 0xff;

    
   
37
      if (b1 != b2) {

    
   
38
        return b1 - b2;

    
   
39
      }

    
   
40
    }

    
   
41
    return len1 - len2;

    
   
42
  }

    
   
43
}
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringLength.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringLower.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringUnaryUDF.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringUpper.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/templates/CodeGen.class
Revision 8f84a5f New Change
 
ql/src/java/org/apache/hadoop/hive/ql/udf/IUDFUnaryString.java
New File
 
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLower.java
Revision f79cbdf New Change
 
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java
Revision 7dc682b New Change
 
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorStringExpressions.java
New File
 
  1. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringExpr.java: Loading...
  2. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringLength.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringLower.java: Loading...
  4. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringUnaryUDF.java: Loading...
  5. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringUpper.java: Loading...
  6. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/templates/CodeGen.class: Loading...
  7. ql/src/java/org/apache/hadoop/hive/ql/udf/IUDFUnaryString.java: Loading...
  8. ql/src/java/org/apache/hadoop/hive/ql/udf/UDFLower.java: Loading...
  9. ql/src/java/org/apache/hadoop/hive/ql/udf/UDFUpper.java: Loading...
  10. ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorStringExpressions.java: Loading...