Review Board 1.7.22


HIVE-5895 vectorization handles division by zero differently from normal execution

Review Request #15869 - Created Nov. 27, 2013 and updated

Sergey Shelukhin
Reviewers
hive
hive-git
HIVE-5895 vectorization handles division by zero differently from normal execution

 
ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java
Revision 5dc50d6 New Change
[20] 40 lines
[+20] [+] public class GenVectorCode extends Task {
41
      {"ColumnArithmeticScalar", "Modulo", "long", "long", "%"},
41
      {"ColumnArithmeticScalar", "Modulo", "long", "long", "%"},
42

    
   
42

   
43
      {"ColumnArithmeticScalar", "Add", "long", "double", "+"},
43
      {"ColumnArithmeticScalar", "Add", "long", "double", "+"},
44
      {"ColumnArithmeticScalar", "Subtract", "long", "double", "-"},
44
      {"ColumnArithmeticScalar", "Subtract", "long", "double", "-"},
45
      {"ColumnArithmeticScalar", "Multiply", "long", "double", "*"},
45
      {"ColumnArithmeticScalar", "Multiply", "long", "double", "*"},
46
      {"ColumnArithmeticScalar", "Divide", "long", "double", "/"},

   
47
      {"ColumnArithmeticScalar", "Modulo", "long", "double", "%"},
46
      {"ColumnArithmeticScalar", "Modulo", "long", "double", "%"},
48

    
   
47

   
49
      {"ColumnArithmeticScalar", "Add", "double", "long", "+"},
48
      {"ColumnArithmeticScalar", "Add", "double", "long", "+"},
50
      {"ColumnArithmeticScalar", "Subtract", "double", "long", "-"},
49
      {"ColumnArithmeticScalar", "Subtract", "double", "long", "-"},
51
      {"ColumnArithmeticScalar", "Multiply", "double", "long", "*"},
50
      {"ColumnArithmeticScalar", "Multiply", "double", "long", "*"},
52
      {"ColumnArithmeticScalar", "Divide", "double", "long", "/"},

   
53
      {"ColumnArithmeticScalar", "Modulo", "double", "long", "%"},
51
      {"ColumnArithmeticScalar", "Modulo", "double", "long", "%"},
54

    
   
52

   
55
      {"ColumnArithmeticScalar", "Add", "double", "double", "+"},
53
      {"ColumnArithmeticScalar", "Add", "double", "double", "+"},
56
      {"ColumnArithmeticScalar", "Subtract", "double", "double", "-"},
54
      {"ColumnArithmeticScalar", "Subtract", "double", "double", "-"},
57
      {"ColumnArithmeticScalar", "Multiply", "double", "double", "*"},
55
      {"ColumnArithmeticScalar", "Multiply", "double", "double", "*"},
58
      {"ColumnArithmeticScalar", "Divide", "double", "double", "/"},

   
59
      {"ColumnArithmeticScalar", "Modulo", "double", "double", "%"},
56
      {"ColumnArithmeticScalar", "Modulo", "double", "double", "%"},
60

    
   
57

   
61
      {"ScalarArithmeticColumn", "Add", "long", "long", "+"},
58
      {"ScalarArithmeticColumn", "Add", "long", "long", "+"},
62
      {"ScalarArithmeticColumn", "Subtract", "long", "long", "-"},
59
      {"ScalarArithmeticColumn", "Subtract", "long", "long", "-"},
63
      {"ScalarArithmeticColumn", "Multiply", "long", "long", "*"},
60
      {"ScalarArithmeticColumn", "Multiply", "long", "long", "*"},
64
      {"ScalarArithmeticColumn", "Modulo", "long", "long", "%"},
61
      {"ScalarArithmeticColumn", "Modulo", "long", "long", "%"},
65

    
   
62

   
66
      {"ScalarArithmeticColumn", "Add", "long", "double", "+"},
63
      {"ScalarArithmeticColumn", "Add", "long", "double", "+"},
67
      {"ScalarArithmeticColumn", "Subtract", "long", "double", "-"},
64
      {"ScalarArithmeticColumn", "Subtract", "long", "double", "-"},
68
      {"ScalarArithmeticColumn", "Multiply", "long", "double", "*"},
65
      {"ScalarArithmeticColumn", "Multiply", "long", "double", "*"},
69
      {"ScalarArithmeticColumn", "Divide", "long", "double", "/"},

   
70
      {"ScalarArithmeticColumn", "Modulo", "long", "double", "%"},
66
      {"ScalarArithmeticColumn", "Modulo", "long", "double", "%"},
71

    
   
67

   
72
      {"ScalarArithmeticColumn", "Add", "double", "long", "+"},
68
      {"ScalarArithmeticColumn", "Add", "double", "long", "+"},
73
      {"ScalarArithmeticColumn", "Subtract", "double", "long", "-"},
69
      {"ScalarArithmeticColumn", "Subtract", "double", "long", "-"},
74
      {"ScalarArithmeticColumn", "Multiply", "double", "long", "*"},
70
      {"ScalarArithmeticColumn", "Multiply", "double", "long", "*"},
75
      {"ScalarArithmeticColumn", "Divide", "double", "long", "/"},

   
76
      {"ScalarArithmeticColumn", "Modulo", "double", "long", "%"},
71
      {"ScalarArithmeticColumn", "Modulo", "double", "long", "%"},
77

    
   
72

   
78
      {"ScalarArithmeticColumn", "Add", "double", "double", "+"},
73
      {"ScalarArithmeticColumn", "Add", "double", "double", "+"},
79
      {"ScalarArithmeticColumn", "Subtract", "double", "double", "-"},
74
      {"ScalarArithmeticColumn", "Subtract", "double", "double", "-"},
80
      {"ScalarArithmeticColumn", "Multiply", "double", "double", "*"},
75
      {"ScalarArithmeticColumn", "Multiply", "double", "double", "*"},
81
      {"ScalarArithmeticColumn", "Divide", "double", "double", "/"},

   
82
      {"ScalarArithmeticColumn", "Modulo", "double", "double", "%"},
76
      {"ScalarArithmeticColumn", "Modulo", "double", "double", "%"},
83

    
   
77

   
84
      {"ColumnArithmeticColumn", "Add", "long", "long", "+"},
78
      {"ColumnArithmeticColumn", "Add", "long", "long", "+"},
85
      {"ColumnArithmeticColumn", "Subtract", "long", "long", "-"},
79
      {"ColumnArithmeticColumn", "Subtract", "long", "long", "-"},
86
      {"ColumnArithmeticColumn", "Multiply", "long", "long", "*"},
80
      {"ColumnArithmeticColumn", "Multiply", "long", "long", "*"},
87
      {"ColumnArithmeticColumn", "Modulo", "long", "long", "%"},
81
      {"ColumnArithmeticColumn", "Modulo", "long", "long", "%"},
88

    
   
82

   
89
      {"ColumnArithmeticColumn", "Add", "long", "double", "+"},
83
      {"ColumnArithmeticColumn", "Add", "long", "double", "+"},
90
      {"ColumnArithmeticColumn", "Subtract", "long", "double", "-"},
84
      {"ColumnArithmeticColumn", "Subtract", "long", "double", "-"},
91
      {"ColumnArithmeticColumn", "Multiply", "long", "double", "*"},
85
      {"ColumnArithmeticColumn", "Multiply", "long", "double", "*"},
92
      {"ColumnArithmeticColumn", "Divide", "long", "double", "/"},

   
93
      {"ColumnArithmeticColumn", "Modulo", "long", "double", "%"},
86
      {"ColumnArithmeticColumn", "Modulo", "long", "double", "%"},
94

    
   
87

   
95
      {"ColumnArithmeticColumn", "Add", "double", "long", "+"},
88
      {"ColumnArithmeticColumn", "Add", "double", "long", "+"},
96
      {"ColumnArithmeticColumn", "Subtract", "double", "long", "-"},
89
      {"ColumnArithmeticColumn", "Subtract", "double", "long", "-"},
97
      {"ColumnArithmeticColumn", "Multiply", "double", "long", "*"},
90
      {"ColumnArithmeticColumn", "Multiply", "double", "long", "*"},
98
      {"ColumnArithmeticColumn", "Divide", "double", "long", "/"},

   
99
      {"ColumnArithmeticColumn", "Modulo", "double", "long", "%"},
91
      {"ColumnArithmeticColumn", "Modulo", "double", "long", "%"},
100

    
   
92

   
101
      {"ColumnArithmeticColumn", "Add", "double", "double", "+"},
93
      {"ColumnArithmeticColumn", "Add", "double", "double", "+"},
102
      {"ColumnArithmeticColumn", "Subtract", "double", "double", "-"},
94
      {"ColumnArithmeticColumn", "Subtract", "double", "double", "-"},
103
      {"ColumnArithmeticColumn", "Multiply", "double", "double", "*"},
95
      {"ColumnArithmeticColumn", "Multiply", "double", "double", "*"},
104
      {"ColumnArithmeticColumn", "Divide", "double", "double", "/"},

   
105
      {"ColumnArithmeticColumn", "Modulo", "double", "double", "%"},
96
      {"ColumnArithmeticColumn", "Modulo", "double", "double", "%"},
106

    
   
97

   

    
   
98
      {"ColumnDivideScalar", "Divide", "long", "double", "/"},

    
   
99
      {"ColumnDivideScalar", "Divide", "double", "long", "/"},

    
   
100
      {"ColumnDivideScalar", "Divide", "double", "double", "/"},

    
   
101
      {"ScalarDivideColumn", "Divide", "long", "double", "/"},

    
   
102
      {"ScalarDivideColumn", "Divide", "double", "long", "/"},

    
   
103
      {"ScalarDivideColumn", "Divide", "double", "double", "/"},

    
   
104
      {"ColumnDivideColumn", "Divide", "long", "double", "/"},

    
   
105
      {"ColumnDivideColumn", "Divide", "double", "long", "/"},

    
   
106
      {"ColumnDivideColumn", "Divide", "double", "double", "/"},

    
   
107

   
107
      {"ColumnCompareScalar", "Equal", "long", "double", "=="},
108
      {"ColumnCompareScalar", "Equal", "long", "double", "=="},
108
      {"ColumnCompareScalar", "Equal", "double", "double", "=="},
109
      {"ColumnCompareScalar", "Equal", "double", "double", "=="},
109
      {"ColumnCompareScalar", "NotEqual", "long", "double", "!="},
110
      {"ColumnCompareScalar", "NotEqual", "long", "double", "!="},
110
      {"ColumnCompareScalar", "NotEqual", "double", "double", "!="},
111
      {"ColumnCompareScalar", "NotEqual", "double", "double", "!="},
111
      {"ColumnCompareScalar", "Less", "long", "double", "<"},
112
      {"ColumnCompareScalar", "Less", "long", "double", "<"},
[+20] [20] 404 lines
[+20] [+] public void execute() throws BuildException {
516
  }
517
  }
