Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 79B46DA37 for ; Wed, 22 May 2013 21:05:03 +0000 (UTC) Received: (qmail 66998 invoked by uid 500); 22 May 2013 21:05:00 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 66932 invoked by uid 500); 22 May 2013 21:05:00 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 66859 invoked by uid 99); 22 May 2013 21:05:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 21:05:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 May 2013 21:04:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 863222388900; Wed, 22 May 2013 21:04:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1485421 [2/6] - in /hive/branches/vectorization/ql/src: java/org/apache/hadoop/hive/ql/exec/vector/expressions/templates/ test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/ test/org/apache/hadoop/hive/ql/exec/vector/util/ Date: Wed, 22 May 2013 21:04:35 -0000 To: commits@hive.apache.org From: omalley@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130522210436.863222388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: hive/branches/vectorization/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java URL: http://svn.apache.org/viewvc/hive/branches/vectorization/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java?rev=1485421&view=auto ============================================================================== --- hive/branches/vectorization/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java (added) +++ hive/branches/vectorization/ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/TestColumnColumnFilterVectorExpressionEvaluation.java Wed May 22 21:04:35 2013 @@ -0,0 +1,6524 @@ +/** + * 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() { + [... 4106 lines stripped ...]