ViggoC commented on code in PR #43888:
URL: https://github.com/apache/arrow/pull/43888#discussion_r1757126169
##########
java/vector/src/main/java/org/apache/arrow/vector/validate/ValidateVectorBufferVisitor.java:
##########
@@ -287,4 +289,37 @@ public Void visit(ExtensionTypeVector<?> vector, Void
value) {
vector.getUnderlyingVector().accept(this, value);
return null;
}
+
+ @Override
+ public Void visit(RunEndEncodedVector vector, Void value) {
+ validateVectorCommon(vector);
+ int valueCount = vector.getValueCount();
+ FieldVector runEndsVector = vector.getRunEndsVector();
+
+ if (runEndsVector != null) {
Review Comment:
According to comment here, O(1) time is committed. However the worst time of
monotonicity check is O(n). Is it acceptable?
https://github.com/apache/arrow/blob/2f99cf85835c05e0d3d23d06592e6d2f6322aede/java/vector/src/main/java/org/apache/arrow/vector/util/ValueVectorUtility.java#L99-L108
##########
java/vector/src/main/java/org/apache/arrow/vector/compare/RangeEqualsVisitor.java:
##########
@@ -255,6 +266,46 @@ public Boolean visit(LargeListViewVector left, Range
range) {
return compareLargeListViewVectors(range);
}
+ protected boolean compareRunEndEncodedVectors(Range range) {
+ RunEndEncodedVector leftVector = (RunEndEncodedVector) left;
+ RunEndEncodedVector rightVector = (RunEndEncodedVector) right;
+
+ final int leftRangeEnd = range.getLeftStart() + range.getLength();
+ final int rightRangeEnd = range.getRightStart() + range.getLength();
+
+ FieldVector leftValuesVector = leftVector.getValuesVector();
+ FieldVector rightValuesVector = rightVector.getValuesVector();
+
+ RangeEqualsVisitor innerVisitor = createInnerVisitor(leftValuesVector,
rightValuesVector, null);
+
+ int leftLogicalIndex = range.getLeftStart();
+ int rightLogicalIndex = range.getRightStart();
+
+ while (leftLogicalIndex < leftRangeEnd) {
+ int leftPhysicalIndex = leftVector.getPhysicalIndex(leftLogicalIndex);
Review Comment:
Thank you for your suggestion, I'll try to do it.
##########
java/vector/src/test/java/org/apache/arrow/vector/TestRunEndEncodedVector.java:
##########
@@ -0,0 +1,231 @@
+/*
+ * 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.arrow.vector;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+import java.util.function.Function;
+import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.vector.compare.Range;
+import org.apache.arrow.vector.compare.RangeEqualsVisitor;
+import org.apache.arrow.vector.complex.RunEndEncodedVector;
+import org.apache.arrow.vector.types.Types;
+import org.apache.arrow.vector.types.pojo.ArrowType.RunEndEncoded;
+import org.apache.arrow.vector.types.pojo.Field;
+import org.apache.arrow.vector.types.pojo.FieldType;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public class TestRunEndEncodedVector {
+
+ private BufferAllocator allocator;
+
+ @BeforeEach
+ public void init() {
+ allocator = new DirtyRootAllocator(Long.MAX_VALUE, (byte) 100);
Review Comment:
I have no idea which allocator is better, I just copy it from
TestListVector. So you prefer to just use a RootAllocator?
--
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]