517

    
   
518

   
518
  private void generate() throws Exception {
519
  private void generate() throws Exception {
519
    System.out.println("Generating vector expression code");
520
    System.out.println("Generating vector expression code");
520
    for (String [] tdesc : templateExpansions) {
521
    for (String [] tdesc : templateExpansions) {
521
      if (tdesc[0].equals("ColumnArithmeticScalar")) {
522
      if (tdesc[0].equals("ColumnArithmeticScalar") || tdesc[0].equals("ColumnDivideScalar")) {
522
        generateColumnArithmeticScalar(tdesc);
523
        generateColumnArithmeticScalar(tdesc);
523
      } else if (tdesc[0].equals("ColumnCompareScalar")) {
524
      } else if (tdesc[0].equals("ColumnCompareScalar")) {
524
        generateColumnCompareScalar(tdesc);
525
        generateColumnCompareScalar(tdesc);
525
      } else if (tdesc[0].equals("ScalarCompareColumn")) {
526
      } else if (tdesc[0].equals("ScalarCompareColumn")) {
526
        generateScalarCompareColumn(tdesc);
527
        generateScalarCompareColumn(tdesc);
527
      } else if (tdesc[0].equals("FilterColumnCompareScalar")) {
528
      } else if (tdesc[0].equals("FilterColumnCompareScalar")) {
528
        generateFilterColumnCompareScalar(tdesc);
529
        generateFilterColumnCompareScalar(tdesc);
529
      } else if (tdesc[0].equals("FilterScalarCompareColumn")) {
530
      } else if (tdesc[0].equals("FilterScalarCompareColumn")) {
530
        generateFilterScalarCompareColumn(tdesc);
531
        generateFilterScalarCompareColumn(tdesc);
531
      } else if (tdesc[0].equals("FilterColumnBetween")) {
532
      } else if (tdesc[0].equals("FilterColumnBetween")) {
532
        generateFilterColumnBetween(tdesc);
533
        generateFilterColumnBetween(tdesc);
533
      } else if (tdesc[0].equals("ScalarArithmeticColumn")) {
534
      } else if (tdesc[0].equals("ScalarArithmeticColumn") || tdesc[0].equals("ScalarDivideColumn")) {
534
        generateScalarArithmeticColumn(tdesc);
535
        generateScalarArithmeticColumn(tdesc);
535
      } else if (tdesc[0].equals("FilterColumnCompareColumn")) {
536
      } else if (tdesc[0].equals("FilterColumnCompareColumn")) {
536
        generateFilterColumnCompareColumn(tdesc);
537
        generateFilterColumnCompareColumn(tdesc);
537
      } else if (tdesc[0].equals("ColumnCompareColumn")) {
538
      } else if (tdesc[0].equals("ColumnCompareColumn")) {
538
        generateColumnCompareColumn(tdesc);
539
        generateColumnCompareColumn(tdesc);
539
      } else if (tdesc[0].equals("ColumnArithmeticColumn")) {
540
      } else if (tdesc[0].equals("ColumnArithmeticColumn") || tdesc[0].equals("ColumnDivideColumn")) {
540
        generateColumnArithmeticColumn(tdesc);
541
        generateColumnArithmeticColumn(tdesc);
541
      } else if (tdesc[0].equals("ColumnUnaryMinus")) {
542
      } else if (tdesc[0].equals("ColumnUnaryMinus")) {
542
        generateColumnUnaryMinus(tdesc);
543
        generateColumnUnaryMinus(tdesc);
543
      } else if (tdesc[0].equals("ColumnUnaryFunc")) {
544
      } else if (tdesc[0].equals("ColumnUnaryFunc")) {
544
        generateColumnUnaryFunc(tdesc);
545
        generateColumnUnaryFunc(tdesc);
[+20] [20] 565 lines
ql/src/gen/vectorization/ExpressionTemplates/ColumnDivideColumn.txt
New File
 
ql/src/gen/vectorization/ExpressionTemplates/ColumnDivideScalar.txt
New File
 
ql/src/gen/vectorization/ExpressionTemplates/ScalarDivideColumn.txt
New File
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongColDivideLongColumn.java
Revision 482df3c New Change
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongColDivideLongScalar.java
Revision 7d517ca New Change
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongScalarDivideLongColumn.java
Revision e1ecefa New Change
 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/NullUtil.java
Revision e1867a2 New Change
 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
Revision 1b79401 New Change
 
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorArithmeticExpressions.java
Revision 9de8461 New Change
 
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorScalarColArithmetic.java
Revision fa4da40 New Change
 
ql/src/test/queries/clientpositive/vectorization_div0.q
New File
 
ql/src/test/results/clientpositive/vectorization_div0.q.out
New File
 
ql/src/test/results/clientpositive/vectorization_short_regress.q.out
Revision 18ff938 New Change
 
  1. ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java: Loading...
  2. ql/src/gen/vectorization/ExpressionTemplates/ColumnDivideColumn.txt: Loading...
  3. ql/src/gen/vectorization/ExpressionTemplates/ColumnDivideScalar.txt: Loading...
  4. ql/src/gen/vectorization/ExpressionTemplates/ScalarDivideColumn.txt: Loading...
  5. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongColDivideLongColumn.java: Loading...
  6. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongColDivideLongScalar.java: Loading...
  7. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/LongScalarDivideLongColumn.java: Loading...
  8. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/NullUtil.java: Loading...
  9. ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java: Loading...
  10. ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorArithmeticExpressions.java: Loading...
  11. ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorScalarColArithmetic.java: Loading...
  12. ql/src/test/queries/clientpositive/vectorization_div0.q: Loading...
  13. ql/src/test/results/clientpositive/vectorization_div0.q.out: Loading...
  14. ql/src/test/results/clientpositive/vectorization_short_regress.q.out: Loading...