deniskuzZ commented on code in PR #3986: URL: https://github.com/apache/hive/pull/3986#discussion_r1088295015
########## ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorOperationProcess.java: ########## @@ -0,0 +1,126 @@ +/* + * 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; + +import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.ql.CompilationOpContext; +import org.apache.hadoop.hive.ql.exec.Operator; +import org.apache.hadoop.hive.ql.exec.OperatorFactory; +import org.apache.hadoop.hive.ql.exec.vector.expressions.FilterExprAndExpr; +import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; +import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterLongColEqualDoubleScalar; +import org.apache.hadoop.hive.ql.exec.vector.expressions.gen.FilterLongColGreaterLongColumn; +import org.apache.hadoop.hive.ql.exec.vector.util.FakeDataReader; +import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.optimizer.physical.Vectorizer; +import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc; +import org.apache.hadoop.hive.ql.plan.FilterDesc; +import org.apache.hadoop.hive.ql.plan.OperatorDesc; +import org.apache.hadoop.hive.ql.plan.TopNKeyDesc; +import org.apache.hadoop.hive.ql.plan.VectorFilterDesc; +import org.apache.hadoop.hive.ql.plan.VectorTopNKeyDesc; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +/** + * Tests that are necessary until VectorizedRowBatch selected issue is being fixed: + * It has three fields to manage selected elements: + * - selected (array) + * - selectedInUse + * - size (selected size) + * <p> + * The tricky thing is those fields are all public: so it is possible to modify some of them without keeping the others + * in sync. + * The issue that is fixed and checked with these tests is when somebody modifies the selected array but forgets to + * set the size parameter: Because of that, the Operators can try to process with wrong size value and it can cause + * ArrayIndexOutOfBoundsException. + * </p> + * <p> + * Related ticket: HIVE-26992 + * Those tests can be removed when those fields are public they can be modified with public methods that ensures to + * use them properly. + * </p> + * Ticket to fix the issue: HIVE-26993 + */ +public class TestVectorOperationProcess { + + HiveConf hiveConf = new HiveConf(); + + @Test + public void testVectorFilterHasSelectedSmallerThanBatch() throws HiveException { Review Comment: why not do this in TestVectorFilterOperator? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
