Skip to content

Commit

Permalink
RunEndEncoded initial implement
Browse files Browse the repository at this point in the history
  • Loading branch information
ViggoC committed Aug 29, 2024
1 parent 0bae073 commit 8cab62d
Show file tree
Hide file tree
Showing 17 changed files with 891 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public ColumnBinder visit(ArrowType.Union type) {
throw new UnsupportedOperationException("No column binder implemented for type " + type);
}

@Override
public ColumnBinder visit(ArrowType.RunEndEncoded type) {
throw new UnsupportedOperationException("No column binder implemented for type " + type);
}

@Override
public ColumnBinder visit(ArrowType.Map type) {
return new MapBinder((MapVector) vector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ public List<ArrowBuf> visit(ArrowType.Union type) {
}
}


@Override
public List<ArrowBuf> visit(ArrowType.RunEndEncoded type) {
throw new UnsupportedOperationException("Importing buffers for type: " + type);
}

@Override
public List<ArrowBuf> visit(ArrowType.Map type) {
return Arrays.asList(maybeImportBitmap(type), importOffsets(type, MapVector.OFFSET_WIDTH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,11 @@ public Boolean visit(ArrowType.Duration type) {
public Boolean visit(ArrowType.ListView type) {
throw new UnsupportedOperationException("Binding is not yet supported for type " + type);
}

@Override
public Boolean visit(ArrowType.RunEndEncoded type) {
throw new UnsupportedOperationException(
"No Avatica parameter binder implemented for type " + type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,11 @@ public AvaticaParameter visit(ArrowType.ListView type) {
throw new UnsupportedOperationException(
"AvaticaParameter not yet supported for type " + type);
}

@Override
public AvaticaParameter visit(ArrowType.RunEndEncoded type) {
throw new UnsupportedOperationException(
"No Avatica parameter binder implemented for type " + type);
}
}
}
5 changes: 5 additions & 0 deletions java/vector/src/main/codegen/data/ArrowTypes.tdd
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
name: "ListView",
fields: [],
complex: true
},
{
name: "RunEndEncoded",
fields: [],
complex: true
}
]
}
11 changes: 11 additions & 0 deletions java/vector/src/main/java/org/apache/arrow/vector/TypeLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.arrow.vector.types.pojo.ArrowType.LargeUtf8;
import org.apache.arrow.vector.types.pojo.ArrowType.Map;
import org.apache.arrow.vector.types.pojo.ArrowType.Null;
import org.apache.arrow.vector.types.pojo.ArrowType.RunEndEncoded;
import org.apache.arrow.vector.types.pojo.ArrowType.Struct;
import org.apache.arrow.vector.types.pojo.ArrowType.Time;
import org.apache.arrow.vector.types.pojo.ArrowType.Timestamp;
Expand Down Expand Up @@ -270,6 +271,11 @@ public TypeLayout visit(Interval type) {
public TypeLayout visit(Duration type) {
return newFixedWidthTypeLayout(BufferLayout.dataBuffer(64));
}

@Override
public TypeLayout visit(RunEndEncoded type) {
return new TypeLayout(Collections.<BufferLayout>emptyList());
}
});
return layout;
}
Expand Down Expand Up @@ -428,6 +434,11 @@ public Integer visit(Interval type) {
public Integer visit(Duration type) {
return FIXED_WIDTH_BUFFER_COUNT;
}

@Override
public Integer visit(RunEndEncoded type) {
return 0;
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.arrow.vector.complex.LargeListVector;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.NonNullableStructVector;
import org.apache.arrow.vector.complex.RunEndEncodedVector;
import org.apache.arrow.vector.complex.UnionVector;

/** Visitor to compare a range of values for vectors. */
Expand Down Expand Up @@ -241,6 +242,14 @@ protected RangeEqualsVisitor createInnerVisitor(
return new RangeEqualsVisitor(leftInner, rightInner, typeComparator);
}

@Override
public Boolean visit(RunEndEncodedVector left, Range range) {
if (!validate(left)) {
return false;
}
return true; // TODO
}

protected boolean compareUnionVectors(Range range) {
UnionVector leftVector = (UnionVector) left;
UnionVector rightVector = (UnionVector) right;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.arrow.vector.complex.LargeListVector;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.NonNullableStructVector;
import org.apache.arrow.vector.complex.RunEndEncodedVector;
import org.apache.arrow.vector.complex.UnionVector;
import org.apache.arrow.vector.types.pojo.Field;

Expand Down Expand Up @@ -124,6 +125,11 @@ public Boolean visit(ExtensionTypeVector<?> left, Void value) {
return compareField(left.getField(), right.getField());
}

@Override
public Boolean visit(RunEndEncodedVector left, Void value) {
return compareField(left.getField(), right.getField());
}

private boolean compareField(Field leftField, Field rightField) {

if (leftField == rightField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.arrow.vector.complex.LargeListVector;
import org.apache.arrow.vector.complex.ListVector;
import org.apache.arrow.vector.complex.NonNullableStructVector;
import org.apache.arrow.vector.complex.RunEndEncodedVector;
import org.apache.arrow.vector.complex.UnionVector;

/**
Expand Down Expand Up @@ -60,4 +61,6 @@ public interface VectorVisitor<OUT, IN> {
OUT visit(NullVector left, IN value);

OUT visit(ExtensionTypeVector<?> left, IN value);

OUT visit(RunEndEncodedVector left, IN value);
}
Loading

0 comments on commit 8cab62d

Please sign in to comment.