diff --git ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java new file mode 100644 index 0000000..08cdad9 --- /dev/null +++ ant/src/org/apache/hadoop/hive/ant/GenVectorCode.java @@ -0,0 +1,799 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ant; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * This class generates java classes from the templates. + */ +public class GenVectorCode extends Task { + + private static String [][] templateExpansions = + { + {"ColumnArithmeticScalar", "Add", "long", "long", "+"}, + {"ColumnArithmeticScalar", "Subtract", "long", "long", "-"}, + {"ColumnArithmeticScalar", "Multiply", "long", "long", "*"}, + {"ColumnArithmeticScalar", "Modulo", "long", "long", "%"}, + + {"ColumnArithmeticScalar", "Add", "long", "double", "+"}, + {"ColumnArithmeticScalar", "Subtract", "long", "double", "-"}, + {"ColumnArithmeticScalar", "Multiply", "long", "double", "*"}, + {"ColumnArithmeticScalar", "Divide", "long", "double", "/"}, + {"ColumnArithmeticScalar", "Modulo", "long", "double", "%"}, + + {"ColumnArithmeticScalar", "Add", "double", "long", "+"}, + {"ColumnArithmeticScalar", "Subtract", "double", "long", "-"}, + {"ColumnArithmeticScalar", "Multiply", "double", "long", "*"}, + {"ColumnArithmeticScalar", "Divide", "double", "long", "/"}, + {"ColumnArithmeticScalar", "Modulo", "double", "long", "%"}, + + {"ColumnArithmeticScalar", "Add", "double", "double", "+"}, + {"ColumnArithmeticScalar", "Subtract", "double", "double", "-"}, + {"ColumnArithmeticScalar", "Multiply", "double", "double", "*"}, + {"ColumnArithmeticScalar", "Divide", "double", "double", "/"}, + {"ColumnArithmeticScalar", "Modulo", "double", "double", "%"}, + + {"ScalarArithmeticColumn", "Add", "long", "long", "+"}, + {"ScalarArithmeticColumn", "Subtract", "long", "long", "-"}, + {"ScalarArithmeticColumn", "Multiply", "long", "long", "*"}, + {"ScalarArithmeticColumn", "Modulo", "long", "long", "%"}, + + {"ScalarArithmeticColumn", "Add", "long", "double", "+"}, + {"ScalarArithmeticColumn", "Subtract", "long", "double", "-"}, + {"ScalarArithmeticColumn", "Multiply", "long", "double", "*"}, + {"ScalarArithmeticColumn", "Divide", "long", "double", "/"}, + {"ScalarArithmeticColumn", "Modulo", "long", "double", "%"}, + + {"ScalarArithmeticColumn", "Add", "double", "long", "+"}, + {"ScalarArithmeticColumn", "Subtract", "double", "long", "-"}, + {"ScalarArithmeticColumn", "Multiply", "double", "long", "*"}, + {"ScalarArithmeticColumn", "Divide", "double", "long", "/"}, + {"ScalarArithmeticColumn", "Modulo", "double", "long", "%"}, + + {"ScalarArithmeticColumn", "Add", "double", "double", "+"}, + {"ScalarArithmeticColumn", "Subtract", "double", "double", "-"}, + {"ScalarArithmeticColumn", "Multiply", "double", "double", "*"}, + {"ScalarArithmeticColumn", "Divide", "double", "double", "/"}, + {"ScalarArithmeticColumn", "Modulo", "double", "double", "%"}, + + {"ColumnArithmeticColumn", "Add", "long", "long", "+"}, + {"ColumnArithmeticColumn", "Subtract", "long", "long", "-"}, + {"ColumnArithmeticColumn", "Multiply", "long", "long", "*"}, + {"ColumnArithmeticColumn", "Modulo", "long", "long", "%"}, + + {"ColumnArithmeticColumn", "Add", "long", "double", "+"}, + {"ColumnArithmeticColumn", "Subtract", "long", "double", "-"}, + {"ColumnArithmeticColumn", "Multiply", "long", "double", "*"}, + {"ColumnArithmeticColumn", "Divide", "long", "double", "/"}, + {"ColumnArithmeticColumn", "Modulo", "long", "double", "%"}, + + {"ColumnArithmeticColumn", "Add", "double", "long", "+"}, + {"ColumnArithmeticColumn", "Subtract", "double", "long", "-"}, + {"ColumnArithmeticColumn", "Multiply", "double", "long", "*"}, + {"ColumnArithmeticColumn", "Divide", "double", "long", "/"}, + {"ColumnArithmeticColumn", "Modulo", "double", "long", "%"}, + + {"ColumnArithmeticColumn", "Add", "double", "double", "+"}, + {"ColumnArithmeticColumn", "Subtract", "double", "double", "-"}, + {"ColumnArithmeticColumn", "Multiply", "double", "double", "*"}, + {"ColumnArithmeticColumn", "Divide", "double", "double", "/"}, + {"ColumnArithmeticColumn", "Modulo", "double", "double", "%"}, + + {"ColumnCompareScalar", "Equal", "long", "double", "=="}, + {"ColumnCompareScalar", "Equal", "double", "double", "=="}, + {"ColumnCompareScalar", "NotEqual", "long", "double", "!="}, + {"ColumnCompareScalar", "NotEqual", "double", "double", "!="}, + {"ColumnCompareScalar", "Less", "long", "double", "<"}, + {"ColumnCompareScalar", "Less", "double", "double", "<"}, + {"ColumnCompareScalar", "LessEqual", "long", "double", "<="}, + {"ColumnCompareScalar", "LessEqual", "double", "double", "<="}, + {"ColumnCompareScalar", "Greater", "long", "double", ">"}, + {"ColumnCompareScalar", "Greater", "double", "double", ">"}, + {"ColumnCompareScalar", "GreaterEqual", "long", "double", ">="}, + {"ColumnCompareScalar", "GreaterEqual", "double", "double", ">="}, + + {"FilterColumnCompareScalar", "Equal", "long", "double", "=="}, + {"FilterColumnCompareScalar", "Equal", "double", "double", "=="}, + {"FilterColumnCompareScalar", "NotEqual", "long", "double", "!="}, + {"FilterColumnCompareScalar", "NotEqual", "double", "double", "!="}, + {"FilterColumnCompareScalar", "Less", "long", "double", "<"}, + {"FilterColumnCompareScalar", "Less", "double", "double", "<"}, + {"FilterColumnCompareScalar", "LessEqual", "long", "double", "<="}, + {"FilterColumnCompareScalar", "LessEqual", "double", "double", "<="}, + {"FilterColumnCompareScalar", "Greater", "long", "double", ">"}, + {"FilterColumnCompareScalar", "Greater", "double", "double", ">"}, + {"FilterColumnCompareScalar", "GreaterEqual", "long", "double", ">="}, + {"FilterColumnCompareScalar", "GreaterEqual", "double", "double", ">="}, + + {"FilterColumnCompareScalar", "Equal", "long", "long", "=="}, + {"FilterColumnCompareScalar", "Equal", "double", "long", "=="}, + {"FilterColumnCompareScalar", "NotEqual", "long", "long", "!="}, + {"FilterColumnCompareScalar", "NotEqual", "double", "long", "!="}, + {"FilterColumnCompareScalar", "Less", "long", "long", "<"}, + {"FilterColumnCompareScalar", "Less", "double", "long", "<"}, + {"FilterColumnCompareScalar", "LessEqual", "long", "long", "<="}, + {"FilterColumnCompareScalar", "LessEqual", "double", "long", "<="}, + {"FilterColumnCompareScalar", "Greater", "long", "long", ">"}, + {"FilterColumnCompareScalar", "Greater", "double", "long", ">"}, + {"FilterColumnCompareScalar", "GreaterEqual", "long", "long", ">="}, + {"FilterColumnCompareScalar", "GreaterEqual", "double", "long", ">="}, + + {"FilterScalarCompareColumn", "Equal", "long", "double", "=="}, + {"FilterScalarCompareColumn", "Equal", "double", "double", "=="}, + {"FilterScalarCompareColumn", "NotEqual", "long", "double", "!="}, + {"FilterScalarCompareColumn", "NotEqual", "double", "double", "!="}, + {"FilterScalarCompareColumn", "Less", "long", "double", "<"}, + {"FilterScalarCompareColumn", "Less", "double", "double", "<"}, + {"FilterScalarCompareColumn", "LessEqual", "long", "double", "<="}, + {"FilterScalarCompareColumn", "LessEqual", "double", "double", "<="}, + {"FilterScalarCompareColumn", "Greater", "long", "double", ">"}, + {"FilterScalarCompareColumn", "Greater", "double", "double", ">"}, + {"FilterScalarCompareColumn", "GreaterEqual", "long", "double", ">="}, + {"FilterScalarCompareColumn", "GreaterEqual", "double", "double", ">="}, + + {"FilterScalarCompareColumn", "Equal", "long", "long", "=="}, + {"FilterScalarCompareColumn", "Equal", "double", "long", "=="}, + {"FilterScalarCompareColumn", "NotEqual", "long", "long", "!="}, + {"FilterScalarCompareColumn", "NotEqual", "double", "long", "!="}, + {"FilterScalarCompareColumn", "Less", "long", "long", "<"}, + {"FilterScalarCompareColumn", "Less", "double", "long", "<"}, + {"FilterScalarCompareColumn", "LessEqual", "long", "long", "<="}, + {"FilterScalarCompareColumn", "LessEqual", "double", "long", "<="}, + {"FilterScalarCompareColumn", "Greater", "long", "long", ">"}, + {"FilterScalarCompareColumn", "Greater", "double", "long", ">"}, + {"FilterScalarCompareColumn", "GreaterEqual", "long", "long", ">="}, + {"FilterScalarCompareColumn", "GreaterEqual", "double", "long", ">="}, + + {"FilterStringColumnCompareScalar", "Equal", "=="}, + {"FilterStringColumnCompareScalar", "NotEqual", "!="}, + {"FilterStringColumnCompareScalar", "Less", "<"}, + {"FilterStringColumnCompareScalar", "LessEqual", "<="}, + {"FilterStringColumnCompareScalar", "Greater", ">"}, + {"FilterStringColumnCompareScalar", "GreaterEqual", ">="}, + + {"FilterStringScalarCompareColumn", "Equal", "=="}, + {"FilterStringScalarCompareColumn", "NotEqual", "!="}, + {"FilterStringScalarCompareColumn", "Less", "<"}, + {"FilterStringScalarCompareColumn", "LessEqual", "<="}, + {"FilterStringScalarCompareColumn", "Greater", ">"}, + {"FilterStringScalarCompareColumn", "GreaterEqual", ">="}, + + {"FilterStringColumnCompareColumn", "Equal", "=="}, + {"FilterStringColumnCompareColumn", "NotEqual", "!="}, + {"FilterStringColumnCompareColumn", "Less", "<"}, + {"FilterStringColumnCompareColumn", "LessEqual", "<="}, + {"FilterStringColumnCompareColumn", "Greater", ">"}, + {"FilterStringColumnCompareColumn", "GreaterEqual", ">="}, + + {"FilterColumnCompareColumn", "Equal", "long", "double", "=="}, + {"FilterColumnCompareColumn", "Equal", "double", "double", "=="}, + {"FilterColumnCompareColumn", "NotEqual", "long", "double", "!="}, + {"FilterColumnCompareColumn", "NotEqual", "double", "double", "!="}, + {"FilterColumnCompareColumn", "Less", "long", "double", "<"}, + {"FilterColumnCompareColumn", "Less", "double", "double", "<"}, + {"FilterColumnCompareColumn", "LessEqual", "long", "double", "<="}, + {"FilterColumnCompareColumn", "LessEqual", "double", "double", "<="}, + {"FilterColumnCompareColumn", "Greater", "long", "double", ">"}, + {"FilterColumnCompareColumn", "Greater", "double", "double", ">"}, + {"FilterColumnCompareColumn", "GreaterEqual", "long", "double", ">="}, + {"FilterColumnCompareColumn", "GreaterEqual", "double", "double", ">="}, + + {"FilterColumnCompareColumn", "Equal", "long", "long", "=="}, + {"FilterColumnCompareColumn", "Equal", "double", "long", "=="}, + {"FilterColumnCompareColumn", "NotEqual", "long", "long", "!="}, + {"FilterColumnCompareColumn", "NotEqual", "double", "long", "!="}, + {"FilterColumnCompareColumn", "Less", "long", "long", "<"}, + {"FilterColumnCompareColumn", "Less", "double", "long", "<"}, + {"FilterColumnCompareColumn", "LessEqual", "long", "long", "<="}, + {"FilterColumnCompareColumn", "LessEqual", "double", "long", "<="}, + {"FilterColumnCompareColumn", "Greater", "long", "long", ">"}, + {"FilterColumnCompareColumn", "Greater", "double", "long", ">"}, + {"FilterColumnCompareColumn", "GreaterEqual", "long", "long", ">="}, + {"FilterColumnCompareColumn", "GreaterEqual", "double", "long", ">="}, + + {"ColumnUnaryMinus", "long"}, + {"ColumnUnaryMinus", "double"}, + + // template, , , , , + {"VectorUDAFMinMax", "VectorUDAFMinLong", "long", "<", "min", + "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: long)"}, + {"VectorUDAFMinMax", "VectorUDAFMinDouble", "double", "<", "min", + "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: double)"}, + {"VectorUDAFMinMax", "VectorUDAFMaxLong", "long", ">", "max", + "_FUNC_(expr) - Returns the maximum value of expr (vectorized, type: long)"}, + {"VectorUDAFMinMax", "VectorUDAFMaxDouble", "double", ">", "max", + "_FUNC_(expr) - Returns the maximum value of expr (vectorized, type: double)"}, + + {"VectorUDAFMinMaxString", "VectorUDAFMinString", "<", "min", + "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: string)"}, + {"VectorUDAFMinMaxString", "VectorUDAFMaxString", ">", "max", + "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: string)"}, + + //template, , + {"VectorUDAFSum", "VectorUDAFSumLong", "long"}, + {"VectorUDAFSum", "VectorUDAFSumDouble", "double"}, + {"VectorUDAFAvg", "VectorUDAFAvgLong", "long"}, + {"VectorUDAFAvg", "VectorUDAFAvgDouble", "double"}, + + // template, , , , , + // + {"VectorUDAFVar", "VectorUDAFVarPopLong", "long", "myagg.variance / myagg.count", + "variance, var_pop", + "_FUNC_(x) - Returns the variance of a set of numbers (vectorized, long)"}, + {"VectorUDAFVar", "VectorUDAFVarPopDouble", "double", "myagg.variance / myagg.count", + "variance, var_pop", + "_FUNC_(x) - Returns the variance of a set of numbers (vectorized, double)"}, + {"VectorUDAFVar", "VectorUDAFVarSampLong", "long", "myagg.variance / (myagg.count-1.0)", + "var_samp", + "_FUNC_(x) - Returns the sample variance of a set of numbers (vectorized, long)"}, + {"VectorUDAFVar", "VectorUDAFVarSampDouble", "double", "myagg.variance / (myagg.count-1.0)", + "var_samp", + "_FUNC_(x) - Returns the sample variance of a set of numbers (vectorized, double)"}, + {"VectorUDAFVar", "VectorUDAFStdPopLong", "long", + "Math.sqrt(myagg.variance / (myagg.count))", "std,stddev,stddev_pop", + "_FUNC_(x) - Returns the standard deviation of a set of numbers (vectorized, long)"}, + {"VectorUDAFVar", "VectorUDAFStdPopDouble", "double", + "Math.sqrt(myagg.variance / (myagg.count))", "std,stddev,stddev_pop", + "_FUNC_(x) - Returns the standard deviation of a set of numbers (vectorized, double)"}, + {"VectorUDAFVar", "VectorUDAFStdSampLong", "long", + "Math.sqrt(myagg.variance / (myagg.count-1.0))", "stddev_samp", + "_FUNC_(x) - Returns the sample standard deviation of a set of numbers (vectorized, long)"}, + {"VectorUDAFVar", "VectorUDAFStdSampDouble", "double", + "Math.sqrt(myagg.variance / (myagg.count-1.0))", "stddev_samp", + "_FUNC_(x) - Returns the sample standard deviation of a set of numbers (vectorized, double)"}, + + }; + + + private String templateBaseDir; + private String buildDir; + + private String expressionOutputDirectory; + private String expressionTemplateDirectory; + private String udafOutputDirectory; + private String udafTemplateDirectory; + private GenVectorTestCode testCodeGen; + + static String joinPath(String...parts) { + String path = parts[0]; + for (int i=1; i < parts.length; ++i) { + path += File.separatorChar + parts[i]; + } + return path; + } + + public void init(String templateBaseDir, String buildDir) { + File generationDirectory = new File(templateBaseDir); + + String buildPath = joinPath(buildDir, "ql", "gen", "vector"); + + File exprOutput = new File(joinPath(buildPath, "org", "apache", "hadoop", + "hive", "ql", "exec", "vector", "expressions", "gen")); + exprOutput.mkdirs(); + expressionOutputDirectory = exprOutput.getAbsolutePath(); + + expressionTemplateDirectory = + joinPath(generationDirectory.getAbsolutePath(), "ExpressionTemplates"); + + File udafOutput = new File(joinPath(buildPath, "org", "apache", "hadoop", + "hive", "ql", "exec", "vector", "expressions", "aggregates", "gen")); + udafOutput.mkdirs(); + udafOutputDirectory = udafOutput.getAbsolutePath(); + + udafTemplateDirectory = + joinPath(generationDirectory.getAbsolutePath(), "udafTemplates"); + + File testCodeOutput = + new File( + joinPath(buildDir, "ql", "test", "src", "org", + "apache", "hadoop", "hive", "ql", "exec", "vector", + "expressions", "gen")); + testCodeOutput.mkdirs(); + testCodeGen = new GenVectorTestCode(testCodeOutput.getAbsolutePath(), + joinPath(generationDirectory.getAbsolutePath(), "TestTemplates")); + } + + /** + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + GenVectorCode gen = new GenVectorCode(); + gen.init(System.getProperty("user.dir"), + joinPath(System.getProperty("user.dir"), "..", "..", "..", "..", "build")); + gen.generate(); + } + + @Override + public void execute() throws BuildException { + init(templateBaseDir, buildDir); + try { + this.generate(); + } catch (Exception e) { + new BuildException(e); + } + } + + private void generate() throws Exception { + + for (String [] tdesc : templateExpansions) { + if (tdesc[0].equals("ColumnArithmeticScalar")) { + generateColumnArithmeticScalar(tdesc); + } else if (tdesc[0].equals("ColumnCompareScalar")) { + generateColumnCompareScalar(tdesc); + } else if (tdesc[0].equals("FilterColumnCompareScalar")) { + generateFilterColumnCompareScalar(tdesc); + } else if (tdesc[0].equals("FilterScalarCompareColumn")) { + generateFilterScalarCompareColumn(tdesc); + } else if (tdesc[0].equals("ScalarArithmeticColumn")) { + generateScalarArithmeticColumn(tdesc); + } else if (tdesc[0].equals("FilterColumnCompareColumn")) { + generateFilterColumnCompareColumn(tdesc); + } else if (tdesc[0].equals("ColumnArithmeticColumn")) { + generateColumnArithmeticColumn(tdesc); + } else if (tdesc[0].equals("ColumnUnaryMinus")) { + generateColumnUnaryMinus(tdesc); + } else if (tdesc[0].equals("VectorUDAFMinMax")) { + generateVectorUDAFMinMax(tdesc); + } else if (tdesc[0].equals("VectorUDAFMinMaxString")) { + generateVectorUDAFMinMaxString(tdesc); + } else if (tdesc[0].equals("VectorUDAFSum")) { + generateVectorUDAFSum(tdesc); + } else if (tdesc[0].equals("VectorUDAFAvg")) { + generateVectorUDAFAvg(tdesc); + } else if (tdesc[0].equals("VectorUDAFVar")) { + generateVectorUDAFVar(tdesc); + } else if (tdesc[0].equals("FilterStringColumnCompareScalar")) { + generateFilterStringColumnCompareScalar(tdesc); + } else if (tdesc[0].equals("FilterStringScalarCompareColumn")) { + generateFilterStringScalarCompareColumn(tdesc); + } else if (tdesc[0].equals("FilterStringColumnCompareColumn")) { + generateFilterStringColumnCompareColumn(tdesc); + } else { + continue; + } + } + testCodeGen.generateTestSuites(); + } + + private void generateVectorUDAFMinMax(String[] tdesc) throws Exception { + String className = tdesc[1]; + String valueType = tdesc[2]; + String operatorSymbol = tdesc[3]; + String descName = tdesc[4]; + String descValue = tdesc[5]; + String columnType = getColumnVectorType(valueType); + String writableType = getOutputWritableType(valueType); + String inspectorType = getOutputObjectInspector(valueType); + + String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); + String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); + + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", valueType); + templateString = templateString.replaceAll("", operatorSymbol); + templateString = templateString.replaceAll("", columnType); + templateString = templateString.replaceAll("", descName); + templateString = templateString.replaceAll("", descValue); + templateString = templateString.replaceAll("", writableType); + templateString = templateString.replaceAll("", inspectorType); + writeFile(outputFile, templateString); + + } + + private void generateVectorUDAFMinMaxString(String[] tdesc) throws Exception { + String className = tdesc[1]; + String operatorSymbol = tdesc[2]; + String descName = tdesc[3]; + String descValue = tdesc[4]; + + String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); + String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); + + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", operatorSymbol); + templateString = templateString.replaceAll("", descName); + templateString = templateString.replaceAll("", descValue); + writeFile(outputFile, templateString); + + } + + private void generateVectorUDAFSum(String[] tdesc) throws Exception { + //template, , , , + String className = tdesc[1]; + String valueType = tdesc[2]; + String columnType = getColumnVectorType(valueType); + String writableType = getOutputWritableType(valueType); + String inspectorType = getOutputObjectInspector(valueType); + + String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); + String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); + + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", valueType); + templateString = templateString.replaceAll("", columnType); + templateString = templateString.replaceAll("", writableType); + templateString = templateString.replaceAll("", inspectorType); + writeFile(outputFile, templateString); + } + + private void generateVectorUDAFAvg(String[] tdesc) throws IOException { + String className = tdesc[1]; + String valueType = tdesc[2]; + String columnType = getColumnVectorType(valueType); + + String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); + String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); + + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", valueType); + templateString = templateString.replaceAll("", columnType); + writeFile(outputFile, templateString); + } + + private void generateVectorUDAFVar(String[] tdesc) throws IOException { + String className = tdesc[1]; + String valueType = tdesc[2]; + String varianceFormula = tdesc[3]; + String descriptionName = tdesc[4]; + String descriptionValue = tdesc[5]; + String columnType = getColumnVectorType(valueType); + + String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); + String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); + + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", valueType); + templateString = templateString.replaceAll("", columnType); + templateString = templateString.replaceAll("", varianceFormula); + templateString = templateString.replaceAll("", descriptionName); + templateString = templateString.replaceAll("", descriptionValue); + writeFile(outputFile, templateString); + } + + private void generateFilterStringScalarCompareColumn(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String className = "FilterStringScalar" + operatorName + "StringColumn"; + + // Template expansion logic is the same for both column-scalar and scalar-column cases. + generateFilterStringColumnCompareScalar(tdesc, className); + } + + private void generateFilterStringColumnCompareScalar(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String className = "FilterStringCol" + operatorName + "StringScalar"; + generateFilterStringColumnCompareScalar(tdesc, className); + } + + private void generateFilterStringColumnCompareColumn(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String className = "FilterStringCol" + operatorName + "StringColumn"; + generateFilterStringColumnCompareScalar(tdesc, className); + } + + private void generateFilterStringColumnCompareScalar(String[] tdesc, String className) + throws IOException { + String operatorSymbol = tdesc[2]; + String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); + // Read the template into a string; + String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); + String templateString = readFile(templateFile); + // Expand, and write result + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", operatorSymbol); + writeFile(outputFile, templateString); + } + + private void generateFilterColumnCompareColumn(String[] tdesc) throws IOException { + //The variables are all same as ColumnCompareScalar except that + //this template doesn't need a return type. Pass anything as return type. + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = "Filter" + getCamelCaseType(operandType1) + + "Col" + operatorName + getCamelCaseType(operandType2) + "Column"; + generateColumnBinaryOperatorColumn(tdesc, null, className); + } + + private void generateColumnUnaryMinus(String[] tdesc) throws IOException { + String operandType = tdesc[1]; + String inputColumnVectorType = this.getColumnVectorType(operandType); + String outputColumnVectorType = inputColumnVectorType; + String returnType = operandType; + String className = getCamelCaseType(operandType) + "ColUnaryMinus"; + String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); + String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); + String templateString = readFile(templateFile); + // Expand, and write result + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", inputColumnVectorType); + templateString = templateString.replaceAll("", outputColumnVectorType); + templateString = templateString.replaceAll("", operandType); + templateString = templateString.replaceAll("", returnType); + writeFile(outputFile, templateString); + } + + private void generateColumnArithmeticColumn(String [] tdesc) throws IOException { + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = getCamelCaseType(operandType1) + + "Col" + operatorName + getCamelCaseType(operandType2) + "Column"; + String returnType = getArithmeticReturnType(operandType1, operandType2); + generateColumnBinaryOperatorColumn(tdesc, returnType, className); + } + + private void generateFilterColumnCompareScalar(String[] tdesc) throws IOException { + //The variables are all same as ColumnCompareScalar except that + //this template doesn't need a return type. Pass anything as return type. + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = "Filter" + getCamelCaseType(operandType1) + + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; + generateColumnBinaryOperatorScalar(tdesc, null, className); + } + + private void generateFilterScalarCompareColumn(String[] tdesc) throws IOException { + //this template doesn't need a return type. Pass anything as return type. + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = "Filter" + getCamelCaseType(operandType1) + + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column"; + generateScalarBinaryOperatorColumn(tdesc, null, className); + } + + private void generateColumnCompareScalar(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String returnType = "long"; + String className = getCamelCaseType(operandType1) + + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; + generateColumnBinaryOperatorScalar(tdesc, returnType, className); + } + + private void generateColumnBinaryOperatorColumn(String[] tdesc, String returnType, + String className) throws IOException { + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String outputColumnVectorType = this.getColumnVectorType(returnType); + String inputColumnVectorType1 = this.getColumnVectorType(operandType1); + String inputColumnVectorType2 = this.getColumnVectorType(operandType2); + String operatorSymbol = tdesc[4]; + String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); + + //Read the template into a string; + String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", inputColumnVectorType1); + templateString = templateString.replaceAll("", inputColumnVectorType2); + templateString = templateString.replaceAll("", outputColumnVectorType); + templateString = templateString.replaceAll("", operatorSymbol); + templateString = templateString.replaceAll("", operandType1); + templateString = templateString.replaceAll("", operandType2); + templateString = templateString.replaceAll("", returnType); + templateString = templateString.replaceAll("", getCamelCaseType(returnType)); + writeFile(outputFile, templateString); + + if(returnType==null){ + testCodeGen.addColumnColumnFilterTestCases( + className, + inputColumnVectorType1, + inputColumnVectorType2, + operatorSymbol); + }else{ + testCodeGen.addColumnColumnOperationTestCases( + className, + inputColumnVectorType1, + inputColumnVectorType2, + outputColumnVectorType); + } + } + + private void generateColumnBinaryOperatorScalar(String[] tdesc, String returnType, + String className) throws IOException { + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String outputColumnVectorType = this.getColumnVectorType(returnType); + String inputColumnVectorType = this.getColumnVectorType(operandType1); + String operatorSymbol = tdesc[4]; + String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); + + //Read the template into a string; + String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", inputColumnVectorType); + templateString = templateString.replaceAll("", outputColumnVectorType); + templateString = templateString.replaceAll("", operatorSymbol); + templateString = templateString.replaceAll("", operandType1); + templateString = templateString.replaceAll("", operandType2); + templateString = templateString.replaceAll("", returnType); + writeFile(outputFile, templateString); + + if(returnType==null) { + testCodeGen.addColumnScalarFilterTestCases( + true, + className, + inputColumnVectorType, + operandType2, + operatorSymbol); + } else { + testCodeGen.addColumnScalarOperationTestCases( + true, + className, + inputColumnVectorType, + outputColumnVectorType, + operandType2); + } + } + + private void generateScalarBinaryOperatorColumn(String[] tdesc, String returnType, + String className) throws IOException { + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String outputColumnVectorType = this.getColumnVectorType(returnType); + String inputColumnVectorType = this.getColumnVectorType(operandType2); + String operatorSymbol = tdesc[4]; + String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); + + //Read the template into a string; + String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); + String templateString = readFile(templateFile); + templateString = templateString.replaceAll("", className); + templateString = templateString.replaceAll("", inputColumnVectorType); + templateString = templateString.replaceAll("", outputColumnVectorType); + templateString = templateString.replaceAll("", operatorSymbol); + templateString = templateString.replaceAll("", operandType1); + templateString = templateString.replaceAll("", operandType2); + templateString = templateString.replaceAll("", returnType); + writeFile(outputFile, templateString); + + if(returnType==null) { + testCodeGen.addColumnScalarFilterTestCases( + false, + className, + inputColumnVectorType, + operandType1, + operatorSymbol); + } else { + testCodeGen.addColumnScalarOperationTestCases( + false, + className, + inputColumnVectorType, + outputColumnVectorType, + operandType1); + } + } + + //Binary arithmetic operator + private void generateColumnArithmeticScalar(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = getCamelCaseType(operandType1) + + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; + String returnType = getArithmeticReturnType(operandType1, operandType2); + generateColumnBinaryOperatorScalar(tdesc, returnType, className); + } + + private void generateScalarArithmeticColumn(String[] tdesc) throws IOException { + String operatorName = tdesc[1]; + String operandType1 = tdesc[2]; + String operandType2 = tdesc[3]; + String className = getCamelCaseType(operandType1) + + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column"; + String returnType = getArithmeticReturnType(operandType1, operandType2); + generateScalarBinaryOperatorColumn(tdesc, returnType, className); + } + + + static void writeFile(String outputFile, String str) throws IOException { + BufferedWriter w = new BufferedWriter(new FileWriter(outputFile)); + w.write(str); + w.close(); + } + + static String readFile(String templateFile) throws IOException { + BufferedReader r = new BufferedReader(new FileReader(templateFile)); + String line = r.readLine(); + StringBuilder b = new StringBuilder(); + while (line != null) { + b.append(line); + b.append("\n"); + line = r.readLine(); + } + r.close(); + return b.toString(); + } + + static String getCamelCaseType(String type) { + if (type == null) { + return null; + } + if (type.equals("long")) { + return "Long"; + } else if (type.equals("double")) { + return "Double"; + } else { + return type; + } + } + + private String getArithmeticReturnType(String operandType1, + String operandType2) { + if (operandType1.equals("double") || + operandType2.equals("double")) { + return "double"; + } else { + return "long"; + } + } + + private String getColumnVectorType(String primitiveType) { + if(primitiveType!=null && primitiveType.equals("double")) { + return "DoubleColumnVector"; + } + return "LongColumnVector"; + } + + private String getOutputWritableType(String primitiveType) throws Exception { + if (primitiveType.equals("long")) { + return "LongWritable"; + } else if (primitiveType.equals("double")) { + return "DoubleWritable"; + } + throw new Exception("Unimplemented primitive output writable: " + primitiveType); + } + + private String getOutputObjectInspector(String primitiveType) throws Exception { + if (primitiveType.equals("long")) { + return "PrimitiveObjectInspectorFactory.writableLongObjectInspector"; + } else if (primitiveType.equals("double")) { + return "PrimitiveObjectInspectorFactory.writableDoubleObjectInspector"; + } + throw new Exception("Unimplemented primitive output inspector: " + primitiveType); + } + + public void setTemplateBaseDir(String templateBaseDir) { + this.templateBaseDir = templateBaseDir; + } + + public void setBuildDir(String buildDir) { + this.buildDir = buildDir; + } +} + diff --git ant/src/org/apache/hadoop/hive/ant/GenVectorTestCode.java ant/src/org/apache/hadoop/hive/ant/GenVectorTestCode.java new file mode 100644 index 0000000..4065067 --- /dev/null +++ ant/src/org/apache/hadoop/hive/ant/GenVectorTestCode.java @@ -0,0 +1,258 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hive.ant; + +import java.io.IOException; +import java.util.HashMap; + +/** + * + * GenVectorTestCode. + * This class is mutable and maintains a hashmap of TestSuiteClassName to test cases. + * The tests cases are added over the course of vectorized expressions class generation, + * with test classes being outputted at the end. For each column vector (inputs and/or outputs) + * a matrix of pairwise covering Booleans is used to generate test cases across nulls and + * repeating dimensions. Based on the input column vector(s) nulls and repeating states + * the states of the output column vector (if there is one) is validated, along with the null + * vector. For filter operations the selection vector is validated against the generated + * data. Each template corresponds to a class representing a test suite. + */ +public class GenVectorTestCode { + + public enum TestSuiteClassName{ + TestColumnScalarOperationVectorExpressionEvaluation, + TestColumnScalarFilterVectorExpressionEvaluation, + TestColumnColumnOperationVectorExpressionEvaluation, + TestColumnColumnFilterVectorExpressionEvaluation, + } + + private final String testOutputDir; + private final String testTemplateDirectory; + private final HashMap testsuites; + + public GenVectorTestCode(String testOutputDir, String testTemplateDirectory) { + this.testOutputDir = testOutputDir; + this.testTemplateDirectory = testTemplateDirectory; + testsuites = new HashMap(); + + for(TestSuiteClassName className : TestSuiteClassName.values()) { + testsuites.put(className,new StringBuilder()); + } + + } + + public void addColumnScalarOperationTestCases(boolean op1IsCol, String vectorExpClassName, + String inputColumnVectorType, String outputColumnVectorType, String scalarType) + throws IOException { + + TestSuiteClassName template = + TestSuiteClassName.TestColumnScalarOperationVectorExpressionEvaluation; + + //Read the template into a string; + String templateFile = GenVectorCode.joinPath(this.testTemplateDirectory,template.toString()+".txt"); + String templateString = removeTemplateComments(GenVectorCode.readFile(templateFile)); + + for(Boolean[] testMatrix :new Boolean[][]{ + // Pairwise: InitOuputColHasNulls, InitOuputColIsRepeating, ColumnHasNulls, ColumnIsRepeating + {false, true, true, true}, + {false, false, false, false}, + {true, false, true, false}, + {true, true, false, false}, + {true, false, false, true}}) { + String testCase = templateString; + testCase = testCase.replaceAll("", + "test" + + vectorExpClassName + + createNullRepeatingNameFragment("Out", testMatrix[0], testMatrix[1]) + + createNullRepeatingNameFragment("Col", testMatrix[2], testMatrix[3])); + testCase = testCase.replaceAll("", vectorExpClassName); + testCase = testCase.replaceAll("", inputColumnVectorType); + testCase = testCase.replaceAll("", outputColumnVectorType); + testCase = testCase.replaceAll("", scalarType); + testCase = testCase.replaceAll("", GenVectorCode.getCamelCaseType(scalarType)); + testCase = testCase.replaceAll("", testMatrix[0].toString()); + testCase = testCase.replaceAll("", testMatrix[1].toString()); + testCase = testCase.replaceAll("", testMatrix[2].toString()); + testCase = testCase.replaceAll("", testMatrix[3].toString()); + + if(op1IsCol){ + testCase = testCase.replaceAll("","0, scalarValue"); + }else{ + testCase = testCase.replaceAll("","scalarValue, 0"); + } + + testsuites.get(template).append(testCase); + } + } + + public void addColumnScalarFilterTestCases(boolean op1IsCol, String vectorExpClassName, + String inputColumnVectorType, String scalarType, String operatorSymbol) + throws IOException { + + TestSuiteClassName template = + TestSuiteClassName.TestColumnScalarFilterVectorExpressionEvaluation; + + //Read the template into a string; + String templateFile = GenVectorCode.joinPath(this.testTemplateDirectory,template.toString()+".txt"); + String templateString = removeTemplateComments(GenVectorCode.readFile(templateFile)); + + for(Boolean[] testMatrix : new Boolean[][]{ + // Pairwise: ColumnHasNulls, ColumnIsRepeating + {true, true}, + {true, false}, + {false, false}, + {false, true}}) { + String testCase = templateString; + testCase = testCase.replaceAll("", + "test" + + vectorExpClassName + + createNullRepeatingNameFragment("Col", testMatrix[0], testMatrix[1])); + testCase = testCase.replaceAll("", vectorExpClassName); + testCase = testCase.replaceAll("", inputColumnVectorType); + testCase = testCase.replaceAll("", scalarType); + testCase = testCase.replaceAll("", GenVectorCode.getCamelCaseType(scalarType)); + testCase = testCase.replaceAll("", testMatrix[0].toString()); + testCase = testCase.replaceAll("", testMatrix[1].toString()); + testCase = testCase.replaceAll("", operatorSymbol); + + if(op1IsCol){ + testCase = testCase.replaceAll("","inputColumnVector.vector[i]"); + testCase = testCase.replaceAll("","scalarValue"); + }else{ + testCase = testCase.replaceAll("","scalarValue"); + testCase = testCase.replaceAll("","inputColumnVector.vector[i]"); + } + + testsuites.get(template).append(testCase); + } + } + + public void addColumnColumnOperationTestCases(String vectorExpClassName, + String inputColumnVectorType1, String inputColumnVectorType2, String outputColumnVectorType) + throws IOException { + + TestSuiteClassName template= + TestSuiteClassName.TestColumnColumnOperationVectorExpressionEvaluation; + + //Read the template into a string; + String templateFile = GenVectorCode.joinPath(this.testTemplateDirectory,template.toString()+".txt"); + String templateString = removeTemplateComments(GenVectorCode.readFile(templateFile)); + + for(Boolean[] testMatrix : new Boolean[][]{ + // Pairwise: InitOuputColHasNulls, InitOuputColIsRepeating, Column1HasNulls, + // Column1IsRepeating, Column2HasNulls, Column2IsRepeating + {true, true, false, true, true, true}, + {false, false, true, false, false, false}, + {true, false, true, false, true, true}, + {true, true, true, true, false, false}, + {false, false, false, true, true, false}, + {false, true, false, false, false, true}}) { + String testCase = templateString; + testCase = testCase.replaceAll("", + "test" + + vectorExpClassName + + createNullRepeatingNameFragment("Out", testMatrix[0], testMatrix[1]) + + createNullRepeatingNameFragment("C1", testMatrix[2], testMatrix[3]) + + createNullRepeatingNameFragment("C2", testMatrix[4], testMatrix[5])); + testCase = testCase.replaceAll("", vectorExpClassName); + testCase = testCase.replaceAll("", inputColumnVectorType1); + testCase = testCase.replaceAll("", inputColumnVectorType2); + testCase = testCase.replaceAll("", outputColumnVectorType); + testCase = testCase.replaceAll("", testMatrix[0].toString()); + testCase = testCase.replaceAll("", testMatrix[1].toString()); + testCase = testCase.replaceAll("", testMatrix[2].toString()); + testCase = testCase.replaceAll("", testMatrix[3].toString()); + testCase = testCase.replaceAll("", testMatrix[4].toString()); + testCase = testCase.replaceAll("", testMatrix[5].toString()); + + testsuites.get(template).append(testCase); + } + } + + public void addColumnColumnFilterTestCases(String vectorExpClassName, + String inputColumnVectorType1, String inputColumnVectorType2, String operatorSymbol) + throws IOException { + + TestSuiteClassName template= + TestSuiteClassName.TestColumnColumnFilterVectorExpressionEvaluation; + + //Read the template into a string; + String templateFile = GenVectorCode.joinPath(this.testTemplateDirectory,template.toString()+".txt"); + String templateString = removeTemplateComments(GenVectorCode.readFile(templateFile)); + + for(Boolean[] testMatrix : new Boolean[][]{ + // Pairwise: Column1HasNulls, Column1IsRepeating, Column2HasNulls, Column2IsRepeating + {false, true, true, true}, + {false, false, false, false}, + {true, false, true, false}, + {true, true, false, false}, + {true, false, false, true}}) { + String testCase = templateString; + testCase = testCase.replaceAll("", + "test" + + vectorExpClassName + + createNullRepeatingNameFragment("C1", testMatrix[0], testMatrix[1]) + + createNullRepeatingNameFragment("C2", testMatrix[2], testMatrix[3])); + testCase = testCase.replaceAll("", vectorExpClassName); + testCase = testCase.replaceAll("", inputColumnVectorType1); + testCase = testCase.replaceAll("", inputColumnVectorType2); + testCase = testCase.replaceAll("", testMatrix[0].toString()); + testCase = testCase.replaceAll("", testMatrix[1].toString()); + testCase = testCase.replaceAll("", testMatrix[2].toString()); + testCase = testCase.replaceAll("", testMatrix[3].toString()); + testCase = testCase.replaceAll("", operatorSymbol); + + testsuites.get(template).append(testCase); + } + } + + public void generateTestSuites() throws IOException { + + String templateFile = GenVectorCode.joinPath(this.testTemplateDirectory, "TestClass.txt"); + for(TestSuiteClassName testClass : testsuites.keySet()) { + + String templateString = GenVectorCode.readFile(templateFile); + templateString = templateString.replaceAll("", testClass.toString()); + templateString = templateString.replaceAll("", testsuites.get(testClass).toString()); + + String outputFile = GenVectorCode.joinPath(this.testOutputDir, testClass + ".java"); + + GenVectorCode.writeFile(outputFile, templateString); + } + } + + private static String createNullRepeatingNameFragment(String idenitfier, boolean nulls, boolean repeating) + { + if(nulls || repeating){ + if(nulls){ + idenitfier+="Nulls"; + } + if(repeating){ + idenitfier+="Repeats"; + } + return idenitfier; + } + + return ""; + } + + private static String removeTemplateComments(String templateString){ + return templateString.replaceAll("(?s)", ""); + } +} diff --git build.xml build.xml index cf75b3d..7cb440c 100644 --- build.xml +++ build.xml @@ -263,6 +263,9 @@ + + + @@ -283,8 +286,13 @@ + + + + @@ -741,6 +749,7 @@ + diff --git ql/build.xml ql/build.xml index ac2b7b0..be8e10f 100644 --- ql/build.xml +++ ql/build.xml @@ -190,7 +190,7 @@ "}, - {"ColumnCompareScalar", "Greater", "double", "double", ">"}, - {"ColumnCompareScalar", "GreaterEqual", "long", "double", ">="}, - {"ColumnCompareScalar", "GreaterEqual", "double", "double", ">="}, - - {"FilterColumnCompareScalar", "Equal", "long", "double", "=="}, - {"FilterColumnCompareScalar", "Equal", "double", "double", "=="}, - {"FilterColumnCompareScalar", "NotEqual", "long", "double", "!="}, - {"FilterColumnCompareScalar", "NotEqual", "double", "double", "!="}, - {"FilterColumnCompareScalar", "Less", "long", "double", "<"}, - {"FilterColumnCompareScalar", "Less", "double", "double", "<"}, - {"FilterColumnCompareScalar", "LessEqual", "long", "double", "<="}, - {"FilterColumnCompareScalar", "LessEqual", "double", "double", "<="}, - {"FilterColumnCompareScalar", "Greater", "long", "double", ">"}, - {"FilterColumnCompareScalar", "Greater", "double", "double", ">"}, - {"FilterColumnCompareScalar", "GreaterEqual", "long", "double", ">="}, - {"FilterColumnCompareScalar", "GreaterEqual", "double", "double", ">="}, - - {"FilterColumnCompareScalar", "Equal", "long", "long", "=="}, - {"FilterColumnCompareScalar", "Equal", "double", "long", "=="}, - {"FilterColumnCompareScalar", "NotEqual", "long", "long", "!="}, - {"FilterColumnCompareScalar", "NotEqual", "double", "long", "!="}, - {"FilterColumnCompareScalar", "Less", "long", "long", "<"}, - {"FilterColumnCompareScalar", "Less", "double", "long", "<"}, - {"FilterColumnCompareScalar", "LessEqual", "long", "long", "<="}, - {"FilterColumnCompareScalar", "LessEqual", "double", "long", "<="}, - {"FilterColumnCompareScalar", "Greater", "long", "long", ">"}, - {"FilterColumnCompareScalar", "Greater", "double", "long", ">"}, - {"FilterColumnCompareScalar", "GreaterEqual", "long", "long", ">="}, - {"FilterColumnCompareScalar", "GreaterEqual", "double", "long", ">="}, - - {"FilterScalarCompareColumn", "Equal", "long", "double", "=="}, - {"FilterScalarCompareColumn", "Equal", "double", "double", "=="}, - {"FilterScalarCompareColumn", "NotEqual", "long", "double", "!="}, - {"FilterScalarCompareColumn", "NotEqual", "double", "double", "!="}, - {"FilterScalarCompareColumn", "Less", "long", "double", "<"}, - {"FilterScalarCompareColumn", "Less", "double", "double", "<"}, - {"FilterScalarCompareColumn", "LessEqual", "long", "double", "<="}, - {"FilterScalarCompareColumn", "LessEqual", "double", "double", "<="}, - {"FilterScalarCompareColumn", "Greater", "long", "double", ">"}, - {"FilterScalarCompareColumn", "Greater", "double", "double", ">"}, - {"FilterScalarCompareColumn", "GreaterEqual", "long", "double", ">="}, - {"FilterScalarCompareColumn", "GreaterEqual", "double", "double", ">="}, - - {"FilterScalarCompareColumn", "Equal", "long", "long", "=="}, - {"FilterScalarCompareColumn", "Equal", "double", "long", "=="}, - {"FilterScalarCompareColumn", "NotEqual", "long", "long", "!="}, - {"FilterScalarCompareColumn", "NotEqual", "double", "long", "!="}, - {"FilterScalarCompareColumn", "Less", "long", "long", "<"}, - {"FilterScalarCompareColumn", "Less", "double", "long", "<"}, - {"FilterScalarCompareColumn", "LessEqual", "long", "long", "<="}, - {"FilterScalarCompareColumn", "LessEqual", "double", "long", "<="}, - {"FilterScalarCompareColumn", "Greater", "long", "long", ">"}, - {"FilterScalarCompareColumn", "Greater", "double", "long", ">"}, - {"FilterScalarCompareColumn", "GreaterEqual", "long", "long", ">="}, - {"FilterScalarCompareColumn", "GreaterEqual", "double", "long", ">="}, - - {"FilterStringColumnCompareScalar", "Equal", "=="}, - {"FilterStringColumnCompareScalar", "NotEqual", "!="}, - {"FilterStringColumnCompareScalar", "Less", "<"}, - {"FilterStringColumnCompareScalar", "LessEqual", "<="}, - {"FilterStringColumnCompareScalar", "Greater", ">"}, - {"FilterStringColumnCompareScalar", "GreaterEqual", ">="}, - - {"FilterStringScalarCompareColumn", "Equal", "=="}, - {"FilterStringScalarCompareColumn", "NotEqual", "!="}, - {"FilterStringScalarCompareColumn", "Less", "<"}, - {"FilterStringScalarCompareColumn", "LessEqual", "<="}, - {"FilterStringScalarCompareColumn", "Greater", ">"}, - {"FilterStringScalarCompareColumn", "GreaterEqual", ">="}, - - {"FilterStringColumnCompareColumn", "Equal", "=="}, - {"FilterStringColumnCompareColumn", "NotEqual", "!="}, - {"FilterStringColumnCompareColumn", "Less", "<"}, - {"FilterStringColumnCompareColumn", "LessEqual", "<="}, - {"FilterStringColumnCompareColumn", "Greater", ">"}, - {"FilterStringColumnCompareColumn", "GreaterEqual", ">="}, - - {"FilterColumnCompareColumn", "Equal", "long", "double", "=="}, - {"FilterColumnCompareColumn", "Equal", "double", "double", "=="}, - {"FilterColumnCompareColumn", "NotEqual", "long", "double", "!="}, - {"FilterColumnCompareColumn", "NotEqual", "double", "double", "!="}, - {"FilterColumnCompareColumn", "Less", "long", "double", "<"}, - {"FilterColumnCompareColumn", "Less", "double", "double", "<"}, - {"FilterColumnCompareColumn", "LessEqual", "long", "double", "<="}, - {"FilterColumnCompareColumn", "LessEqual", "double", "double", "<="}, - {"FilterColumnCompareColumn", "Greater", "long", "double", ">"}, - {"FilterColumnCompareColumn", "Greater", "double", "double", ">"}, - {"FilterColumnCompareColumn", "GreaterEqual", "long", "double", ">="}, - {"FilterColumnCompareColumn", "GreaterEqual", "double", "double", ">="}, - - {"FilterColumnCompareColumn", "Equal", "long", "long", "=="}, - {"FilterColumnCompareColumn", "Equal", "double", "long", "=="}, - {"FilterColumnCompareColumn", "NotEqual", "long", "long", "!="}, - {"FilterColumnCompareColumn", "NotEqual", "double", "long", "!="}, - {"FilterColumnCompareColumn", "Less", "long", "long", "<"}, - {"FilterColumnCompareColumn", "Less", "double", "long", "<"}, - {"FilterColumnCompareColumn", "LessEqual", "long", "long", "<="}, - {"FilterColumnCompareColumn", "LessEqual", "double", "long", "<="}, - {"FilterColumnCompareColumn", "Greater", "long", "long", ">"}, - {"FilterColumnCompareColumn", "Greater", "double", "long", ">"}, - {"FilterColumnCompareColumn", "GreaterEqual", "long", "long", ">="}, - {"FilterColumnCompareColumn", "GreaterEqual", "double", "long", ">="}, - - {"ColumnUnaryMinus", "long"}, - {"ColumnUnaryMinus", "double"}, - - // template, , , , , - {"VectorUDAFMinMax", "VectorUDAFMinLong", "long", "<", "min", - "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: long)"}, - {"VectorUDAFMinMax", "VectorUDAFMinDouble", "double", "<", "min", - "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: double)"}, - {"VectorUDAFMinMax", "VectorUDAFMaxLong", "long", ">", "max", - "_FUNC_(expr) - Returns the maximum value of expr (vectorized, type: long)"}, - {"VectorUDAFMinMax", "VectorUDAFMaxDouble", "double", ">", "max", - "_FUNC_(expr) - Returns the maximum value of expr (vectorized, type: double)"}, - - {"VectorUDAFMinMaxString", "VectorUDAFMinString", "<", "min", - "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: string)"}, - {"VectorUDAFMinMaxString", "VectorUDAFMaxString", ">", "max", - "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: string)"}, - - //template, , - {"VectorUDAFSum", "VectorUDAFSumLong", "long"}, - {"VectorUDAFSum", "VectorUDAFSumDouble", "double"}, - {"VectorUDAFAvg", "VectorUDAFAvgLong", "long"}, - {"VectorUDAFAvg", "VectorUDAFAvgDouble", "double"}, - - // template, , , , , - // - {"VectorUDAFVar", "VectorUDAFVarPopLong", "long", "myagg.variance / myagg.count", - "variance, var_pop", - "_FUNC_(x) - Returns the variance of a set of numbers (vectorized, long)"}, - {"VectorUDAFVar", "VectorUDAFVarPopDouble", "double", "myagg.variance / myagg.count", - "variance, var_pop", - "_FUNC_(x) - Returns the variance of a set of numbers (vectorized, double)"}, - {"VectorUDAFVar", "VectorUDAFVarSampLong", "long", "myagg.variance / (myagg.count-1.0)", - "var_samp", - "_FUNC_(x) - Returns the sample variance of a set of numbers (vectorized, long)"}, - {"VectorUDAFVar", "VectorUDAFVarSampDouble", "double", "myagg.variance / (myagg.count-1.0)", - "var_samp", - "_FUNC_(x) - Returns the sample variance of a set of numbers (vectorized, double)"}, - {"VectorUDAFVar", "VectorUDAFStdPopLong", "long", - "Math.sqrt(myagg.variance / (myagg.count))", "std,stddev,stddev_pop", - "_FUNC_(x) - Returns the standard deviation of a set of numbers (vectorized, long)"}, - {"VectorUDAFVar", "VectorUDAFStdPopDouble", "double", - "Math.sqrt(myagg.variance / (myagg.count))", "std,stddev,stddev_pop", - "_FUNC_(x) - Returns the standard deviation of a set of numbers (vectorized, double)"}, - {"VectorUDAFVar", "VectorUDAFStdSampLong", "long", - "Math.sqrt(myagg.variance / (myagg.count-1.0))", "stddev_samp", - "_FUNC_(x) - Returns the sample standard deviation of a set of numbers (vectorized, long)"}, - {"VectorUDAFVar", "VectorUDAFStdSampDouble", "double", - "Math.sqrt(myagg.variance / (myagg.count-1.0))", "stddev_samp", - "_FUNC_(x) - Returns the sample standard deviation of a set of numbers (vectorized, double)"}, - - }; - - - private final String expressionOutputDirectory; - private final String expressionTemplateDirectory; - private final String udafOutputDirectory; - private final String udafTemplateDirectory; - private final TestCodeGen testCodeGen; - - static String joinPath(String...parts) { - String path = parts[0]; - for (int i=1; i < parts.length; ++i) { - path += File.separatorChar + parts[i]; - } - return path; - } - - public CodeGen() { - File generationDirectory = new File(System.getProperty("user.dir")); - - expressionOutputDirectory = - new File( - joinPath( - generationDirectory.getAbsolutePath(),"..", "..", "java", "org", - "apache", "hadoop", "hive", "ql", "exec", "vector", - "expressions", "gen")).getAbsolutePath(); - - expressionTemplateDirectory = - joinPath(generationDirectory.getAbsolutePath(), "ExpressionTemplates"); - - udafOutputDirectory = - new File( - joinPath( - generationDirectory.getAbsolutePath(),"..", "..", "java", "org", - "apache", "hadoop", "hive", "ql", "exec", "vector", - "expressions", "aggregates", "gen")).getAbsolutePath(); - - udafTemplateDirectory = - joinPath(generationDirectory.getAbsolutePath(), "udafTemplates"); - - testCodeGen = new TestCodeGen( - new File( - joinPath( - generationDirectory.getAbsolutePath(), "..", "..","test", "org", - "apache", "hadoop", "hive", "ql", "exec", "vector", - "expressions", "gen")).getAbsolutePath(), - joinPath(generationDirectory.getAbsolutePath(), "TestTemplates")); - } - - /** - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception { - CodeGen gen = new CodeGen(); - gen.generate(); - } - - private void generate() throws Exception { - - for (String [] tdesc : templateExpansions) { - if (tdesc[0].equals("ColumnArithmeticScalar")) { - generateColumnArithmeticScalar(tdesc); - } else if (tdesc[0].equals("ColumnCompareScalar")) { - generateColumnCompareScalar(tdesc); - } else if (tdesc[0].equals("FilterColumnCompareScalar")) { - generateFilterColumnCompareScalar(tdesc); - } else if (tdesc[0].equals("FilterScalarCompareColumn")) { - generateFilterScalarCompareColumn(tdesc); - } else if (tdesc[0].equals("ScalarArithmeticColumn")) { - generateScalarArithmeticColumn(tdesc); - } else if (tdesc[0].equals("FilterColumnCompareColumn")) { - generateFilterColumnCompareColumn(tdesc); - } else if (tdesc[0].equals("ColumnArithmeticColumn")) { - generateColumnArithmeticColumn(tdesc); - } else if (tdesc[0].equals("ColumnUnaryMinus")) { - generateColumnUnaryMinus(tdesc); - } else if (tdesc[0].equals("VectorUDAFMinMax")) { - generateVectorUDAFMinMax(tdesc); - } else if (tdesc[0].equals("VectorUDAFMinMaxString")) { - generateVectorUDAFMinMaxString(tdesc); - } else if (tdesc[0].equals("VectorUDAFSum")) { - generateVectorUDAFSum(tdesc); - } else if (tdesc[0].equals("VectorUDAFAvg")) { - generateVectorUDAFAvg(tdesc); - } else if (tdesc[0].equals("VectorUDAFVar")) { - generateVectorUDAFVar(tdesc); - } else if (tdesc[0].equals("FilterStringColumnCompareScalar")) { - generateFilterStringColumnCompareScalar(tdesc); - } else if (tdesc[0].equals("FilterStringScalarCompareColumn")) { - generateFilterStringScalarCompareColumn(tdesc); - } else if (tdesc[0].equals("FilterStringColumnCompareColumn")) { - generateFilterStringColumnCompareColumn(tdesc); - } else { - continue; - } - } - testCodeGen.generateTestSuites(); - } - - private void generateVectorUDAFMinMax(String[] tdesc) throws Exception { - String className = tdesc[1]; - String valueType = tdesc[2]; - String operatorSymbol = tdesc[3]; - String descName = tdesc[4]; - String descValue = tdesc[5]; - String columnType = getColumnVectorType(valueType); - String writableType = getOutputWritableType(valueType); - String inspectorType = getOutputObjectInspector(valueType); - - String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); - String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); - - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", valueType); - templateString = templateString.replaceAll("", operatorSymbol); - templateString = templateString.replaceAll("", columnType); - templateString = templateString.replaceAll("", descName); - templateString = templateString.replaceAll("", descValue); - templateString = templateString.replaceAll("", writableType); - templateString = templateString.replaceAll("", inspectorType); - writeFile(outputFile, templateString); - - } - - private void generateVectorUDAFMinMaxString(String[] tdesc) throws Exception { - String className = tdesc[1]; - String operatorSymbol = tdesc[2]; - String descName = tdesc[3]; - String descValue = tdesc[4]; - - String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); - String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); - - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", operatorSymbol); - templateString = templateString.replaceAll("", descName); - templateString = templateString.replaceAll("", descValue); - writeFile(outputFile, templateString); - - } - - private void generateVectorUDAFSum(String[] tdesc) throws Exception { - //template, , , , - String className = tdesc[1]; - String valueType = tdesc[2]; - String columnType = getColumnVectorType(valueType); - String writableType = getOutputWritableType(valueType); - String inspectorType = getOutputObjectInspector(valueType); - - String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); - String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); - - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", valueType); - templateString = templateString.replaceAll("", columnType); - templateString = templateString.replaceAll("", writableType); - templateString = templateString.replaceAll("", inspectorType); - writeFile(outputFile, templateString); - } - - private void generateVectorUDAFAvg(String[] tdesc) throws IOException { - String className = tdesc[1]; - String valueType = tdesc[2]; - String columnType = getColumnVectorType(valueType); - - String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); - String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); - - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", valueType); - templateString = templateString.replaceAll("", columnType); - writeFile(outputFile, templateString); - } - - private void generateVectorUDAFVar(String[] tdesc) throws IOException { - String className = tdesc[1]; - String valueType = tdesc[2]; - String varianceFormula = tdesc[3]; - String descriptionName = tdesc[4]; - String descriptionValue = tdesc[5]; - String columnType = getColumnVectorType(valueType); - - String outputFile = joinPath(this.udafOutputDirectory, className + ".java"); - String templateFile = joinPath(this.udafTemplateDirectory, tdesc[0] + ".txt"); - - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", valueType); - templateString = templateString.replaceAll("", columnType); - templateString = templateString.replaceAll("", varianceFormula); - templateString = templateString.replaceAll("", descriptionName); - templateString = templateString.replaceAll("", descriptionValue); - writeFile(outputFile, templateString); - } - - private void generateFilterStringScalarCompareColumn(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String className = "FilterStringScalar" + operatorName + "StringColumn"; - - // Template expansion logic is the same for both column-scalar and scalar-column cases. - generateFilterStringColumnCompareScalar(tdesc, className); - } - - private void generateFilterStringColumnCompareScalar(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String className = "FilterStringCol" + operatorName + "StringScalar"; - generateFilterStringColumnCompareScalar(tdesc, className); - } - - private void generateFilterStringColumnCompareColumn(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String className = "FilterStringCol" + operatorName + "StringColumn"; - generateFilterStringColumnCompareScalar(tdesc, className); - } - - private void generateFilterStringColumnCompareScalar(String[] tdesc, String className) - throws IOException { - String operatorSymbol = tdesc[2]; - String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); - // Read the template into a string; - String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); - String templateString = readFile(templateFile); - // Expand, and write result - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", operatorSymbol); - writeFile(outputFile, templateString); - } - - private void generateFilterColumnCompareColumn(String[] tdesc) throws IOException { - //The variables are all same as ColumnCompareScalar except that - //this template doesn't need a return type. Pass anything as return type. - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = "Filter" + getCamelCaseType(operandType1) - + "Col" + operatorName + getCamelCaseType(operandType2) + "Column"; - generateColumnBinaryOperatorColumn(tdesc, null, className); - } - - private void generateColumnUnaryMinus(String[] tdesc) throws IOException { - String operandType = tdesc[1]; - String inputColumnVectorType = this.getColumnVectorType(operandType); - String outputColumnVectorType = inputColumnVectorType; - String returnType = operandType; - String className = getCamelCaseType(operandType) + "ColUnaryMinus"; - String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); - String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); - String templateString = readFile(templateFile); - // Expand, and write result - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", inputColumnVectorType); - templateString = templateString.replaceAll("", outputColumnVectorType); - templateString = templateString.replaceAll("", operandType); - templateString = templateString.replaceAll("", returnType); - writeFile(outputFile, templateString); - } - - private void generateColumnArithmeticColumn(String [] tdesc) throws IOException { - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = getCamelCaseType(operandType1) - + "Col" + operatorName + getCamelCaseType(operandType2) + "Column"; - String returnType = getArithmeticReturnType(operandType1, operandType2); - generateColumnBinaryOperatorColumn(tdesc, returnType, className); - } - - private void generateFilterColumnCompareScalar(String[] tdesc) throws IOException { - //The variables are all same as ColumnCompareScalar except that - //this template doesn't need a return type. Pass anything as return type. - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = "Filter" + getCamelCaseType(operandType1) - + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; - generateColumnBinaryOperatorScalar(tdesc, null, className); - } - - private void generateFilterScalarCompareColumn(String[] tdesc) throws IOException { - //this template doesn't need a return type. Pass anything as return type. - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = "Filter" + getCamelCaseType(operandType1) - + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column"; - generateScalarBinaryOperatorColumn(tdesc, null, className); - } - - private void generateColumnCompareScalar(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String returnType = "long"; - String className = getCamelCaseType(operandType1) - + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; - generateColumnBinaryOperatorScalar(tdesc, returnType, className); - } - - private void generateColumnBinaryOperatorColumn(String[] tdesc, String returnType, - String className) throws IOException { - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String outputColumnVectorType = this.getColumnVectorType(returnType); - String inputColumnVectorType1 = this.getColumnVectorType(operandType1); - String inputColumnVectorType2 = this.getColumnVectorType(operandType2); - String operatorSymbol = tdesc[4]; - String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); - - //Read the template into a string; - String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", inputColumnVectorType1); - templateString = templateString.replaceAll("", inputColumnVectorType2); - templateString = templateString.replaceAll("", outputColumnVectorType); - templateString = templateString.replaceAll("", operatorSymbol); - templateString = templateString.replaceAll("", operandType1); - templateString = templateString.replaceAll("", operandType2); - templateString = templateString.replaceAll("", returnType); - templateString = templateString.replaceAll("", getCamelCaseType(returnType)); - writeFile(outputFile, templateString); - - if(returnType==null){ - testCodeGen.addColumnColumnFilterTestCases( - className, - inputColumnVectorType1, - inputColumnVectorType2, - operatorSymbol); - }else{ - testCodeGen.addColumnColumnOperationTestCases( - className, - inputColumnVectorType1, - inputColumnVectorType2, - outputColumnVectorType); - } - } - - private void generateColumnBinaryOperatorScalar(String[] tdesc, String returnType, - String className) throws IOException { - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String outputColumnVectorType = this.getColumnVectorType(returnType); - String inputColumnVectorType = this.getColumnVectorType(operandType1); - String operatorSymbol = tdesc[4]; - String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); - - //Read the template into a string; - String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", inputColumnVectorType); - templateString = templateString.replaceAll("", outputColumnVectorType); - templateString = templateString.replaceAll("", operatorSymbol); - templateString = templateString.replaceAll("", operandType1); - templateString = templateString.replaceAll("", operandType2); - templateString = templateString.replaceAll("", returnType); - writeFile(outputFile, templateString); - - if(returnType==null) { - testCodeGen.addColumnScalarFilterTestCases( - true, - className, - inputColumnVectorType, - operandType2, - operatorSymbol); - } else { - testCodeGen.addColumnScalarOperationTestCases( - true, - className, - inputColumnVectorType, - outputColumnVectorType, - operandType2); - } - } - - private void generateScalarBinaryOperatorColumn(String[] tdesc, String returnType, - String className) throws IOException { - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String outputColumnVectorType = this.getColumnVectorType(returnType); - String inputColumnVectorType = this.getColumnVectorType(operandType2); - String operatorSymbol = tdesc[4]; - String outputFile = joinPath(this.expressionOutputDirectory, className + ".java"); - - //Read the template into a string; - String templateFile = joinPath(this.expressionTemplateDirectory, tdesc[0] + ".txt"); - String templateString = readFile(templateFile); - templateString = templateString.replaceAll("", className); - templateString = templateString.replaceAll("", inputColumnVectorType); - templateString = templateString.replaceAll("", outputColumnVectorType); - templateString = templateString.replaceAll("", operatorSymbol); - templateString = templateString.replaceAll("", operandType1); - templateString = templateString.replaceAll("", operandType2); - templateString = templateString.replaceAll("", returnType); - writeFile(outputFile, templateString); - - if(returnType==null) { - testCodeGen.addColumnScalarFilterTestCases( - false, - className, - inputColumnVectorType, - operandType1, - operatorSymbol); - } else { - testCodeGen.addColumnScalarOperationTestCases( - false, - className, - inputColumnVectorType, - outputColumnVectorType, - operandType1); - } - } - - //Binary arithmetic operator - private void generateColumnArithmeticScalar(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = getCamelCaseType(operandType1) - + "Col" + operatorName + getCamelCaseType(operandType2) + "Scalar"; - String returnType = getArithmeticReturnType(operandType1, operandType2); - generateColumnBinaryOperatorScalar(tdesc, returnType, className); - } - - private void generateScalarArithmeticColumn(String[] tdesc) throws IOException { - String operatorName = tdesc[1]; - String operandType1 = tdesc[2]; - String operandType2 = tdesc[3]; - String className = getCamelCaseType(operandType1) - + "Scalar" + operatorName + getCamelCaseType(operandType2) + "Column"; - String returnType = getArithmeticReturnType(operandType1, operandType2); - generateScalarBinaryOperatorColumn(tdesc, returnType, className); - } - - - static void writeFile(String outputFile, String str) throws IOException { - BufferedWriter w = new BufferedWriter(new FileWriter(outputFile)); - w.write(str); - w.close(); - } - - static String readFile(String templateFile) throws IOException { - BufferedReader r = new BufferedReader(new FileReader(templateFile)); - String line = r.readLine(); - StringBuilder b = new StringBuilder(); - while (line != null) { - b.append(line); - b.append("\n"); - line = r.readLine(); - } - r.close(); - return b.toString(); - } - - static String getCamelCaseType(String type) { - if (type == null) { - return null; - } - if (type.equals("long")) { - return "Long"; - } else if (type.equals("double")) { - return "Double"; - } else { - return type; - } - } - - private String getArithmeticReturnType(String operandType1, - String operandType2) { - if (operandType1.equals("double") || - operandType2.equals("double")) { - return "double"; - } else { - return "long"; - } - } - - private String getColumnVectorType(String primitiveType) { - if(primitiveType!=null && primitiveType.equals("double")) { - return "DoubleColumnVector"; - } - return "LongColumnVector"; - } - - private String getOutputWritableType(String primitiveType) throws Exception { - if (primitiveType.equals("long")) { - return "LongWritable"; - } else if (primitiveType.equals("double")) { - return "DoubleWritable"; - } - throw new Exception("Unimplemented primitive output writable: " + primitiveType); - } - - private String getOutputObjectInspector(String primitiveType) throws Exception { - if (primitiveType.equals("long")) { - return "PrimitiveObjectInspectorFactory.writableLongObjectInspector"; - } else if (primitiveType.equals("double")) { - return "PrimitiveObjectInspectorFactory.writableDoubleObjectInspector"; - } - throw new Exception("Unimplemented primitive output inspector: " + primitiveType); - } -} - diff --git ql/src/gen/vectorization/org/apache/hadoop/hive/ql/exec/vector/gen/TestCodeGen.java ql/src/gen/vectorization/org/apache/hadoop/hive/ql/exec/vector/gen/TestCodeGen.java deleted file mode 100644 index 908b8e8..0000000 --- ql/src/gen/vectorization/org/apache/hadoop/hive/ql/exec/vector/gen/TestCodeGen.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.gen; - -import java.io.IOException; -import java.util.HashMap; - -/** - * - * TestCodeGen. - * This class is mutable and maintains a hashmap of TestSuiteClassName to test cases. - * The tests cases are added over the course of vectorized expressions class generation, - * with test classes being outputted at the end. For each column vector (inputs and/or outputs) - * a matrix of pairwise covering Booleans is used to generate test cases across nulls and - * repeating dimensions. Based on the input column vector(s) nulls and repeating states - * the states of the output column vector (if there is one) is validated, along with the null - * vector. For filter operations the selection vector is validated against the generated - * data. Each template corresponds to a class representing a test suite. - */ -public class TestCodeGen { - - public enum TestSuiteClassName{ - TestColumnScalarOperationVectorExpressionEvaluation, - TestColumnScalarFilterVectorExpressionEvaluation, - TestColumnColumnOperationVectorExpressionEvaluation, - TestColumnColumnFilterVectorExpressionEvaluation, - } - - private final String testOutputDir; - private final String testTemplateDirectory; - private final HashMap testsuites; - - public TestCodeGen(String testOutputDir, String testTemplateDirectory) { - this.testOutputDir = testOutputDir; - this.testTemplateDirectory = testTemplateDirectory; - testsuites = new HashMap(); - - for(TestSuiteClassName className : TestSuiteClassName.values()) { - testsuites.put(className,new StringBuilder()); - } - - } - - public void addColumnScalarOperationTestCases(boolean op1IsCol, String vectorExpClassName, - String inputColumnVectorType, String outputColumnVectorType, String scalarType) - throws IOException { - - TestSuiteClassName template = - TestSuiteClassName.TestColumnScalarOperationVectorExpressionEvaluation; - - //Read the template into a string; - String templateFile = CodeGen.joinPath(this.testTemplateDirectory,template.toString()+".txt"); - String templateString = removeTemplateComments(CodeGen.readFile(templateFile)); - - for(Boolean[] testMatrix :new Boolean[][]{ - // Pairwise: InitOuputColHasNulls, InitOuputColIsRepeating, ColumnHasNulls, ColumnIsRepeating - {false, true, true, true}, - {false, false, false, false}, - {true, false, true, false}, - {true, true, false, false}, - {true, false, false, true}}) { - String testCase = templateString; - testCase = testCase.replaceAll("", - "test" - + vectorExpClassName - + createNullRepeatingNameFragment("Out", testMatrix[0], testMatrix[1]) - + createNullRepeatingNameFragment("Col", testMatrix[2], testMatrix[3])); - testCase = testCase.replaceAll("", vectorExpClassName); - testCase = testCase.replaceAll("", inputColumnVectorType); - testCase = testCase.replaceAll("", outputColumnVectorType); - testCase = testCase.replaceAll("", scalarType); - testCase = testCase.replaceAll("", CodeGen.getCamelCaseType(scalarType)); - testCase = testCase.replaceAll("", testMatrix[0].toString()); - testCase = testCase.replaceAll("", testMatrix[1].toString()); - testCase = testCase.replaceAll("", testMatrix[2].toString()); - testCase = testCase.replaceAll("", testMatrix[3].toString()); - - if(op1IsCol){ - testCase = testCase.replaceAll("","0, scalarValue"); - }else{ - testCase = testCase.replaceAll("","scalarValue, 0"); - } - - testsuites.get(template).append(testCase); - } - } - - public void addColumnScalarFilterTestCases(boolean op1IsCol, String vectorExpClassName, - String inputColumnVectorType, String scalarType, String operatorSymbol) - throws IOException { - - TestSuiteClassName template = - TestSuiteClassName.TestColumnScalarFilterVectorExpressionEvaluation; - - //Read the template into a string; - String templateFile = CodeGen.joinPath(this.testTemplateDirectory,template.toString()+".txt"); - String templateString = removeTemplateComments(CodeGen.readFile(templateFile)); - - for(Boolean[] testMatrix : new Boolean[][]{ - // Pairwise: ColumnHasNulls, ColumnIsRepeating - {true, true}, - {true, false}, - {false, false}, - {false, true}}) { - String testCase = templateString; - testCase = testCase.replaceAll("", - "test" - + vectorExpClassName - + createNullRepeatingNameFragment("Col", testMatrix[0], testMatrix[1])); - testCase = testCase.replaceAll("", vectorExpClassName); - testCase = testCase.replaceAll("", inputColumnVectorType); - testCase = testCase.replaceAll("", scalarType); - testCase = testCase.replaceAll("", CodeGen.getCamelCaseType(scalarType)); - testCase = testCase.replaceAll("", testMatrix[0].toString()); - testCase = testCase.replaceAll("", testMatrix[1].toString()); - testCase = testCase.replaceAll("", operatorSymbol); - - if(op1IsCol){ - testCase = testCase.replaceAll("","inputColumnVector.vector[i]"); - testCase = testCase.replaceAll("","scalarValue"); - }else{ - testCase = testCase.replaceAll("","scalarValue"); - testCase = testCase.replaceAll("","inputColumnVector.vector[i]"); - } - - testsuites.get(template).append(testCase); - } - } - - public void addColumnColumnOperationTestCases(String vectorExpClassName, - String inputColumnVectorType1, String inputColumnVectorType2, String outputColumnVectorType) - throws IOException { - - TestSuiteClassName template= - TestSuiteClassName.TestColumnColumnOperationVectorExpressionEvaluation; - - //Read the template into a string; - String templateFile = CodeGen.joinPath(this.testTemplateDirectory,template.toString()+".txt"); - String templateString = removeTemplateComments(CodeGen.readFile(templateFile)); - - for(Boolean[] testMatrix : new Boolean[][]{ - // Pairwise: InitOuputColHasNulls, InitOuputColIsRepeating, Column1HasNulls, - // Column1IsRepeating, Column2HasNulls, Column2IsRepeating - {true, true, false, true, true, true}, - {false, false, true, false, false, false}, - {true, false, true, false, true, true}, - {true, true, true, true, false, false}, - {false, false, false, true, true, false}, - {false, true, false, false, false, true}}) { - String testCase = templateString; - testCase = testCase.replaceAll("", - "test" - + vectorExpClassName - + createNullRepeatingNameFragment("Out", testMatrix[0], testMatrix[1]) - + createNullRepeatingNameFragment("C1", testMatrix[2], testMatrix[3]) - + createNullRepeatingNameFragment("C2", testMatrix[4], testMatrix[5])); - testCase = testCase.replaceAll("", vectorExpClassName); - testCase = testCase.replaceAll("", inputColumnVectorType1); - testCase = testCase.replaceAll("", inputColumnVectorType2); - testCase = testCase.replaceAll("", outputColumnVectorType); - testCase = testCase.replaceAll("", testMatrix[0].toString()); - testCase = testCase.replaceAll("", testMatrix[1].toString()); - testCase = testCase.replaceAll("", testMatrix[2].toString()); - testCase = testCase.replaceAll("", testMatrix[3].toString()); - testCase = testCase.replaceAll("", testMatrix[4].toString()); - testCase = testCase.replaceAll("", testMatrix[5].toString()); - - testsuites.get(template).append(testCase); - } - } - - public void addColumnColumnFilterTestCases(String vectorExpClassName, - String inputColumnVectorType1, String inputColumnVectorType2, String operatorSymbol) - throws IOException { - - TestSuiteClassName template= - TestSuiteClassName.TestColumnColumnFilterVectorExpressionEvaluation; - - //Read the template into a string; - String templateFile = CodeGen.joinPath(this.testTemplateDirectory,template.toString()+".txt"); - String templateString = removeTemplateComments(CodeGen.readFile(templateFile)); - - for(Boolean[] testMatrix : new Boolean[][]{ - // Pairwise: Column1HasNulls, Column1IsRepeating, Column2HasNulls, Column2IsRepeating - {false, true, true, true}, - {false, false, false, false}, - {true, false, true, false}, - {true, true, false, false}, - {true, false, false, true}}) { - String testCase = templateString; - testCase = testCase.replaceAll("", - "test" - + vectorExpClassName - + createNullRepeatingNameFragment("C1", testMatrix[0], testMatrix[1]) - + createNullRepeatingNameFragment("C2", testMatrix[2], testMatrix[3])); - testCase = testCase.replaceAll("", vectorExpClassName); - testCase = testCase.replaceAll("", inputColumnVectorType1); - testCase = testCase.replaceAll("", inputColumnVectorType2); - testCase = testCase.replaceAll("", testMatrix[0].toString()); - testCase = testCase.replaceAll("", testMatrix[1].toString()); - testCase = testCase.replaceAll("", testMatrix[2].toString()); - testCase = testCase.replaceAll("", testMatrix[3].toString()); - testCase = testCase.replaceAll("", operatorSymbol); - - testsuites.get(template).append(testCase); - } - } - - public void generateTestSuites() throws IOException { - - String templateFile = CodeGen.joinPath(this.testTemplateDirectory, "TestClass.txt"); - for(TestSuiteClassName testClass : testsuites.keySet()) { - - String templateString = CodeGen.readFile(templateFile); - templateString = templateString.replaceAll("", testClass.toString()); - templateString = templateString.replaceAll("", testsuites.get(testClass).toString()); - - String outputFile = CodeGen.joinPath(this.testOutputDir, testClass + ".java"); - - CodeGen.writeFile(outputFile, templateString); - } - } - - private static String createNullRepeatingNameFragment(String idenitfier, boolean nulls, boolean repeating) - { - if(nulls || repeating){ - if(nulls){ - idenitfier+="Nulls"; - } - if(repeating){ - idenitfier+="Repeats"; - } - return idenitfier; - } - - return ""; - } - - private static String removeTemplateComments(String templateString){ - return templateString.replaceAll("(?s)", ""); - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFAvgDouble.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFAvgDouble.java deleted file mode 100644 index 5940c2a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFAvgDouble.java +++ /dev/null @@ -1,474 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.gen; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.hadoop.hive.ql.exec.Description; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.VectorAggregateExpression; -import org.apache.hadoop.hive.ql.exec.vector.VectorAggregationBufferRow; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.apache.hadoop.hive.ql.plan.AggregationDesc; -import org.apache.hadoop.hive.ql.util.JavaDataModel; -import org.apache.hadoop.io.LongWritable; -import org.apache.hadoop.hive.serde2.io.DoubleWritable; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory; -import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector; -import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; - -/** - * Generated from template VectorUDAFAvg.txt. - */ -@Description(name = "avg", - value = "_FUNC_(expr) - Returns the average value of expr (vectorized, type: double)") -public class VectorUDAFAvgDouble extends VectorAggregateExpression { - - private static final long serialVersionUID = 1L; - - /** class for storing the current aggregate value. */ - static class Aggregation implements AggregationBuffer { - - private static final long serialVersionUID = 1L; - - transient private double sum; - transient private long count; - transient private boolean isNull; - - public void sumValue(double value) { - if (isNull) { - sum = value; - count = 1; - isNull = false; - } else { - sum += value; - count++; - } - } - - @Override - public int getVariableSize() { - throw new UnsupportedOperationException(); - } - } - - private VectorExpression inputExpression; - transient private Object[] partialResult; - transient private LongWritable resultCount; - transient private DoubleWritable resultSum; - transient private StructObjectInspector soi; - - public VectorUDAFAvgDouble(VectorExpression inputExpression) { - this(); - this.inputExpression = inputExpression; - } - - public VectorUDAFAvgDouble() { - super(); - partialResult = new Object[2]; - resultCount = new LongWritable(); - resultSum = new DoubleWritable(); - partialResult[0] = resultCount; - partialResult[1] = resultSum; - initPartialResultInspector(); - } - - private void initPartialResultInspector() { - List foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(bufferIndex); - return myagg; - } - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = ( DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - double[] vector = inputVector.vector; - - if (inputVector.noNulls) { - if (inputVector.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize); - } - } - } else { - if (inputVector.isRepeating) { - if (batch.selectedInUse) { - iterateHasNullsRepeatingSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsRepeatingWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize, inputVector.isNull); - } - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize, inputVector.isNull); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double value, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double[] values, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[selection[i]]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double[] values, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[i]); - } - } - - private void iterateHasNullsRepeatingSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double value, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[selection[i]]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - - } - - private void iterateHasNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double value, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double[] values, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int j=0; j < batchSize; ++j) { - int i = selection[j]; - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - j); - myagg.sumValue(values[i]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - double[] values, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[i]); - } - } - } - - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = - (DoubleColumnVector)batch.cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - myagg.sum += vector[0]*batchSize; - myagg.count += batchSize; - } - return; - } - - if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - myagg.sum += value; - myagg.count += 1; - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - - for (int i=0; i< batchSize; ++i) { - double value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(bufferIndex); - return myagg; - } - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = ( LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - long[] vector = inputVector.vector; - - if (inputVector.noNulls) { - if (inputVector.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize); - } - } - } else { - if (inputVector.isRepeating) { - if (batch.selectedInUse) { - iterateHasNullsRepeatingSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsRepeatingWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector[0], batchSize, inputVector.isNull); - } - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, bufferIndex, - vector, batchSize, inputVector.isNull); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long value, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long[] values, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[selection[i]]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long[] values, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[i]); - } - } - - private void iterateHasNullsRepeatingSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long value, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[selection[i]]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - - } - - private void iterateHasNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long value, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(value); - } - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long[] values, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int j=0; j < batchSize; ++j) { - int i = selection[j]; - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - j); - myagg.sumValue(values[i]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int bufferIndex, - long[] values, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - bufferIndex, - i); - myagg.sumValue(values[i]); - } - } - } - - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = - (LongColumnVector)batch.cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - myagg.sum += vector[0]*batchSize; - myagg.count += batchSize; - } - return; - } - - if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!isNull[i]) { - long value = vector[i]; - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - myagg.sum += value; - myagg.count += 1; - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.isNull = false; - myagg.sum = 0; - myagg.count = 0; - } - - for (int i=0; i< batchSize; ++i) { - long value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i this.value) { - this.value = value; - } - } - - @Override - public int getVariableSize() { - throw new UnsupportedOperationException(); - } - } - - private VectorExpression inputExpression; - private transient VectorExpressionWriter resultWriter; - - public VectorUDAFMaxDouble(VectorExpression inputExpression) { - this(); - this.inputExpression = inputExpression; - } - - public VectorUDAFMaxDouble() { - super(); - } - - @Override - public void init(AggregationDesc desc) throws HiveException { - resultWriter = VectorExpressionWriterFactory.genVectorExpressionWritable( - desc.getParameters().get(0)); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); - return myagg; - } - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - double[] vector = inputVector.vector; - - if (inputVector.noNulls) { - if (inputVector.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize); - } - } - } else { - if (inputVector.isRepeating) { - if (batch.selectedInUse) { - iterateHasNullsRepeatingSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, inputVector.isNull); - } - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, inputVector.isNull); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[selection[i]]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - - private void iterateHasNullsRepeatingSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[selection[i]]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - } - - private void iterateHasNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int j=0; j < batchSize; ++j) { - int i = selection[j]; - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - j); - myagg.checkValue(values[i]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls && - (myagg.isNull || (vector[0] > myagg.value))) { - myagg.isNull = false; - myagg.value = vector[0]; - } - return; - } - - if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.isNull = false; - myagg.value = value; - } - else if (value > myagg.value) { - myagg.value = value; - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.value = vector[selected[0]]; - myagg.isNull = false; - } - - for (int i=0; i< batchSize; ++i) { - double value = vector[selected[i]]; - if (value > myagg.value) { - myagg.value = value; - } - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i myagg.value) { - myagg.value = value; - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize) { - if (myagg.isNull) { - myagg.value = vector[0]; - myagg.isNull = false; - } - - for (int i=0;i myagg.value) { - myagg.value = value; - } - } - } - - @Override - public AggregationBuffer getNewAggregationBuffer() throws HiveException { - return new Aggregation(); - } - - @Override - public void reset(AggregationBuffer agg) throws HiveException { - Aggregation myAgg = (Aggregation) agg; - myAgg.isNull = true; - } - - @Override - public Object evaluateOutput( - AggregationBuffer agg) throws HiveException { - Aggregation myagg = (Aggregation) agg; - if (myagg.isNull) { - return null; - } - else { - return resultWriter.writeValue(myagg.value); - } - } - - @Override - public ObjectInspector getOutputObjectInspector() { - return resultWriter.getObjectInspector(); - } - - @Override - public int getAggregationBufferFixedSize() { - JavaDataModel model = JavaDataModel.get(); - return JavaDataModel.alignUp( - model.object() + - model.primitive2(), - model.memoryAlign()); - } - - public VectorExpression getInputExpression() { - return inputExpression; - } - - public void setInputExpression(VectorExpression inputExpression) { - this.inputExpression = inputExpression; - } -} - diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxLong.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxLong.java deleted file mode 100644 index 6a229fa..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxLong.java +++ /dev/null @@ -1,441 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.gen; - -import org.apache.hadoop.hive.ql.exec.Description; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.VectorAggregateExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriter; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriterFactory; -import org.apache.hadoop.hive.ql.exec.vector.VectorAggregationBufferRow; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.apache.hadoop.hive.ql.plan.AggregationDesc; -import org.apache.hadoop.hive.ql.util.JavaDataModel; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; - -/** -* VectorUDAFMaxLong. Vectorized implementation for MIN/MAX aggregates. -*/ -@Description(name = "max", - value = "_FUNC_(expr) - Returns the maximum value of expr (vectorized, type: long)") -public class VectorUDAFMaxLong extends VectorAggregateExpression { - - private static final long serialVersionUID = 1L; - - /** - * class for storing the current aggregate value. - */ - static private final class Aggregation implements AggregationBuffer { - - private static final long serialVersionUID = 1L; - - transient private long value; - transient private boolean isNull; - - public void checkValue(long value) { - if (isNull) { - isNull = false; - this.value = value; - } else if (value > this.value) { - this.value = value; - } - } - - @Override - public int getVariableSize() { - throw new UnsupportedOperationException(); - } - } - - private VectorExpression inputExpression; - private transient VectorExpressionWriter resultWriter; - - public VectorUDAFMaxLong(VectorExpression inputExpression) { - this(); - this.inputExpression = inputExpression; - } - - public VectorUDAFMaxLong() { - super(); - } - - @Override - public void init(AggregationDesc desc) throws HiveException { - resultWriter = VectorExpressionWriterFactory.genVectorExpressionWritable( - desc.getParameters().get(0)); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); - return myagg; - } - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - long[] vector = inputVector.vector; - - if (inputVector.noNulls) { - if (inputVector.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize); - } - } - } else { - if (inputVector.isRepeating) { - if (batch.selectedInUse) { - iterateHasNullsRepeatingSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, inputVector.isNull); - } - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, inputVector.isNull); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long value, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long[] values, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[selection[i]]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long[] values, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - - private void iterateHasNullsRepeatingSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long value, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[selection[i]]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - } - - private void iterateHasNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long value, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long[] values, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int j=0; j < batchSize; ++j) { - int i = selection[j]; - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - j); - myagg.checkValue(values[i]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - long[] values, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls && - (myagg.isNull || (vector[0] > myagg.value))) { - myagg.isNull = false; - myagg.value = vector[0]; - } - return; - } - - if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!isNull[i]) { - long value = vector[i]; - if (myagg.isNull) { - myagg.isNull = false; - myagg.value = value; - } - else if (value > myagg.value) { - myagg.value = value; - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.value = vector[selected[0]]; - myagg.isNull = false; - } - - for (int i=0; i< batchSize; ++i) { - long value = vector[selected[i]]; - if (value > myagg.value) { - myagg.value = value; - } - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i myagg.value) { - myagg.value = value; - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize) { - if (myagg.isNull) { - myagg.value = vector[0]; - myagg.isNull = false; - } - - for (int i=0;i myagg.value) { - myagg.value = value; - } - } - } - - @Override - public AggregationBuffer getNewAggregationBuffer() throws HiveException { - return new Aggregation(); - } - - @Override - public void reset(AggregationBuffer agg) throws HiveException { - Aggregation myAgg = (Aggregation) agg; - myAgg.isNull = true; - } - - @Override - public Object evaluateOutput( - AggregationBuffer agg) throws HiveException { - Aggregation myagg = (Aggregation) agg; - if (myagg.isNull) { - return null; - } - else { - return resultWriter.writeValue(myagg.value); - } - } - - @Override - public ObjectInspector getOutputObjectInspector() { - return resultWriter.getObjectInspector(); - } - - @Override - public int getAggregationBufferFixedSize() { - JavaDataModel model = JavaDataModel.get(); - return JavaDataModel.alignUp( - model.object() + - model.primitive2(), - model.memoryAlign()); - } - - public VectorExpression getInputExpression() { - return inputExpression; - } - - public void setInputExpression(VectorExpression inputExpression) { - this.inputExpression = inputExpression; - } -} - diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxString.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxString.java deleted file mode 100644 index 6faaf17..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMaxString.java +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.gen; - -import java.util.ArrayList; -import java.util.Arrays; -import org.apache.hadoop.hive.ql.exec.Description; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.VectorAggregateExpression; -import org.apache.hadoop.hive.ql.exec.vector.VectorAggregationBufferRow; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.plan.AggregationDesc; -import org.apache.hadoop.hive.ql.util.JavaDataModel; -import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; -import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory; -import org.apache.hadoop.io.Text; - -/** -* VectorUDAFMaxString. Vectorized implementation for MIN/MAX aggregates. -*/ -@Description(name = "max", - value = "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: string)") -public class VectorUDAFMaxString extends VectorAggregateExpression { - - private static final long serialVersionUID = 1L; - - /** - * class for storing the current aggregate value. - */ - static private final class Aggregation implements AggregationBuffer { - - private static final long serialVersionUID = 1L; - - transient private final static int MIN_BUFFER_SIZE = 16; - transient private byte[] bytes = new byte[MIN_BUFFER_SIZE]; - transient private int length; - transient private boolean isNull; - - public void checkValue(byte[] bytes, int start, int length) { - if (isNull) { - isNull = false; - assign(bytes, start, length); - } else if (StringExpr.compare( - bytes, start, length, - this.bytes, 0, this.length) > 0) { - assign(bytes, start, length); - } - } - - public void assign(byte[] bytes, int start, int length) { - // Avoid new allocation if possible - if (this.bytes.length < length) { - this.bytes = new byte[length]; - } - System.arraycopy(bytes, start, this.bytes, 0, length); - this.length = length; - } - @Override - public int getVariableSize() { - JavaDataModel model = JavaDataModel.get(); - return model.lengthForByteArrayOfSize(bytes.length); - } - } - - private VectorExpression inputExpression; - transient private Text result; - - public VectorUDAFMaxString(VectorExpression inputExpression) { - this(); - this.inputExpression = inputExpression; - } - - public VectorUDAFMaxString() { - super(); - result = new Text(); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); - return myagg; - } - -@Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - BytesColumnVector inputColumn = (BytesColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - if (inputColumn.noNulls) { - if (inputColumn.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - inputColumn, batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - inputColumn, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - inputColumn, batchSize); - } - } - } else { - if (inputColumn.isRepeating) { - // All nulls, no-op for min/max - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - inputColumn, batchSize, batch.selected); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - inputColumn, batchSize); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - BytesColumnVector inputColumn, - int batchSize) { - - byte[] bytes = inputColumn.vector[0]; - int start = inputColumn.start[0]; - int length = inputColumn.length[0]; - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(bytes, start, length); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - BytesColumnVector inputColumn, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - int row = selection[i]; - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(inputColumn.vector[row], - inputColumn.start[row], - inputColumn.length[row]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - BytesColumnVector inputColumn, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - BytesColumnVector inputColumn, - int batchSize, - int[] selection) { - - for (int i=0; i < batchSize; ++i) { - int row = selection[i]; - if (!inputColumn.isNull[row]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(inputColumn.vector[row], - inputColumn.start[row], - inputColumn.length[row]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - BytesColumnVector inputColumn, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - if (!inputColumn.isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - BytesColumnVector inputColumn = (BytesColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - if (inputColumn.isRepeating) { - if (inputColumn.noNulls) { - myagg.checkValue(inputColumn.vector[0], - inputColumn.start[0], - inputColumn.length[0]); - } - return; - } - - if (!batch.selectedInUse && inputColumn.noNulls) { - iterateNoSelectionNoNulls(myagg, inputColumn, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, inputColumn, batchSize); - } - else if (inputColumn.noNulls){ - iterateSelectionNoNulls(myagg, inputColumn, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, inputColumn, batchSize, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - BytesColumnVector inputColumn, - int batchSize, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!inputColumn.isNull[i]) { - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - BytesColumnVector inputColumn, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - BytesColumnVector inputColumn, - int batchSize) { - - for (int i=0; i< batchSize; ++i) { - if (!inputColumn.isNull[i]) { - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - BytesColumnVector inputColumn, - int batchSize) { - for (int i=0; i< batchSize; ++i) { - myagg.checkValue(inputColumn.vector[i], - inputColumn.start[i], - inputColumn.length[i]); - } - } - - @Override - public AggregationBuffer getNewAggregationBuffer() throws HiveException { - return new Aggregation(); - } - - @Override - public void reset(AggregationBuffer agg) throws HiveException { - Aggregation myAgg = (Aggregation) agg; - myAgg.isNull = true; - } - - @Override - public Object evaluateOutput( - AggregationBuffer agg) throws HiveException { - Aggregation myagg = (Aggregation) agg; - if (myagg.isNull) { - return null; - } - else { - result.set(myagg.bytes, 0, myagg.length); - return result; - } - } - - @Override - public ObjectInspector getOutputObjectInspector() { - return PrimitiveObjectInspectorFactory.writableStringObjectInspector; - } - - @Override - public int getAggregationBufferFixedSize() { - JavaDataModel model = JavaDataModel.get(); - return JavaDataModel.alignUp( - model.object() + - model.ref()+ - model.primitive1()*2, - model.memoryAlign()); - } - - @Override - public boolean hasVariableSize() { - return true; - } - - @Override - public void init(AggregationDesc desc) throws HiveException { - // No-op - } - - public VectorExpression getInputExpression() { - return inputExpression; - } - - public void setInputExpression(VectorExpression inputExpression) { - this.inputExpression = inputExpression; - } -} - diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMinDouble.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMinDouble.java deleted file mode 100644 index dd2f63c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/aggregates/gen/VectorUDAFMinDouble.java +++ /dev/null @@ -1,441 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.gen; - -import org.apache.hadoop.hive.ql.exec.Description; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.aggregates.VectorAggregateExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriter; -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpressionWriterFactory; -import org.apache.hadoop.hive.ql.exec.vector.VectorAggregationBufferRow; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.metadata.HiveException; -import org.apache.hadoop.hive.ql.plan.AggregationDesc; -import org.apache.hadoop.hive.ql.util.JavaDataModel; -import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; - -/** -* VectorUDAFMinDouble. Vectorized implementation for MIN/MAX aggregates. -*/ -@Description(name = "min", - value = "_FUNC_(expr) - Returns the minimum value of expr (vectorized, type: double)") -public class VectorUDAFMinDouble extends VectorAggregateExpression { - - private static final long serialVersionUID = 1L; - - /** - * class for storing the current aggregate value. - */ - static private final class Aggregation implements AggregationBuffer { - - private static final long serialVersionUID = 1L; - - transient private double value; - transient private boolean isNull; - - public void checkValue(double value) { - if (isNull) { - isNull = false; - this.value = value; - } else if (value < this.value) { - this.value = value; - } - } - - @Override - public int getVariableSize() { - throw new UnsupportedOperationException(); - } - } - - private VectorExpression inputExpression; - private transient VectorExpressionWriter resultWriter; - - public VectorUDAFMinDouble(VectorExpression inputExpression) { - this(); - this.inputExpression = inputExpression; - } - - public VectorUDAFMinDouble() { - super(); - } - - @Override - public void init(AggregationDesc desc) throws HiveException { - resultWriter = VectorExpressionWriterFactory.genVectorExpressionWritable( - desc.getParameters().get(0)); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); - return myagg; - } - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - VectorizedRowBatch batch) throws HiveException { - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - double[] vector = inputVector.vector; - - if (inputVector.noNulls) { - if (inputVector.isRepeating) { - iterateNoNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize); - } else { - if (batch.selectedInUse) { - iterateNoNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batch.selected, batchSize); - } else { - iterateNoNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize); - } - } - } else { - if (inputVector.isRepeating) { - if (batch.selectedInUse) { - iterateHasNullsRepeatingSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsRepeatingWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector[0], batchSize, inputVector.isNull); - } - } else { - if (batch.selectedInUse) { - iterateHasNullsSelectionWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, batch.selected, inputVector.isNull); - } else { - iterateHasNullsWithAggregationSelection( - aggregationBufferSets, aggregrateIndex, - vector, batchSize, inputVector.isNull); - } - } - } - } - - private void iterateNoNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - private void iterateNoNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int[] selection, - int batchSize) { - - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[selection[i]]); - } - } - - private void iterateNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize) { - for (int i=0; i < batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - - private void iterateHasNullsRepeatingSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[selection[i]]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - - } - - private void iterateHasNullsRepeatingWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double value, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(value); - } - } - } - - private void iterateHasNullsSelectionWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize, - int[] selection, - boolean[] isNull) { - - for (int j=0; j < batchSize; ++j) { - int i = selection[j]; - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - j); - myagg.checkValue(values[i]); - } - } - } - - private void iterateHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregrateIndex, - double[] values, - int batchSize, - boolean[] isNull) { - - for (int i=0; i < batchSize; ++i) { - if (!isNull[i]) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregrateIndex, - i); - myagg.checkValue(values[i]); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls && - (myagg.isNull || (vector[0] < myagg.value))) { - myagg.isNull = false; - myagg.value = vector[0]; - } - return; - } - - if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.isNull = false; - myagg.value = value; - } - else if (value < myagg.value) { - myagg.value = value; - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.value = vector[selected[0]]; - myagg.isNull = false; - } - - for (int i=0; i< batchSize; ++i) { - double value = vector[selected[i]]; - if (value < myagg.value) { - myagg.value = value; - } - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - DoubleColumnVector inputVector = (DoubleColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - double[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - double[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - double[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i foi = new ArrayList(); - foi.add(PrimitiveObjectInspectorFactory.writableLongObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - foi.add(PrimitiveObjectInspectorFactory.writableDoubleObjectInspector); - - List fname = new ArrayList(); - fname.add("count"); - fname.add("sum"); - fname.add("variance"); - - soi = ObjectInspectorFactory.getStandardStructObjectInspector(fname, foi); - } - - private Aggregation getCurrentAggregationBuffer( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - int row) { - VectorAggregationBufferRow mySet = aggregationBufferSets[row]; - Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); - return myagg; - } - - - @Override - public void aggregateInputSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - VectorizedRowBatch batch) throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls || !inputVector.isNull[0]) { - iterateRepeatingNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNullsWithAggregationSelection( - aggregationBufferSets, aggregateIndex, vector, batchSize, - inputVector.isNull, batch.selected); - } - - } - - private void iterateRepeatingNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - double value, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull, - int[] selected) { - - for (int j=0; j< batchSize; ++j) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - j); - int i = selected[j]; - if (!isNull[i]) { - double value = vector[i]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - int[] selected) { - - for (int i=0; i< batchSize; ++i) { - Aggregation myagg = getCurrentAggregationBuffer( - aggregationBufferSets, - aggregateIndex, - i); - double value = vector[selected[i]]; - if (myagg.isNull) { - myagg.init (); - } - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - private void iterateNoSelectionHasNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNullsWithAggregationSelection( - VectorAggregationBufferRow[] aggregationBufferSets, - int aggregateIndex, - long[] vector, - int batchSize) { - - for (int i=0; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - - @Override - public void aggregateInput(AggregationBuffer agg, VectorizedRowBatch batch) - throws HiveException { - - inputExpression.evaluate(batch); - - LongColumnVector inputVector = (LongColumnVector)batch. - cols[this.inputExpression.getOutputColumn()]; - - int batchSize = batch.size; - - if (batchSize == 0) { - return; - } - - Aggregation myagg = (Aggregation)agg; - - long[] vector = inputVector.vector; - - if (inputVector.isRepeating) { - if (inputVector.noNulls) { - iterateRepeatingNoNulls(myagg, vector[0], batchSize); - } - } - else if (!batch.selectedInUse && inputVector.noNulls) { - iterateNoSelectionNoNulls(myagg, vector, batchSize); - } - else if (!batch.selectedInUse) { - iterateNoSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull); - } - else if (inputVector.noNulls){ - iterateSelectionNoNulls(myagg, vector, batchSize, batch.selected); - } - else { - iterateSelectionHasNulls(myagg, vector, batchSize, inputVector.isNull, batch.selected); - } - } - - private void iterateRepeatingNoNulls( - Aggregation myagg, - double value, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - // TODO: conjure a formula w/o iterating - // - - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // We pulled out i=0 so we can remove the count > 1 check in the loop - for (int i=1; i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize, - int[] selected) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[selected[0]]; - myagg.sum += value; - myagg.count += 1; - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove the count > 1 check in the loop - // - for (int i=1; i< batchSize; ++i) { - value = vector[selected[i]]; - myagg.sum += value; - myagg.count += 1; - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - - private void iterateNoSelectionHasNulls( - Aggregation myagg, - long[] vector, - int batchSize, - boolean[] isNull) { - - for(int i=0;i 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - } - } - } - - private void iterateNoSelectionNoNulls( - Aggregation myagg, - long[] vector, - int batchSize) { - - if (myagg.isNull) { - myagg.init (); - } - - double value = vector[0]; - myagg.sum += value; - myagg.count += 1; - - if(myagg.count > 1) { - double t = myagg.count*value - myagg.sum; - myagg.variance += (t*t) / ((double)myagg.count*(myagg.count-1)); - } - - // i=0 was pulled out to remove count > 1 check - for (int i=1; i value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] > value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] > value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] > value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] > value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] > value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColGreaterEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColGreaterEqualDoubleScalar.java deleted file mode 100644 index 382cbf4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColGreaterEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class DoubleColGreaterEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColGreaterEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColGreaterEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] >= value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] >= value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] >= value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessDoubleScalar.java deleted file mode 100644 index 3c325c5..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class DoubleColLessDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColLessDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColLessDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] < value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] < value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] < value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] < value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] < value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] < value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessEqualDoubleScalar.java deleted file mode 100644 index c72ea39..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColLessEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class DoubleColLessEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColLessEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColLessEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] <= value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] <= value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] <= value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleColumn.java deleted file mode 100644 index d473e21..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColModuloDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColModuloDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColModuloDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] % vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] % vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleScalar.java deleted file mode 100644 index 8552d74..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColModuloDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColModuloDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColModuloDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] % value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongColumn.java deleted file mode 100644 index 3bdd44b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColModuloLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColModuloLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColModuloLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] % vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] % vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongScalar.java deleted file mode 100644 index f08840b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColModuloLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColModuloLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public DoubleColModuloLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColModuloLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] % value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleColumn.java deleted file mode 100644 index 8f03c45..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColMultiplyDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColMultiplyDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColMultiplyDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] * vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] * vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleScalar.java deleted file mode 100644 index 65699e4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColMultiplyDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColMultiplyDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColMultiplyDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] * value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongColumn.java deleted file mode 100644 index a2d8b54..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColMultiplyLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColMultiplyLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColMultiplyLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] * vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] * vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongScalar.java deleted file mode 100644 index 5b2f83f..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColMultiplyLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColMultiplyLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public DoubleColMultiplyLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColMultiplyLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] * value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColNotEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColNotEqualDoubleScalar.java deleted file mode 100644 index cf9865a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColNotEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class DoubleColNotEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColNotEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColNotEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] != value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] != value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] != value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] != value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] != value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] != value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleColumn.java deleted file mode 100644 index c244b3f..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColSubtractDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColSubtractDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColSubtractDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] - vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] - vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleScalar.java deleted file mode 100644 index 44eb4ad..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColSubtractDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleColSubtractDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColSubtractDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] - value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongColumn.java deleted file mode 100644 index ae2680b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class DoubleColSubtractLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public DoubleColSubtractLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public DoubleColSubtractLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] - vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] - vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongScalar.java deleted file mode 100644 index 926d058..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColSubtractLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class DoubleColSubtractLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public DoubleColSubtractLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleColSubtractLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] - value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColUnaryMinus.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColUnaryMinus.java deleted file mode 100644 index b85e0db..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleColUnaryMinus.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnUnaryMinus.txt, which covers unary negation operator. - */ -public class DoubleColUnaryMinus extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private int outputColumn; - - public DoubleColUnaryMinus(int colNum, int outputColumn) { - this.colNum = colNum; - this.outputColumn = outputColumn; - } - - public DoubleColUnaryMinus() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - this.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = - vector[0]; - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - outputColVector.isRepeating = true; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = -vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = -vector[i]; - } - } - outputColVector.isRepeating = false; - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = -vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = -vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - outputColVector.isRepeating = false; - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddDoubleColumn.java deleted file mode 100644 index a19fd70..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarAddDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarAddDoubleColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarAddDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value + vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddLongColumn.java deleted file mode 100644 index 7532108..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarAddLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarAddLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarAddLongColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarAddLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value + vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideDoubleColumn.java deleted file mode 100644 index 039dc13..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarDivideDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarDivideDoubleColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarDivideDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value / vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideLongColumn.java deleted file mode 100644 index 123b29a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarDivideLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarDivideLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarDivideLongColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarDivideLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value / vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloDoubleColumn.java deleted file mode 100644 index a1579b6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarModuloDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarModuloDoubleColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarModuloDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value % vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloLongColumn.java deleted file mode 100644 index a82d119..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarModuloLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarModuloLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarModuloLongColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarModuloLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value % vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyDoubleColumn.java deleted file mode 100644 index 057053a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarMultiplyDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarMultiplyDoubleColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarMultiplyDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value * vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyLongColumn.java deleted file mode 100644 index d63c1b2..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarMultiplyLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarMultiplyLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarMultiplyLongColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarMultiplyLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value * vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractDoubleColumn.java deleted file mode 100644 index 1ad37ad..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarSubtractDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarSubtractDoubleColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarSubtractDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value - vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractLongColumn.java deleted file mode 100644 index 3d400ce..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/DoubleScalarSubtractLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class DoubleScalarSubtractLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public DoubleScalarSubtractLongColumn(double value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public DoubleScalarSubtractLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value - vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleColumn.java deleted file mode 100644 index 42fc749..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] == vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleScalar.java deleted file mode 100644 index ef39934..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] == value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongColumn.java deleted file mode 100644 index 4f86edd..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] == vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongScalar.java deleted file mode 100644 index ce31971..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] == value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleColumn.java deleted file mode 100644 index 89b7faa..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColGreaterDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColGreaterDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] > vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleScalar.java deleted file mode 100644 index cfdd90b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColGreaterDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColGreaterDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] > value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleColumn.java deleted file mode 100644 index 50edb47..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColGreaterEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColGreaterEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] >= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleScalar.java deleted file mode 100644 index a735bdb..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColGreaterEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColGreaterEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongColumn.java deleted file mode 100644 index 78c0f65..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColGreaterEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColGreaterEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] >= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongScalar.java deleted file mode 100644 index 399e449..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColGreaterEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColGreaterEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongColumn.java deleted file mode 100644 index 7e009e4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColGreaterLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColGreaterLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] > vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongScalar.java deleted file mode 100644 index 1c560af..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColGreaterLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColGreaterLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColGreaterLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColGreaterLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] > value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleColumn.java deleted file mode 100644 index 10bc9f3..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColLessDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColLessDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] < vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleScalar.java deleted file mode 100644 index af71f8c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColLessDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColLessDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] < value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleColumn.java deleted file mode 100644 index a59f756..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColLessEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColLessEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] <= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleScalar.java deleted file mode 100644 index ae4eac1..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColLessEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColLessEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongColumn.java deleted file mode 100644 index acb795c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColLessEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColLessEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] <= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongScalar.java deleted file mode 100644 index 00db007..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColLessEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColLessEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongColumn.java deleted file mode 100644 index ec9f40a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColLessLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColLessLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] < vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongScalar.java deleted file mode 100644 index 6bf0977..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColLessLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColLessLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColLessLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColLessLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] < value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleColumn.java deleted file mode 100644 index 4d92a93..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColNotEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColNotEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColNotEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] != vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleScalar.java deleted file mode 100644 index 0bcded4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColNotEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleColNotEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColNotEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] != value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongColumn.java deleted file mode 100644 index 1975198..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColNotEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterDoubleColNotEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterDoubleColNotEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector1 = (DoubleColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - double[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] != vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongScalar.java deleted file mode 100644 index 429c293..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleColNotEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleColNotEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterDoubleColNotEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleColNotEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] != value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualDoubleColumn.java deleted file mode 100644 index 275d5bd..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarEqualDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value == vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualLongColumn.java deleted file mode 100644 index 438a50c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarEqualLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value == vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterDoubleColumn.java deleted file mode 100644 index ee8d91e..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarGreaterDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarGreaterDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarGreaterDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value > vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualDoubleColumn.java deleted file mode 100644 index a90d58c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarGreaterEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarGreaterEqualDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarGreaterEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualLongColumn.java deleted file mode 100644 index 3d2a7e8..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarGreaterEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarGreaterEqualLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarGreaterEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterLongColumn.java deleted file mode 100644 index 6739131..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarGreaterLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarGreaterLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarGreaterLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarGreaterLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value > vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessDoubleColumn.java deleted file mode 100644 index 5c58bc8..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarLessDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarLessDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarLessDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value < vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualDoubleColumn.java deleted file mode 100644 index 424b6be..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarLessEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarLessEqualDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarLessEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualLongColumn.java deleted file mode 100644 index 3d6da1a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarLessEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarLessEqualLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarLessEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessLongColumn.java deleted file mode 100644 index b44079e..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarLessLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarLessLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarLessLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarLessLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value < vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualDoubleColumn.java deleted file mode 100644 index 81a2325..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarNotEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarNotEqualDoubleColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarNotEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value != vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualLongColumn.java deleted file mode 100644 index 672ddf1..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterDoubleScalarNotEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterDoubleScalarNotEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterDoubleScalarNotEqualLongColumn(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterDoubleScalarNotEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value != vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleColumn.java deleted file mode 100644 index dc8b7e9..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] == vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleScalar.java deleted file mode 100644 index 58b5a27..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] == value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongColumn.java deleted file mode 100644 index 570d43b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] == vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] == vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] == vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongScalar.java deleted file mode 100644 index 45809f5..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] == value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] == value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] == value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleColumn.java deleted file mode 100644 index 83f78cd..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColGreaterDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColGreaterDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] > vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleScalar.java deleted file mode 100644 index 82ffcd8..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColGreaterDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColGreaterDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] > value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleColumn.java deleted file mode 100644 index 03e4241..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColGreaterEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColGreaterEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] >= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleScalar.java deleted file mode 100644 index e71a072..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColGreaterEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColGreaterEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java deleted file mode 100644 index 37a64e2..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColGreaterEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColGreaterEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] >= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] >= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] >= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongScalar.java deleted file mode 100644 index a66da97..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColGreaterEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColGreaterEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] >= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] >= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java deleted file mode 100644 index 5b2704a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColGreaterLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColGreaterLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] > vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] > vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] > vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongScalar.java deleted file mode 100644 index efc6761..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColGreaterLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColGreaterLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColGreaterLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColGreaterLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] > value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] > value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] > value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java deleted file mode 100644 index 5d1f79c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColLessDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColLessDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] < vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleScalar.java deleted file mode 100644 index 25fc9c6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColLessDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColLessDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] < value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java deleted file mode 100644 index f810ba6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColLessEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColLessEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] <= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleScalar.java deleted file mode 100644 index 1dddfdc..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColLessEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColLessEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java deleted file mode 100644 index d431ef2..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColLessEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColLessEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] <= vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] <= vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] <= vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongScalar.java deleted file mode 100644 index ec64720..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColLessEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColLessEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] <= value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] <= value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java deleted file mode 100644 index 4db136c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColLessLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColLessLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] < vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] < vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] < vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongScalar.java deleted file mode 100644 index 860c403..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColLessLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColLessLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColLessLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColLessLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] < value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] < value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] < value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java deleted file mode 100644 index 70f658e..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColNotEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColNotEqualDoubleColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColNotEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] != vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleScalar.java deleted file mode 100644 index f4227f6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualDoubleScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColNotEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - - public FilterLongColNotEqualDoubleScalar(int colNum, double value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColNotEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] != value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java deleted file mode 100644 index 9cf02ea..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareColumn.txt, which covers binary comparison - * expressions between two columns, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColNotEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterLongColNotEqualLongColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterLongColNotEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector1[0] != vector2[0])) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0]) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (vector1[0] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - } else { - if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (vector1[i] != vector2[0]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (vector1[i] != vector2[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongScalar.java deleted file mode 100644 index 14e73b9..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongColNotEqualLongScalar.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongColNotEqualLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongColNotEqualLongScalar(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongColNotEqualLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (vector[i] != value) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(vector[0] != value)) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (vector[i] != value) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualDoubleColumn.java deleted file mode 100644 index 1dbabe9..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarEqualDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value == vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualLongColumn.java deleted file mode 100644 index c3a0ee4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarEqualLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value == vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value == vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value == vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterDoubleColumn.java deleted file mode 100644 index 9f1c414..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarGreaterDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarGreaterDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarGreaterDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value > vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualDoubleColumn.java deleted file mode 100644 index 4efa21e..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarGreaterEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarGreaterEqualDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarGreaterEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualLongColumn.java deleted file mode 100644 index 65f8d98..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarGreaterEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarGreaterEqualLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarGreaterEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value >= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value >= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterLongColumn.java deleted file mode 100644 index a62b16b..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarGreaterLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarGreaterLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarGreaterLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarGreaterLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value > vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value > vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value > vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessDoubleColumn.java deleted file mode 100644 index 22fac3d..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarLessDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarLessDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarLessDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value < vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualDoubleColumn.java deleted file mode 100644 index 772e001..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarLessEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarLessEqualDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarLessEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualLongColumn.java deleted file mode 100644 index e8f49a9..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarLessEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarLessEqualLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarLessEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value <= vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value <= vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessLongColumn.java deleted file mode 100644 index d31bd96..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarLessLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarLessLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarLessLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarLessLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value < vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value < vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value < vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualDoubleColumn.java deleted file mode 100644 index cf62b5d..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualDoubleColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarNotEqualDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarNotEqualDoubleColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarNotEqualDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - double[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value != vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualLongColumn.java deleted file mode 100644 index a8b02f9..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterLongScalarNotEqualLongColumn.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template FilterScalarCompareColumn.txt, which covers binary comparison - * expressions between a scalar and a column, however output is not produced in a separate column. - * The selected vector of the input {@link VectorizedRowBatch} is updated for in-place filtering. - */ -public class FilterLongScalarNotEqualLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - - public FilterLongScalarNotEqualLongColumn(int colNum, long value) { - this.colNum = colNum; - this.value = value; - } - - public FilterLongScalarNotEqualLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (value != vector[i]) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - if (!(value != vector[0])) { - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (value != vector[i]) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringColumn.java deleted file mode 100644 index 89906a6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColEqualStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) == 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) == 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) == 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) == 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringScalar.java deleted file mode 100644 index 08d2b5a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColEqualStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a == comparison on a vector of strings. - */ -public class FilterStringColEqualStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColEqualStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColEqualStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) == 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) == 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) == 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) == 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringColumn.java deleted file mode 100644 index 3380964..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColGreaterEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColGreaterEqualStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColGreaterEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) >= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) >= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) >= 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) >= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringScalar.java deleted file mode 100644 index bc4bc02..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterEqualStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a >= comparison on a vector of strings. - */ -public class FilterStringColGreaterEqualStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColGreaterEqualStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColGreaterEqualStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) >= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) >= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) >= 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringColumn.java deleted file mode 100644 index 8f728d2..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColGreaterStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColGreaterStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColGreaterStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) > 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) > 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) > 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) > 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringScalar.java deleted file mode 100644 index 7093c31..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColGreaterStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a > comparison on a vector of strings. - */ -public class FilterStringColGreaterStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColGreaterStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColGreaterStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) > 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) > 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) > 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) > 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringColumn.java deleted file mode 100644 index 8f74388..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColLessEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColLessEqualStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColLessEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) <= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) <= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) <= 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) <= 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringScalar.java deleted file mode 100644 index 452e563..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessEqualStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a <= comparison on a vector of strings. - */ -public class FilterStringColLessEqualStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColLessEqualStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColLessEqualStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) <= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) <= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) <= 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringColumn.java deleted file mode 100644 index c087781..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColLessStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColLessStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColLessStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) < 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) < 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) < 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) < 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringScalar.java deleted file mode 100644 index 900d81a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColLessStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a < comparison on a vector of strings. - */ -public class FilterStringColLessStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColLessStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColLessStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) < 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) < 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) < 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) < 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringColumn.java deleted file mode 100644 index 520d2d8..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringColumn.java +++ /dev/null @@ -1,477 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Filter the rows in a batch by comparing one string column to another. - * This code is generated from a template. - */ -public class FilterStringColNotEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - - public FilterStringColNotEqualStringColumn(int colNum1, int colNum2) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - } - - public FilterStringColNotEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - BytesColumnVector inputColVector1 = (BytesColumnVector) batch.cols[colNum1]; - BytesColumnVector inputColVector2 = (BytesColumnVector) batch.cols[colNum2]; - int[] sel = batch.selected; - boolean[] nullPos1 = inputColVector1.isNull; - boolean[] nullPos2 = inputColVector2.isNull; - int n = batch.size; - byte[][] vector1 = inputColVector1.vector; - byte[][] vector2 = inputColVector2.vector; - int[] start1 = inputColVector1.start; - int[] start2 = inputColVector2.start; - int[] length1 = inputColVector1.length; - int[] length2 = inputColVector2.length; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - // handle case where neither input has nulls - if (inputColVector1.noNulls && inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - - /* Either all must remain selected or all will be eliminated. - * Repeating property will not change. - */ - if (!(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) != 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - - // handle case where only input 2 has nulls - } else if (inputColVector1.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) != 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - - // no need to check for nulls in input 1 - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - - // no values will qualify because every comparison will be with NULL - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where only input 1 has nulls - } else if (inputColVector2.noNulls) { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) != 0)) { - batch.size = 0; - return; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - - // if repeating value is null then every comparison will fail so nothing qualifies - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - - // handle case where both inputs have nulls - } else { - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - if (nullPos1[0] || nullPos2[0] || - !(StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[0], start2[0], length2[0]) != 0)) { - batch.size = 0; - } - } else if (inputColVector1.isRepeating) { - if (nullPos1[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos2[i]) { - if (StringExpr.compare(vector1[0], start1[0], length1[0], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else if (inputColVector2.isRepeating) { - if (nullPos2[0]) { - batch.size = 0; - return; - } - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[0], start2[0], length2[0]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { // neither input is repeating - if (batch.selectedInUse) { - int newSize = 0; - for(int j = 0; j != n; j++) { - int i = sel[j]; - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos1[i] && !nullPos2[i]) { - if (StringExpr.compare(vector1[i], start1[i], length1[i], - vector2[i], start2[i], length2[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < batch.size) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - } - - @Override - public String getOutputType() { - return "boolean"; - } - - @Override - public int getOutputColumn() { - return -1; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringScalar.java deleted file mode 100644 index f5a2e19..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringColNotEqualStringScalar.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a != comparison on a vector of strings. - */ -public class FilterStringColNotEqualStringScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringColNotEqualStringScalar(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringColNotEqualStringScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) != 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) != 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(vector[0], start[0], length[0], value, 0, value.length) != 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) != 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(vector[i], start[i], length[i], value, 0, value.length) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarEqualStringColumn.java deleted file mode 100644 index 32727e5..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarEqualStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a == comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarEqualStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) == 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) == 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) == 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) == 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) == 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) == 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterEqualStringColumn.java deleted file mode 100644 index bb45d12..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterEqualStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a >= comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarGreaterEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarGreaterEqualStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarGreaterEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) >= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) >= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) >= 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) >= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) >= 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) >= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterStringColumn.java deleted file mode 100644 index 069f2a7..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarGreaterStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a > comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarGreaterStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarGreaterStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarGreaterStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) > 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) > 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) > 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) > 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) > 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) > 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessEqualStringColumn.java deleted file mode 100644 index 115f5c5..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessEqualStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a <= comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarLessEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarLessEqualStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarLessEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) <= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) <= 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) <= 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) <= 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) <= 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) <= 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessStringColumn.java deleted file mode 100644 index 19b6627..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarLessStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a < comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarLessStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarLessStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarLessStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) < 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) < 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) < 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) < 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) < 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) < 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarNotEqualStringColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarNotEqualStringColumn.java deleted file mode 100644 index e9db4ce..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/FilterStringScalarNotEqualStringColumn.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.StringExpr; -import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * This is a generated class to evaluate a != comparison on a vector of strings. - * Do not edit the generated code directly. - */ -public class FilterStringScalarNotEqualStringColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private byte[] value; - - public FilterStringScalarNotEqualStringColumn(int colNum, byte[] value) { - this.colNum = colNum; - this.value = value; - } - - public FilterStringScalarNotEqualStringColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - if (childExpressions != null) { - super.evaluateChildren(batch); - } - BytesColumnVector inputColVector = (BytesColumnVector) batch.cols[colNum]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - int n = batch.size; - byte[][] vector = inputColVector.vector; - int[] length = inputColVector.length; - int[] start = inputColVector.start; - - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) != 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) != 0) { - sel[newSize++] = i; - } - } - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) != 0) { - sel[newSize++] = i; - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } else { - if (inputColVector.isRepeating) { - - // All must be selected otherwise size would be zero. Repeating property will not change. - if (!nullPos[0]) { - if (!(StringExpr.compare(value, 0, value.length, vector[0], start[0], length[0]) != 0)) { - - //Entire batch is filtered out. - batch.size = 0; - } - } else { - batch.size = 0; - } - } else if (batch.selectedInUse) { - int newSize = 0; - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) != 0) { - sel[newSize++] = i; - } - } - } - - //Change the selected vector - batch.size = newSize; - } else { - int newSize = 0; - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - if (StringExpr.compare(value, 0, value.length, vector[i], start[i], length[i]) != 0) { - sel[newSize++] = i; - } - } - } - if (newSize < n) { - batch.size = newSize; - batch.selectedInUse = true; - } - } - } - } - - @Override - public int getOutputColumn() { - return -1; - } - - @Override - public String getOutputType() { - return "boolean"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public byte[] getValue() { - return value; - } - - public void setValue(byte[] value) { - this.value = value; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java deleted file mode 100644 index d208d6c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColAddDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColAddDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColAddDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] + vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] + vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] + vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] + vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] + vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] + vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] + vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleScalar.java deleted file mode 100644 index f264624..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColAddDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColAddDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColAddDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] + value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] + value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] + value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] + value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] + value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java deleted file mode 100644 index 4feff6f..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColAddLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColAddLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColAddLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] + vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] + vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] + vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] + vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] + vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] + vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] + vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesLong(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongScalar.java deleted file mode 100644 index 1031e8c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColAddLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColAddLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongColAddLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColAddLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] + value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] + value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] + value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] + value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] + value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java deleted file mode 100644 index 4cb3d8a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColDivideDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColDivideDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColDivideDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] / vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] / vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] / vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] / vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] / vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] / vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] / vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleScalar.java deleted file mode 100644 index 9c57c99..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColDivideDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColDivideDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColDivideDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColDivideDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] / value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] / value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] / value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] / value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] / value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColEqualDoubleScalar.java deleted file mode 100644 index c322f1a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] == value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] == value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] == value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] == value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] == value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] == value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterDoubleScalar.java deleted file mode 100644 index ae327f3..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColGreaterDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColGreaterDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColGreaterDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] > value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] > value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] > value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] > value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] > value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] > value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterEqualDoubleScalar.java deleted file mode 100644 index 6d3d19f..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColGreaterEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColGreaterEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColGreaterEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColGreaterEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] >= value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] >= value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] >= value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] >= value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessDoubleScalar.java deleted file mode 100644 index 5c322b0..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColLessDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColLessDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColLessDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] < value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] < value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] < value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] < value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] < value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] < value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessEqualDoubleScalar.java deleted file mode 100644 index eece809..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColLessEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColLessEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColLessEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColLessEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] <= value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] <= value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] <= value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] <= value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleColumn.java deleted file mode 100644 index 8828199..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColModuloDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColModuloDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColModuloDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] % vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] % vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleScalar.java deleted file mode 100644 index 4858d9c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColModuloDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColModuloDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColModuloDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] % value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongColumn.java deleted file mode 100644 index 161f256..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColModuloLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColModuloLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColModuloLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] % vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] % vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] % vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] % vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesLong(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongScalar.java deleted file mode 100644 index fb17419..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColModuloLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColModuloLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongColModuloLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColModuloLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] % value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] % value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] % value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleColumn.java deleted file mode 100644 index c9981bb..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColMultiplyDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColMultiplyDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColMultiplyDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] * vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] * vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleScalar.java deleted file mode 100644 index 269b89a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColMultiplyDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColMultiplyDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColMultiplyDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] * value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongColumn.java deleted file mode 100644 index 40f9dab..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColMultiplyLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColMultiplyLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColMultiplyLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] * vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] * vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] * vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] * vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesLong(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongScalar.java deleted file mode 100644 index 5ba9523..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColMultiplyLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColMultiplyLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongColMultiplyLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColMultiplyLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] * value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] * value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] * value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColNotEqualDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColNotEqualDoubleScalar.java deleted file mode 100644 index 938bcaa..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColNotEqualDoubleScalar.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnCompareScalar.txt, which covers binary comparison - * expressions between a column and a scalar. The boolean output is stored in a - * separate boolean column. - */ -public class LongColNotEqualDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColNotEqualDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColNotEqualDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] nullPos = inputColVector.isNull; - boolean[] outNulls = outputColVector.isNull; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = false; - outputColVector.noNulls = inputColVector.noNulls; - if (inputColVector.noNulls) { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = vector[0] != value ? 1 : 0; - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] != value ? 1 : 0; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] != value ? 1 : 0; - } - } - } else { - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - if (!nullPos[0]) { - outputVector[0] = vector[0] != value ? 1 : 0; - outNulls[0] = false; - } else { - outNulls[0] = true; - } - outputColVector.isRepeating = true; - } else if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - if (!nullPos[i]) { - outputVector[i] = vector[i] != value ? 1 : 0; - outNulls[i] = false; - } else { - //comparison with null is null - outNulls[i] = true; - } - } - } else { - System.arraycopy(nullPos, 0, outNulls, 0, n); - for(int i = 0; i != n; i++) { - if (!nullPos[i]) { - outputVector[i] = vector[i] != value ? 1 : 0; - } - } - } - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleColumn.java deleted file mode 100644 index c54ac35..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColSubtractDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColSubtractDoubleColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColSubtractDoubleColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - DoubleColumnVector inputColVector2 = (DoubleColumnVector) batch.cols[colNum2]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - double[] vector2 = inputColVector2.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] - vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] - vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesDouble(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleScalar.java deleted file mode 100644 index 68caab5..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractDoubleScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColSubtractDoubleScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private double value; - private int outputColumn; - - public LongColSubtractDoubleScalar(int colNum, double value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColSubtractDoubleScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] - value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongColumn.java deleted file mode 100644 index 13c132f..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongColumn.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnArithmeticColumn.txt, which covers binary arithmetic - * expressions between columns. - */ -public class LongColSubtractLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum1; - private int colNum2; - private int outputColumn; - - public LongColSubtractLongColumn(int colNum1, int colNum2, int outputColumn) { - this.colNum1 = colNum1; - this.colNum2 = colNum2; - this.outputColumn = outputColumn; - } - - public LongColSubtractLongColumn() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector1 = (LongColumnVector) batch.cols[colNum1]; - LongColumnVector inputColVector2 = (LongColumnVector) batch.cols[colNum2]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - int n = batch.size; - long[] vector1 = inputColVector1.vector; - long[] vector2 = inputColVector2.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - outputColVector.isRepeating = - inputColVector1.isRepeating && inputColVector2.isRepeating - || inputColVector1.isRepeating && !inputColVector1.noNulls && inputColVector1.isNull[0] - || inputColVector2.isRepeating && !inputColVector2.noNulls && inputColVector2.isNull[0]; - - // Handle nulls first - NullUtil.propagateNullsColCol( - inputColVector1, inputColVector2, outputColVector, sel, n, batch.selectedInUse); - - /* Disregard nulls for processing. In other words, - * the arithmetic operation is performed even if one or - * more inputs are null. This is to improve speed by avoiding - * conditional checks in the inner loop. - */ - if (inputColVector1.isRepeating && inputColVector2.isRepeating) { - outputVector[0] = vector1[0] - vector2[0]; - } else if (inputColVector1.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[0] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[0] - vector2[i]; - } - } - } else if (inputColVector2.isRepeating) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[0]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[0]; - } - } - } else { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector1[i] - vector2[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector1[i] - vector2[i]; - } - } - } - - /* For the case when the output can have null values, follow - * the convention that the data values must be 1 for long and - * NaN for double. This is to prevent possible later zero-divide errors - * in complex arithmetic expressions like col2 / (col1 - 1) - * in the case when some col1 entries are null. - */ - NullUtil.setNullDataEntriesLong(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum1() { - return colNum1; - } - - public void setColNum1(int colNum1) { - this.colNum1 = colNum1; - } - - public int getColNum2() { - return colNum2; - } - - public void setColNum2(int colNum2) { - this.colNum2 = colNum2; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongScalar.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongScalar.java deleted file mode 100644 index 019f9e6..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColSubtractLongScalar.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ColumnArithmeticScalar.txt, which covers binary arithmetic - * expressions between a column and a scalar. - */ -public class LongColSubtractLongScalar extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongColSubtractLongScalar(int colNum, long value, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongColSubtractLongScalar() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = vector[0] - value; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - } - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = vector[i] - value; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = vector[i] - value; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColUnaryMinus.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColUnaryMinus.java deleted file mode 100644 index e0805f4..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongColUnaryMinus.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; -import org.apache.hadoop.hive.ql.exec.vector.*; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; - -/** - * Generated from template ColumnUnaryMinus.txt, which covers unary negation operator. - */ -public class LongColUnaryMinus extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private int outputColumn; - - public LongColUnaryMinus(int colNum, int outputColumn) { - this.colNum = colNum; - this.outputColumn = outputColumn; - } - - public LongColUnaryMinus() { - } - - @Override - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - this.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - //All must be selected otherwise size would be zero - //Repeating property will not change. - outputVector[0] = - vector[0]; - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - outputColVector.isRepeating = true; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = -vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = -vector[i]; - } - } - outputColVector.isRepeating = false; - } else /* there are nulls */ { - if (batch.selectedInUse) { - for(int j=0; j != n; j++) { - int i = sel[j]; - outputVector[i] = -vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = -vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - outputColVector.isRepeating = false; - } - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddDoubleColumn.java deleted file mode 100644 index e499340..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarAddDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarAddDoubleColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarAddDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value + vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddLongColumn.java deleted file mode 100644 index db1fcd3..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarAddLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarAddLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarAddLongColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarAddLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value + vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value + vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value + vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarDivideDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarDivideDoubleColumn.java deleted file mode 100644 index 83b91c7..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarDivideDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarDivideDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarDivideDoubleColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarDivideDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value / vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value / vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value / vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloDoubleColumn.java deleted file mode 100644 index 435525c..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarModuloDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarModuloDoubleColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarModuloDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value % vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloLongColumn.java deleted file mode 100644 index 6623f8a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarModuloLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarModuloLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarModuloLongColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarModuloLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value % vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value % vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value % vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyDoubleColumn.java deleted file mode 100644 index 8a53343..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarMultiplyDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarMultiplyDoubleColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarMultiplyDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value * vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyLongColumn.java deleted file mode 100644 index 437136d..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarMultiplyLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarMultiplyLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarMultiplyLongColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarMultiplyLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value * vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value * vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value * vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractDoubleColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractDoubleColumn.java deleted file mode 100644 index da9b22a..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractDoubleColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarSubtractDoubleColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarSubtractDoubleColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarSubtractDoubleColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - DoubleColumnVector inputColVector = (DoubleColumnVector) batch.cols[colNum]; - DoubleColumnVector outputColVector = (DoubleColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - double[] vector = inputColVector.vector; - double[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value - vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "double"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractLongColumn.java ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractLongColumn.java deleted file mode 100644 index 8f4a50d..0000000 --- ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/LongScalarSubtractLongColumn.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; - -/* - * Because of the templatized nature of the code, either or both - * of these ColumnVector imports may be needed. Listing both of them - * rather than using ....vectorization.*; - */ -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; - -/** - * Generated from template ScalarArithmeticColumn.txt. - * Implements a vectorized arithmetic operator with a scalar on the left and a - * column vector on the right. The result is output to an output column vector. - */ -public class LongScalarSubtractLongColumn extends VectorExpression { - - private static final long serialVersionUID = 1L; - - private int colNum; - private long value; - private int outputColumn; - - public LongScalarSubtractLongColumn(long value, int colNum, int outputColumn) { - this.colNum = colNum; - this.value = value; - this.outputColumn = outputColumn; - } - - public LongScalarSubtractLongColumn() { - } - - @Override - /** - * Method to evaluate scalar-column operation in vectorized fashion. - * - * @batch a package of rows with each column stored in a vector - */ - public void evaluate(VectorizedRowBatch batch) { - - if (childExpressions != null) { - super.evaluateChildren(batch); - } - - LongColumnVector inputColVector = (LongColumnVector) batch.cols[colNum]; - LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumn]; - int[] sel = batch.selected; - boolean[] inputIsNull = inputColVector.isNull; - boolean[] outputIsNull = outputColVector.isNull; - outputColVector.noNulls = inputColVector.noNulls; - outputColVector.isRepeating = inputColVector.isRepeating; - int n = batch.size; - long[] vector = inputColVector.vector; - long[] outputVector = outputColVector.vector; - - // return immediately if batch is empty - if (n == 0) { - return; - } - - if (inputColVector.isRepeating) { - outputVector[0] = value - vector[0]; - - // Even if there are no nulls, we always copy over entry 0. Simplifies code. - outputIsNull[0] = inputIsNull[0]; - } else if (inputColVector.noNulls) { - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - } - } else { /* there are nulls */ - if (batch.selectedInUse) { - for(int j = 0; j != n; j++) { - int i = sel[j]; - outputVector[i] = value - vector[i]; - outputIsNull[i] = inputIsNull[i]; - } - } else { - for(int i = 0; i != n; i++) { - outputVector[i] = value - vector[i]; - } - System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); - } - } - - NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); - } - - @Override - public int getOutputColumn() { - return outputColumn; - } - - @Override - public String getOutputType() { - return "long"; - } - - public int getColNum() { - return colNum; - } - - public void setColNum(int colNum) { - this.colNum = colNum; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - this.value = value; - } - - public void setOutputColumn(int outputColumn) { - this.outputColumn = outputColumn; - } - -} diff --git ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java deleted file mode 100644 index fb52bd0..0000000 --- ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java +++ /dev/null @@ -1,6524 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import static org.junit.Assert.assertEquals; -import java.util.Random; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.util.VectorizedRowGroupGenUtil; -import org.junit.Test; - - -/** - * - * TestColumnColumnFilterVectorExpressionEvaluation. - * - */ -public class TestColumnColumnFilterVectorExpressionEvaluation{ - - private static final int BATCH_SIZE = 100; - private static final long SEED = 0xfa57; - - - @Test - public void testFilterLongColEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualDoubleColumn vectorExpression = - new FilterLongColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualDoubleColumn vectorExpression = - new FilterLongColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualDoubleColumn vectorExpression = - new FilterLongColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualDoubleColumn vectorExpression = - new FilterLongColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualDoubleColumn vectorExpression = - new FilterLongColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualDoubleColumn vectorExpression = - new FilterDoubleColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualDoubleColumn vectorExpression = - new FilterDoubleColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualDoubleColumn vectorExpression = - new FilterDoubleColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualDoubleColumn vectorExpression = - new FilterDoubleColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualDoubleColumn vectorExpression = - new FilterDoubleColEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualDoubleColumn vectorExpression = - new FilterLongColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualDoubleColumn vectorExpression = - new FilterLongColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualDoubleColumn vectorExpression = - new FilterLongColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualDoubleColumn vectorExpression = - new FilterLongColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualDoubleColumn vectorExpression = - new FilterLongColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualDoubleColumn vectorExpression = - new FilterDoubleColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualDoubleColumn vectorExpression = - new FilterDoubleColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualDoubleColumn vectorExpression = - new FilterDoubleColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualDoubleColumn vectorExpression = - new FilterDoubleColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualDoubleColumn vectorExpression = - new FilterDoubleColNotEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessDoubleColumn vectorExpression = - new FilterLongColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessDoubleColumn vectorExpression = - new FilterLongColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessDoubleColumn vectorExpression = - new FilterLongColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessDoubleColumn vectorExpression = - new FilterLongColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessDoubleColumn vectorExpression = - new FilterLongColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessDoubleColumn vectorExpression = - new FilterDoubleColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessDoubleColumn vectorExpression = - new FilterDoubleColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessDoubleColumn vectorExpression = - new FilterDoubleColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessDoubleColumn vectorExpression = - new FilterDoubleColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessDoubleColumn vectorExpression = - new FilterDoubleColLessDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualDoubleColumn vectorExpression = - new FilterLongColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualDoubleColumn vectorExpression = - new FilterLongColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualDoubleColumn vectorExpression = - new FilterLongColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualDoubleColumn vectorExpression = - new FilterLongColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualDoubleColumn vectorExpression = - new FilterLongColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualDoubleColumn vectorExpression = - new FilterDoubleColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualDoubleColumn vectorExpression = - new FilterDoubleColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualDoubleColumn vectorExpression = - new FilterDoubleColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualDoubleColumn vectorExpression = - new FilterDoubleColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualDoubleColumn vectorExpression = - new FilterDoubleColLessEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterDoubleColumn vectorExpression = - new FilterLongColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterDoubleColumn vectorExpression = - new FilterLongColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterDoubleColumn vectorExpression = - new FilterLongColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterDoubleColumn vectorExpression = - new FilterLongColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterDoubleColumn vectorExpression = - new FilterLongColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterDoubleColumn vectorExpression = - new FilterDoubleColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterDoubleColumn vectorExpression = - new FilterDoubleColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterDoubleColumn vectorExpression = - new FilterDoubleColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterDoubleColumn vectorExpression = - new FilterDoubleColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterDoubleColumn vectorExpression = - new FilterDoubleColGreaterDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualDoubleColumn vectorExpression = - new FilterLongColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualDoubleColumn vectorExpression = - new FilterLongColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualDoubleColumn vectorExpression = - new FilterLongColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualDoubleColumn vectorExpression = - new FilterLongColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualDoubleColumn vectorExpression = - new FilterLongColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleColGreaterEqualDoubleColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualLongColumn vectorExpression = - new FilterLongColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualLongColumn vectorExpression = - new FilterLongColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualLongColumn vectorExpression = - new FilterLongColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualLongColumn vectorExpression = - new FilterLongColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColEqualLongColumn vectorExpression = - new FilterLongColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualLongColumn vectorExpression = - new FilterDoubleColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualLongColumn vectorExpression = - new FilterDoubleColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualLongColumn vectorExpression = - new FilterDoubleColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualLongColumn vectorExpression = - new FilterDoubleColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColEqualLongColumn vectorExpression = - new FilterDoubleColEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] == inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "==" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualLongColumn vectorExpression = - new FilterLongColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualLongColumn vectorExpression = - new FilterLongColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualLongColumn vectorExpression = - new FilterLongColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualLongColumn vectorExpression = - new FilterLongColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColNotEqualLongColumn vectorExpression = - new FilterLongColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualLongColumn vectorExpression = - new FilterDoubleColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualLongColumn vectorExpression = - new FilterDoubleColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualLongColumn vectorExpression = - new FilterDoubleColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualLongColumn vectorExpression = - new FilterDoubleColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColNotEqualLongColumn vectorExpression = - new FilterDoubleColNotEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] != inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "!=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessLongColumn vectorExpression = - new FilterLongColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessLongColumn vectorExpression = - new FilterLongColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessLongColumn vectorExpression = - new FilterLongColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessLongColumn vectorExpression = - new FilterLongColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessLongColumn vectorExpression = - new FilterLongColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessLongColumn vectorExpression = - new FilterDoubleColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessLongColumn vectorExpression = - new FilterDoubleColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessLongColumn vectorExpression = - new FilterDoubleColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessLongColumn vectorExpression = - new FilterDoubleColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessLongColumn vectorExpression = - new FilterDoubleColLessLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] < inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualLongColumn vectorExpression = - new FilterLongColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualLongColumn vectorExpression = - new FilterLongColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualLongColumn vectorExpression = - new FilterLongColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualLongColumn vectorExpression = - new FilterLongColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColLessEqualLongColumn vectorExpression = - new FilterLongColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualLongColumn vectorExpression = - new FilterDoubleColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualLongColumn vectorExpression = - new FilterDoubleColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualLongColumn vectorExpression = - new FilterDoubleColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualLongColumn vectorExpression = - new FilterDoubleColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColLessEqualLongColumn vectorExpression = - new FilterDoubleColLessEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] <= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + "<=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterLongColumn vectorExpression = - new FilterLongColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterLongColumn vectorExpression = - new FilterLongColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterLongColumn vectorExpression = - new FilterLongColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterLongColumn vectorExpression = - new FilterLongColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterLongColumn vectorExpression = - new FilterLongColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterLongColumn vectorExpression = - new FilterDoubleColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterLongColumn vectorExpression = - new FilterDoubleColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterLongColumn vectorExpression = - new FilterDoubleColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterLongColumn vectorExpression = - new FilterDoubleColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterLongColumn vectorExpression = - new FilterDoubleColGreaterLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] > inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualLongColumn vectorExpression = - new FilterLongColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualLongColumn vectorExpression = - new FilterLongColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualLongColumn vectorExpression = - new FilterLongColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualLongColumn vectorExpression = - new FilterLongColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterLongColGreaterEqualLongColumn vectorExpression = - new FilterLongColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongColumnC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualLongColumn vectorExpression = - new FilterDoubleColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualLongColumn vectorExpression = - new FilterDoubleColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongColumnC1NullsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualLongColumn vectorExpression = - new FilterDoubleColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongColumnC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualLongColumn vectorExpression = - new FilterDoubleColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongColumnC1NullsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - - FilterDoubleColGreaterEqualLongColumn vectorExpression = - new FilterDoubleColGreaterEqualLongColumn(0, 1); - - vectorExpression.evaluate(rowBatch); - - int selectedIndex = 0; - for(int i = 0; i < BATCH_SIZE; i++) { - //null vector is safe to check, as it is always initialized to match the data vector - if(!inputColumnVector1.isNull[i] && !inputColumnVector2.isNull[i]) { - if(inputColumnVector1.vector[i] >= inputColumnVector2.vector[i]) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector1.vector[i] + ">=" - + inputColumnVector2.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - -} - - diff --git ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnOperationVectorExpressionEvaluation.java ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnOperationVectorExpressionEvaluation.java deleted file mode 100644 index 65caba0..0000000 --- ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnOperationVectorExpressionEvaluation.java +++ /dev/null @@ -1,5630 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import static org.junit.Assert.assertEquals; -import java.util.Random; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.util.VectorizedRowGroupGenUtil; -import org.junit.Test; - - -/** - * - * TestColumnColumnOperationVectorExpressionEvaluation. - * - */ -public class TestColumnColumnOperationVectorExpressionEvaluation{ - - private static final int BATCH_SIZE = 100; - private static final long SEED = 0xfa57; - - - @Test - public void testLongColAddLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddLongColumn vectorExpression = - new LongColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractLongColumn vectorExpression = - new LongColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyLongColumn vectorExpression = - new LongColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloLongColumn vectorExpression = - new LongColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColAddDoubleColumn vectorExpression = - new LongColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColSubtractDoubleColumn vectorExpression = - new LongColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColMultiplyDoubleColumn vectorExpression = - new LongColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColDivideDoubleColumn vectorExpression = - new LongColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - LongColModuloDoubleColumn vectorExpression = - new LongColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddLongColumn vectorExpression = - new DoubleColAddLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractLongColumn vectorExpression = - new DoubleColSubtractLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyLongColumn vectorExpression = - new DoubleColMultiplyLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideLongColumn vectorExpression = - new DoubleColDivideLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloLongColumn vectorExpression = - new DoubleColModuloLongColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColAddDoubleColumn vectorExpression = - new DoubleColAddDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColSubtractDoubleColumn vectorExpression = - new DoubleColSubtractDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColMultiplyDoubleColumn vectorExpression = - new DoubleColMultiplyDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColDivideDoubleColumn vectorExpression = - new DoubleColDivideDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnOutNullsRepeatsC1RepeatsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnC1Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnOutNullsC1NullsC2NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnOutNullsRepeatsC1NullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnC1RepeatsC2Nulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleColumnOutRepeatsC2Repeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector1 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector2 = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(3, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector1; - rowBatch.cols[1] = inputColumnVector2; - rowBatch.cols[2] = outputColumnVector; - - DoubleColModuloDoubleColumn vectorExpression = - new DoubleColModuloDoubleColumn(0, 1, 2); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector repeating state does not match operand columns", - (!inputColumnVector1.noNulls && inputColumnVector1.isRepeating) - || (!inputColumnVector2.noNulls && inputColumnVector2.isRepeating) - || inputColumnVector1.isRepeating && inputColumnVector2.isRepeating, - outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand columns", - inputColumnVector1.noNulls && inputColumnVector2.noNulls, outputColumnVector.noNulls); - - //if repeating, only the first value matters - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vectors' is null state for index", - inputColumnVector1.isNull[i] || inputColumnVector2.isNull[i], - outputColumnVector.isNull[i]); - } - } - } - - -} - - diff --git ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarFilterVectorExpressionEvaluation.java ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarFilterVectorExpressionEvaluation.java deleted file mode 100644 index 103985e..0000000 --- ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarFilterVectorExpressionEvaluation.java +++ /dev/null @@ -1,12140 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import static org.junit.Assert.assertEquals; -import java.util.Random; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.util.VectorizedRowGroupGenUtil; -import org.junit.Test; - - -/** - * - * TestColumnScalarFilterVectorExpressionEvaluation. - * - */ -public class TestColumnScalarFilterVectorExpressionEvaluation{ - - private static final int BATCH_SIZE = 100; - private static final long SEED = 0xfa57; - - - @Test - public void testFilterLongColEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColEqualDoubleScalar vectorExpression = - new FilterLongColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColEqualDoubleScalar vectorExpression = - new FilterLongColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColEqualDoubleScalar vectorExpression = - new FilterLongColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColEqualDoubleScalar vectorExpression = - new FilterLongColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColEqualDoubleScalar vectorExpression = - new FilterDoubleColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColEqualDoubleScalar vectorExpression = - new FilterDoubleColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColEqualDoubleScalar vectorExpression = - new FilterDoubleColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColEqualDoubleScalar vectorExpression = - new FilterDoubleColEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColNotEqualDoubleScalar vectorExpression = - new FilterLongColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColNotEqualDoubleScalar vectorExpression = - new FilterLongColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColNotEqualDoubleScalar vectorExpression = - new FilterLongColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColNotEqualDoubleScalar vectorExpression = - new FilterLongColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualDoubleScalar vectorExpression = - new FilterDoubleColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualDoubleScalar vectorExpression = - new FilterDoubleColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualDoubleScalar vectorExpression = - new FilterDoubleColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualDoubleScalar vectorExpression = - new FilterDoubleColNotEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessDoubleScalar vectorExpression = - new FilterLongColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessDoubleScalar vectorExpression = - new FilterLongColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessDoubleScalar vectorExpression = - new FilterLongColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessDoubleScalar vectorExpression = - new FilterLongColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessDoubleScalar vectorExpression = - new FilterDoubleColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessDoubleScalar vectorExpression = - new FilterDoubleColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessDoubleScalar vectorExpression = - new FilterDoubleColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessDoubleScalar vectorExpression = - new FilterDoubleColLessDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessEqualDoubleScalar vectorExpression = - new FilterLongColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessEqualDoubleScalar vectorExpression = - new FilterLongColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessEqualDoubleScalar vectorExpression = - new FilterLongColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColLessEqualDoubleScalar vectorExpression = - new FilterLongColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualDoubleScalar vectorExpression = - new FilterDoubleColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualDoubleScalar vectorExpression = - new FilterDoubleColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualDoubleScalar vectorExpression = - new FilterDoubleColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualDoubleScalar vectorExpression = - new FilterDoubleColLessEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterDoubleScalar vectorExpression = - new FilterLongColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterDoubleScalar vectorExpression = - new FilterLongColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterDoubleScalar vectorExpression = - new FilterLongColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterDoubleScalar vectorExpression = - new FilterLongColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterDoubleScalar vectorExpression = - new FilterDoubleColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterDoubleScalar vectorExpression = - new FilterDoubleColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterDoubleScalar vectorExpression = - new FilterDoubleColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterDoubleScalar vectorExpression = - new FilterDoubleColGreaterDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualDoubleScalar vectorExpression = - new FilterLongColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualDoubleScalar vectorExpression = - new FilterLongColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualDoubleScalar vectorExpression = - new FilterLongColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualDoubleScalar vectorExpression = - new FilterLongColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualDoubleScalar vectorExpression = - new FilterDoubleColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualDoubleScalar vectorExpression = - new FilterDoubleColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualDoubleScalar vectorExpression = - new FilterDoubleColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualDoubleScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualDoubleScalar vectorExpression = - new FilterDoubleColGreaterEqualDoubleScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColEqualLongScalar vectorExpression = - new FilterLongColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColEqualLongScalar vectorExpression = - new FilterLongColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColEqualLongScalar vectorExpression = - new FilterLongColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColEqualLongScalar vectorExpression = - new FilterLongColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColEqualLongScalar vectorExpression = - new FilterDoubleColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColEqualLongScalar vectorExpression = - new FilterDoubleColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColEqualLongScalar vectorExpression = - new FilterDoubleColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColEqualLongScalar vectorExpression = - new FilterDoubleColEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] == scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] == scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "==" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColNotEqualLongScalar vectorExpression = - new FilterLongColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColNotEqualLongScalar vectorExpression = - new FilterLongColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColNotEqualLongScalar vectorExpression = - new FilterLongColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColNotEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColNotEqualLongScalar vectorExpression = - new FilterLongColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualLongScalar vectorExpression = - new FilterDoubleColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualLongScalar vectorExpression = - new FilterDoubleColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualLongScalar vectorExpression = - new FilterDoubleColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColNotEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColNotEqualLongScalar vectorExpression = - new FilterDoubleColNotEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] != scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] != scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "!=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessLongScalar vectorExpression = - new FilterLongColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessLongScalar vectorExpression = - new FilterLongColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessLongScalar vectorExpression = - new FilterLongColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessLongScalar vectorExpression = - new FilterLongColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessLongScalar vectorExpression = - new FilterDoubleColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessLongScalar vectorExpression = - new FilterDoubleColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessLongScalar vectorExpression = - new FilterDoubleColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessLongScalar vectorExpression = - new FilterDoubleColLessLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] < scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] < scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessEqualLongScalar vectorExpression = - new FilterLongColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessEqualLongScalar vectorExpression = - new FilterLongColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessEqualLongScalar vectorExpression = - new FilterLongColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColLessEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColLessEqualLongScalar vectorExpression = - new FilterLongColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualLongScalar vectorExpression = - new FilterDoubleColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualLongScalar vectorExpression = - new FilterDoubleColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualLongScalar vectorExpression = - new FilterDoubleColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColLessEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColLessEqualLongScalar vectorExpression = - new FilterDoubleColLessEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] <= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] <= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + "<=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterLongScalar vectorExpression = - new FilterLongColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterLongScalar vectorExpression = - new FilterLongColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterLongScalar vectorExpression = - new FilterLongColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterLongScalar vectorExpression = - new FilterLongColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterLongScalar vectorExpression = - new FilterDoubleColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterLongScalar vectorExpression = - new FilterDoubleColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterLongScalar vectorExpression = - new FilterDoubleColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterLongScalar vectorExpression = - new FilterDoubleColGreaterLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] > scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] > scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualLongScalar vectorExpression = - new FilterLongColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualLongScalar vectorExpression = - new FilterLongColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualLongScalar vectorExpression = - new FilterLongColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongColGreaterEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongColGreaterEqualLongScalar vectorExpression = - new FilterLongColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongScalarColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualLongScalar vectorExpression = - new FilterDoubleColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongScalarColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualLongScalar vectorExpression = - new FilterDoubleColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualLongScalar vectorExpression = - new FilterDoubleColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleColGreaterEqualLongScalarColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterDoubleColGreaterEqualLongScalar vectorExpression = - new FilterDoubleColGreaterEqualLongScalar(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && inputColumnVector.vector[i] >= scalarValue - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(inputColumnVector.vector[i] >= scalarValue) { - assertEquals( - "Vector index that passes filter " - + inputColumnVector.vector[i] + ">=" - + scalarValue + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualDoubleColumn vectorExpression = - new FilterLongScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualDoubleColumn vectorExpression = - new FilterLongScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualDoubleColumn vectorExpression = - new FilterLongScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualDoubleColumn vectorExpression = - new FilterLongScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualDoubleColumn vectorExpression = - new FilterDoubleScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualDoubleColumn vectorExpression = - new FilterDoubleScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualDoubleColumn vectorExpression = - new FilterDoubleScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualDoubleColumn vectorExpression = - new FilterDoubleScalarEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualDoubleColumn vectorExpression = - new FilterLongScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualDoubleColumn vectorExpression = - new FilterLongScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualDoubleColumn vectorExpression = - new FilterLongScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualDoubleColumn vectorExpression = - new FilterLongScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualDoubleColumn vectorExpression = - new FilterDoubleScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualDoubleColumn vectorExpression = - new FilterDoubleScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualDoubleColumn vectorExpression = - new FilterDoubleScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualDoubleColumn vectorExpression = - new FilterDoubleScalarNotEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessDoubleColumn vectorExpression = - new FilterLongScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessDoubleColumn vectorExpression = - new FilterLongScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessDoubleColumn vectorExpression = - new FilterLongScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessDoubleColumn vectorExpression = - new FilterLongScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessDoubleColumn vectorExpression = - new FilterDoubleScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessDoubleColumn vectorExpression = - new FilterDoubleScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessDoubleColumn vectorExpression = - new FilterDoubleScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessDoubleColumn vectorExpression = - new FilterDoubleScalarLessDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualDoubleColumn vectorExpression = - new FilterLongScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualDoubleColumn vectorExpression = - new FilterLongScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualDoubleColumn vectorExpression = - new FilterLongScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualDoubleColumn vectorExpression = - new FilterLongScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualDoubleColumn vectorExpression = - new FilterDoubleScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualDoubleColumn vectorExpression = - new FilterDoubleScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualDoubleColumn vectorExpression = - new FilterDoubleScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualDoubleColumn vectorExpression = - new FilterDoubleScalarLessEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterDoubleColumn vectorExpression = - new FilterLongScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterDoubleColumn vectorExpression = - new FilterLongScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterDoubleColumn vectorExpression = - new FilterLongScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterDoubleColumn vectorExpression = - new FilterLongScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualDoubleColumn vectorExpression = - new FilterLongScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualDoubleColumn vectorExpression = - new FilterLongScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualDoubleColumn vectorExpression = - new FilterLongScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualDoubleColumn vectorExpression = - new FilterLongScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualDoubleColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualDoubleColumnColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualDoubleColumnColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualDoubleColumn vectorExpression = - new FilterDoubleScalarGreaterEqualDoubleColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualLongColumn vectorExpression = - new FilterLongScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualLongColumn vectorExpression = - new FilterLongScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualLongColumn vectorExpression = - new FilterLongScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarEqualLongColumn vectorExpression = - new FilterLongScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualLongColumn vectorExpression = - new FilterDoubleScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualLongColumn vectorExpression = - new FilterDoubleScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualLongColumn vectorExpression = - new FilterDoubleScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarEqualLongColumn vectorExpression = - new FilterDoubleScalarEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue == inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue == inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "==" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualLongColumn vectorExpression = - new FilterLongScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualLongColumn vectorExpression = - new FilterLongScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualLongColumn vectorExpression = - new FilterLongScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarNotEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarNotEqualLongColumn vectorExpression = - new FilterLongScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualLongColumn vectorExpression = - new FilterDoubleScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualLongColumn vectorExpression = - new FilterDoubleScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualLongColumn vectorExpression = - new FilterDoubleScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarNotEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarNotEqualLongColumn vectorExpression = - new FilterDoubleScalarNotEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue != inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue != inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "!=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessLongColumn vectorExpression = - new FilterLongScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessLongColumn vectorExpression = - new FilterLongScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessLongColumn vectorExpression = - new FilterLongScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessLongColumn vectorExpression = - new FilterLongScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessLongColumn vectorExpression = - new FilterDoubleScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessLongColumn vectorExpression = - new FilterDoubleScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessLongColumn vectorExpression = - new FilterDoubleScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessLongColumn vectorExpression = - new FilterDoubleScalarLessLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue < inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue < inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualLongColumn vectorExpression = - new FilterLongScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualLongColumn vectorExpression = - new FilterLongScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualLongColumn vectorExpression = - new FilterLongScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarLessEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarLessEqualLongColumn vectorExpression = - new FilterLongScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualLongColumn vectorExpression = - new FilterDoubleScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualLongColumn vectorExpression = - new FilterDoubleScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualLongColumn vectorExpression = - new FilterDoubleScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarLessEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarLessEqualLongColumn vectorExpression = - new FilterDoubleScalarLessEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue <= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue <= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + "<=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterLongColumn vectorExpression = - new FilterLongScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterLongColumn vectorExpression = - new FilterLongScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterLongColumn vectorExpression = - new FilterLongScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterLongColumn vectorExpression = - new FilterLongScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterLongColumn vectorExpression = - new FilterDoubleScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterLongColumn vectorExpression = - new FilterDoubleScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterLongColumn vectorExpression = - new FilterDoubleScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterLongColumn vectorExpression = - new FilterDoubleScalarGreaterLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue > inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue > inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualLongColumn vectorExpression = - new FilterLongScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualLongColumn vectorExpression = - new FilterLongScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualLongColumn vectorExpression = - new FilterLongScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterLongScalarGreaterEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - FilterLongScalarGreaterEqualLongColumn vectorExpression = - new FilterLongScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualLongColumnColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualLongColumn vectorExpression = - new FilterDoubleScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualLongColumnColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualLongColumn vectorExpression = - new FilterDoubleScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualLongColumn vectorExpression = - new FilterDoubleScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - @Test - public void testFilterDoubleScalarGreaterEqualLongColumnColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(1, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - FilterDoubleScalarGreaterEqualLongColumn vectorExpression = - new FilterDoubleScalarGreaterEqualLongColumn(0, scalarValue); - - vectorExpression.evaluate(rowBatch); - - - int selectedIndex = 0; - int i=0; - //check for isRepeating optimization - if(inputColumnVector.isRepeating) { - //null vector is safe to check, as it is always initialized to match the data vector - selectedIndex = - !inputColumnVector.isNull[i] && scalarValue >= inputColumnVector.vector[i] - ? BATCH_SIZE : 0; - } else { - for(i = 0; i < BATCH_SIZE; i++) { - if(!inputColumnVector.isNull[i]) { - if(scalarValue >= inputColumnVector.vector[i]) { - assertEquals( - "Vector index that passes filter " - + scalarValue + ">=" - + inputColumnVector.vector[i] + " is not in rowBatch selected index", - i, - rowBatch.selected[selectedIndex]); - selectedIndex++; - } - } - } - } - - assertEquals("Row batch size not set to number of selected rows: " + selectedIndex, - selectedIndex, rowBatch.size); - - if(selectedIndex > 0 && selectedIndex < BATCH_SIZE) { - assertEquals( - "selectedInUse should be set when > 0 and < entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - true, rowBatch.selectedInUse); - } else if(selectedIndex == BATCH_SIZE) { - assertEquals( - "selectedInUse should not be set when entire batch(" + BATCH_SIZE + ") is selected: " - + selectedIndex, - false, rowBatch.selectedInUse); - } - } - - -} - - diff --git ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarOperationVectorExpressionEvaluation.java ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarOperationVectorExpressionEvaluation.java deleted file mode 100644 index be0176e..0000000 --- ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnScalarOperationVectorExpressionEvaluation.java +++ /dev/null @@ -1,11044 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.hive.ql.exec.vector.expressions.gen; - -import static org.junit.Assert.assertEquals; -import java.util.Random; -import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; -import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; -import org.apache.hadoop.hive.ql.exec.vector.util.VectorizedRowGroupGenUtil; -import org.junit.Test; - - -/** - * - * TestColumnScalarOperationVectorExpressionEvaluation. - * - */ -public class TestColumnScalarOperationVectorExpressionEvaluation{ - - private static final int BATCH_SIZE = 100; - private static final long SEED = 0xfa57; - - - @Test - public void testLongColAddLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColAddLongScalar vectorExpression = - new LongColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColAddLongScalar vectorExpression = - new LongColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColAddLongScalar vectorExpression = - new LongColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColAddLongScalar vectorExpression = - new LongColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColAddLongScalar vectorExpression = - new LongColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColSubtractLongScalar vectorExpression = - new LongColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColSubtractLongScalar vectorExpression = - new LongColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColSubtractLongScalar vectorExpression = - new LongColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColSubtractLongScalar vectorExpression = - new LongColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColSubtractLongScalar vectorExpression = - new LongColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColMultiplyLongScalar vectorExpression = - new LongColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColMultiplyLongScalar vectorExpression = - new LongColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColMultiplyLongScalar vectorExpression = - new LongColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColMultiplyLongScalar vectorExpression = - new LongColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColMultiplyLongScalar vectorExpression = - new LongColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColModuloLongScalar vectorExpression = - new LongColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColModuloLongScalar vectorExpression = - new LongColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColModuloLongScalar vectorExpression = - new LongColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColModuloLongScalar vectorExpression = - new LongColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongColModuloLongScalar vectorExpression = - new LongColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColAddDoubleScalar vectorExpression = - new LongColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColAddDoubleScalar vectorExpression = - new LongColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColAddDoubleScalar vectorExpression = - new LongColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColAddDoubleScalar vectorExpression = - new LongColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColAddDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColAddDoubleScalar vectorExpression = - new LongColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColSubtractDoubleScalar vectorExpression = - new LongColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColSubtractDoubleScalar vectorExpression = - new LongColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColSubtractDoubleScalar vectorExpression = - new LongColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColSubtractDoubleScalar vectorExpression = - new LongColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColSubtractDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColSubtractDoubleScalar vectorExpression = - new LongColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColMultiplyDoubleScalar vectorExpression = - new LongColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColMultiplyDoubleScalar vectorExpression = - new LongColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColMultiplyDoubleScalar vectorExpression = - new LongColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColMultiplyDoubleScalar vectorExpression = - new LongColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColMultiplyDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColMultiplyDoubleScalar vectorExpression = - new LongColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColDivideDoubleScalar vectorExpression = - new LongColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColDivideDoubleScalar vectorExpression = - new LongColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColDivideDoubleScalar vectorExpression = - new LongColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColDivideDoubleScalar vectorExpression = - new LongColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColDivideDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColDivideDoubleScalar vectorExpression = - new LongColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColModuloDoubleScalar vectorExpression = - new LongColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColModuloDoubleScalar vectorExpression = - new LongColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColModuloDoubleScalar vectorExpression = - new LongColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColModuloDoubleScalar vectorExpression = - new LongColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColModuloDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColModuloDoubleScalar vectorExpression = - new LongColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColAddLongScalar vectorExpression = - new DoubleColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColAddLongScalar vectorExpression = - new DoubleColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColAddLongScalar vectorExpression = - new DoubleColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColAddLongScalar vectorExpression = - new DoubleColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColAddLongScalar vectorExpression = - new DoubleColAddLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColSubtractLongScalar vectorExpression = - new DoubleColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColSubtractLongScalar vectorExpression = - new DoubleColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColSubtractLongScalar vectorExpression = - new DoubleColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColSubtractLongScalar vectorExpression = - new DoubleColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColSubtractLongScalar vectorExpression = - new DoubleColSubtractLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColMultiplyLongScalar vectorExpression = - new DoubleColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColMultiplyLongScalar vectorExpression = - new DoubleColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColMultiplyLongScalar vectorExpression = - new DoubleColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColMultiplyLongScalar vectorExpression = - new DoubleColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColMultiplyLongScalar vectorExpression = - new DoubleColMultiplyLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColDivideLongScalar vectorExpression = - new DoubleColDivideLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColDivideLongScalar vectorExpression = - new DoubleColDivideLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColDivideLongScalar vectorExpression = - new DoubleColDivideLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColDivideLongScalar vectorExpression = - new DoubleColDivideLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColDivideLongScalar vectorExpression = - new DoubleColDivideLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColModuloLongScalar vectorExpression = - new DoubleColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColModuloLongScalar vectorExpression = - new DoubleColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColModuloLongScalar vectorExpression = - new DoubleColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColModuloLongScalar vectorExpression = - new DoubleColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloLongScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - DoubleColModuloLongScalar vectorExpression = - new DoubleColModuloLongScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColAddDoubleScalar vectorExpression = - new DoubleColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColAddDoubleScalar vectorExpression = - new DoubleColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColAddDoubleScalar vectorExpression = - new DoubleColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColAddDoubleScalar vectorExpression = - new DoubleColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColAddDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColAddDoubleScalar vectorExpression = - new DoubleColAddDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColSubtractDoubleScalar vectorExpression = - new DoubleColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColSubtractDoubleScalar vectorExpression = - new DoubleColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColSubtractDoubleScalar vectorExpression = - new DoubleColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColSubtractDoubleScalar vectorExpression = - new DoubleColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColSubtractDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColSubtractDoubleScalar vectorExpression = - new DoubleColSubtractDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColMultiplyDoubleScalar vectorExpression = - new DoubleColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColMultiplyDoubleScalar vectorExpression = - new DoubleColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColMultiplyDoubleScalar vectorExpression = - new DoubleColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColMultiplyDoubleScalar vectorExpression = - new DoubleColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColMultiplyDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColMultiplyDoubleScalar vectorExpression = - new DoubleColMultiplyDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColDivideDoubleScalar vectorExpression = - new DoubleColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColDivideDoubleScalar vectorExpression = - new DoubleColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColDivideDoubleScalar vectorExpression = - new DoubleColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColDivideDoubleScalar vectorExpression = - new DoubleColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColDivideDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColDivideDoubleScalar vectorExpression = - new DoubleColDivideDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColModuloDoubleScalar vectorExpression = - new DoubleColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleScalar() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColModuloDoubleScalar vectorExpression = - new DoubleColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColModuloDoubleScalar vectorExpression = - new DoubleColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColModuloDoubleScalar vectorExpression = - new DoubleColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColModuloDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColModuloDoubleScalar vectorExpression = - new DoubleColModuloDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddLongColumn vectorExpression = - new LongScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddLongColumn vectorExpression = - new LongScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddLongColumn vectorExpression = - new LongScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddLongColumn vectorExpression = - new LongScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddLongColumn vectorExpression = - new LongScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractLongColumn vectorExpression = - new LongScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractLongColumn vectorExpression = - new LongScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractLongColumn vectorExpression = - new LongScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractLongColumn vectorExpression = - new LongScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractLongColumn vectorExpression = - new LongScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyLongColumn vectorExpression = - new LongScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyLongColumn vectorExpression = - new LongScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyLongColumn vectorExpression = - new LongScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyLongColumn vectorExpression = - new LongScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyLongColumn vectorExpression = - new LongScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloLongColumn vectorExpression = - new LongScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloLongColumn() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloLongColumn vectorExpression = - new LongScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloLongColumn vectorExpression = - new LongScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloLongColumn vectorExpression = - new LongScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloLongColumn vectorExpression = - new LongScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddDoubleColumn vectorExpression = - new LongScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddDoubleColumn vectorExpression = - new LongScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddDoubleColumn vectorExpression = - new LongScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddDoubleColumn vectorExpression = - new LongScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarAddDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarAddDoubleColumn vectorExpression = - new LongScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractDoubleColumn vectorExpression = - new LongScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractDoubleColumn vectorExpression = - new LongScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractDoubleColumn vectorExpression = - new LongScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractDoubleColumn vectorExpression = - new LongScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarSubtractDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarSubtractDoubleColumn vectorExpression = - new LongScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyDoubleColumn vectorExpression = - new LongScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyDoubleColumn vectorExpression = - new LongScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyDoubleColumn vectorExpression = - new LongScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyDoubleColumn vectorExpression = - new LongScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarMultiplyDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarMultiplyDoubleColumn vectorExpression = - new LongScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarDivideDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarDivideDoubleColumn vectorExpression = - new LongScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarDivideDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarDivideDoubleColumn vectorExpression = - new LongScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarDivideDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarDivideDoubleColumn vectorExpression = - new LongScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarDivideDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarDivideDoubleColumn vectorExpression = - new LongScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarDivideDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarDivideDoubleColumn vectorExpression = - new LongScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloDoubleColumn vectorExpression = - new LongScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloDoubleColumn vectorExpression = - new LongScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloDoubleColumn vectorExpression = - new LongScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloDoubleColumn vectorExpression = - new LongScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongScalarModuloDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - long scalarValue = 0; - do { - scalarValue = rand.nextLong(); - } while(scalarValue == 0); - - LongScalarModuloDoubleColumn vectorExpression = - new LongScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddLongColumn vectorExpression = - new DoubleScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddLongColumn vectorExpression = - new DoubleScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddLongColumn vectorExpression = - new DoubleScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddLongColumn vectorExpression = - new DoubleScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddLongColumn vectorExpression = - new DoubleScalarAddLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractLongColumn vectorExpression = - new DoubleScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractLongColumn vectorExpression = - new DoubleScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractLongColumn vectorExpression = - new DoubleScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractLongColumn vectorExpression = - new DoubleScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractLongColumn vectorExpression = - new DoubleScalarSubtractLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyLongColumn vectorExpression = - new DoubleScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyLongColumn vectorExpression = - new DoubleScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyLongColumn vectorExpression = - new DoubleScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyLongColumn vectorExpression = - new DoubleScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyLongColumn vectorExpression = - new DoubleScalarMultiplyLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideLongColumn vectorExpression = - new DoubleScalarDivideLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideLongColumn vectorExpression = - new DoubleScalarDivideLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideLongColumn vectorExpression = - new DoubleScalarDivideLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideLongColumn vectorExpression = - new DoubleScalarDivideLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideLongColumn vectorExpression = - new DoubleScalarDivideLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloLongColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloLongColumn vectorExpression = - new DoubleScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloLongColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloLongColumn vectorExpression = - new DoubleScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloLongColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloLongColumn vectorExpression = - new DoubleScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloLongColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloLongColumn vectorExpression = - new DoubleScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloLongColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloLongColumn vectorExpression = - new DoubleScalarModuloLongColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddDoubleColumn vectorExpression = - new DoubleScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddDoubleColumn vectorExpression = - new DoubleScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddDoubleColumn vectorExpression = - new DoubleScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddDoubleColumn vectorExpression = - new DoubleScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarAddDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarAddDoubleColumn vectorExpression = - new DoubleScalarAddDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractDoubleColumn vectorExpression = - new DoubleScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractDoubleColumn vectorExpression = - new DoubleScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractDoubleColumn vectorExpression = - new DoubleScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractDoubleColumn vectorExpression = - new DoubleScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarSubtractDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarSubtractDoubleColumn vectorExpression = - new DoubleScalarSubtractDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyDoubleColumn vectorExpression = - new DoubleScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyDoubleColumn vectorExpression = - new DoubleScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyDoubleColumn vectorExpression = - new DoubleScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyDoubleColumn vectorExpression = - new DoubleScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarMultiplyDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarMultiplyDoubleColumn vectorExpression = - new DoubleScalarMultiplyDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideDoubleColumn vectorExpression = - new DoubleScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideDoubleColumn vectorExpression = - new DoubleScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideDoubleColumn vectorExpression = - new DoubleScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideDoubleColumn vectorExpression = - new DoubleScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarDivideDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarDivideDoubleColumn vectorExpression = - new DoubleScalarDivideDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloDoubleColumnOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloDoubleColumn vectorExpression = - new DoubleScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloDoubleColumn() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloDoubleColumn vectorExpression = - new DoubleScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloDoubleColumnOutNullsColNulls() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloDoubleColumn vectorExpression = - new DoubleScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloDoubleColumnOutNullsRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloDoubleColumn vectorExpression = - new DoubleScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleScalarModuloDoubleColumnOutNullsColRepeats() { - - Random rand = new Random(SEED); - - DoubleColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleScalarModuloDoubleColumn vectorExpression = - new DoubleScalarModuloDoubleColumn(scalarValue, 0, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColEqualDoubleScalar vectorExpression = - new LongColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColEqualDoubleScalar vectorExpression = - new LongColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColEqualDoubleScalar vectorExpression = - new LongColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColEqualDoubleScalar vectorExpression = - new LongColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColEqualDoubleScalar vectorExpression = - new LongColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColEqualDoubleScalar vectorExpression = - new DoubleColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColEqualDoubleScalar vectorExpression = - new DoubleColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColEqualDoubleScalar vectorExpression = - new DoubleColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColEqualDoubleScalar vectorExpression = - new DoubleColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColEqualDoubleScalar vectorExpression = - new DoubleColEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColNotEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColNotEqualDoubleScalar vectorExpression = - new LongColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColNotEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColNotEqualDoubleScalar vectorExpression = - new LongColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColNotEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColNotEqualDoubleScalar vectorExpression = - new LongColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColNotEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColNotEqualDoubleScalar vectorExpression = - new LongColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColNotEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColNotEqualDoubleScalar vectorExpression = - new LongColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColNotEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColNotEqualDoubleScalar vectorExpression = - new DoubleColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColNotEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColNotEqualDoubleScalar vectorExpression = - new DoubleColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColNotEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColNotEqualDoubleScalar vectorExpression = - new DoubleColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColNotEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColNotEqualDoubleScalar vectorExpression = - new DoubleColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColNotEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColNotEqualDoubleScalar vectorExpression = - new DoubleColNotEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessDoubleScalar vectorExpression = - new LongColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessDoubleScalar vectorExpression = - new LongColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessDoubleScalar vectorExpression = - new LongColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessDoubleScalar vectorExpression = - new LongColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessDoubleScalar vectorExpression = - new LongColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessDoubleScalar vectorExpression = - new DoubleColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessDoubleScalar vectorExpression = - new DoubleColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessDoubleScalar vectorExpression = - new DoubleColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessDoubleScalar vectorExpression = - new DoubleColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessDoubleScalar vectorExpression = - new DoubleColLessDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessEqualDoubleScalar vectorExpression = - new LongColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessEqualDoubleScalar vectorExpression = - new LongColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessEqualDoubleScalar vectorExpression = - new LongColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessEqualDoubleScalar vectorExpression = - new LongColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColLessEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColLessEqualDoubleScalar vectorExpression = - new LongColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessEqualDoubleScalar vectorExpression = - new DoubleColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessEqualDoubleScalar vectorExpression = - new DoubleColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessEqualDoubleScalar vectorExpression = - new DoubleColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessEqualDoubleScalar vectorExpression = - new DoubleColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColLessEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColLessEqualDoubleScalar vectorExpression = - new DoubleColLessEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterDoubleScalar vectorExpression = - new LongColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterDoubleScalar vectorExpression = - new LongColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterDoubleScalar vectorExpression = - new LongColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterDoubleScalar vectorExpression = - new LongColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterDoubleScalar vectorExpression = - new LongColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterDoubleScalar vectorExpression = - new DoubleColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterDoubleScalar vectorExpression = - new DoubleColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterDoubleScalar vectorExpression = - new DoubleColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterDoubleScalar vectorExpression = - new DoubleColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterDoubleScalar vectorExpression = - new DoubleColGreaterDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterEqualDoubleScalar vectorExpression = - new LongColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterEqualDoubleScalar vectorExpression = - new LongColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterEqualDoubleScalar vectorExpression = - new LongColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterEqualDoubleScalar vectorExpression = - new LongColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testLongColGreaterEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - LongColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - LongColGreaterEqualDoubleScalar vectorExpression = - new LongColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterEqualDoubleScalarOutRepeatsColNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterEqualDoubleScalar vectorExpression = - new DoubleColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterEqualDoubleScalar() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(false, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterEqualDoubleScalar vectorExpression = - new DoubleColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterEqualDoubleScalarOutNullsColNulls() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(true, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterEqualDoubleScalar vectorExpression = - new DoubleColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterEqualDoubleScalarOutNullsRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - true, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - false, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterEqualDoubleScalar vectorExpression = - new DoubleColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - @Test - public void testDoubleColGreaterEqualDoubleScalarOutNullsColRepeats() { - - Random rand = new Random(SEED); - - LongColumnVector outputColumnVector = - VectorizedRowGroupGenUtil.generateLongColumnVector(true, - false, BATCH_SIZE, rand); - - DoubleColumnVector inputColumnVector = - VectorizedRowGroupGenUtil.generateDoubleColumnVector(false, - true, BATCH_SIZE, rand); - - VectorizedRowBatch rowBatch = new VectorizedRowBatch(2, BATCH_SIZE); - rowBatch.cols[0] = inputColumnVector; - rowBatch.cols[1] = outputColumnVector; - - double scalarValue = 0; - do { - scalarValue = rand.nextDouble(); - } while(scalarValue == 0); - - DoubleColGreaterEqualDoubleScalar vectorExpression = - new DoubleColGreaterEqualDoubleScalar(0, scalarValue, 1); - - vectorExpression.evaluate(rowBatch); - - assertEquals( - "Output column vector is repeating state does not match operand column", - inputColumnVector.isRepeating, outputColumnVector.isRepeating); - - assertEquals( - "Output column vector no nulls state does not match operand column", - inputColumnVector.noNulls, outputColumnVector.noNulls); - - if(!outputColumnVector.noNulls && !outputColumnVector.isRepeating) { - for(int i = 0; i < BATCH_SIZE; i++) { - //null vectors are safe to check, as they are always initialized to match the data vector - assertEquals("Output vector doesn't match input vector's is null state for index", - inputColumnVector.isNull[i], outputColumnVector.isNull[i]); - } - } - } - - -} - -