File tree Expand file tree Collapse file tree
main/java/io/github/dfa1/vortex/core/array
test/java/io/github/dfa1/vortex
main/java/io/github/dfa1/vortex/scan
test/java/io/github/dfa1/vortex/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ private ArraySegments() {
2121 public static MemorySegment of (Array arr ) {
2222 Array data = arr instanceof MaskedArray m ? m .inner () : arr ;
2323 return switch (data ) {
24- case IntArray a -> a .segment () ;
25- case LongArray a -> a .segment () ;
26- case DoubleArray a -> a .segment () ;
27- case FloatArray a -> a .segment () ;
28- case ShortArray a -> a .segment () ;
29- case ByteArray a -> a .segment () ;
30- case BoolArray a -> a .segment () ;
31- case Float16Array a -> a .segment () ;
32- case VarBinArray a -> a .segment () ;
33- case GenericArray a -> a .segment () ;
24+ case IntArray a -> a .buffer ;
25+ case LongArray a -> a .buffer ;
26+ case DoubleArray a -> a .buffer ;
27+ case FloatArray a -> a .buffer ;
28+ case ShortArray a -> a .buffer ;
29+ case ByteArray a -> a .buffer ;
30+ case BoolArray a -> a .buffer ;
31+ case Float16Array a -> a .buffer ;
32+ case VarBinArray a -> a .bytes ;
33+ case GenericArray a -> a .buffers [ 0 ] ;
3434 default -> throw new VortexException (data .getClass ().getSimpleName () + " has no primary segment" );
3535 };
3636 }
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public final class BoolArray implements Array {
1010
1111 private final DType dtype ;
1212 private final long length ;
13- private final MemorySegment buffer ;
13+ final MemorySegment buffer ;
1414
1515 /// Constructs a {@code BoolArray} backed by the given bit-packed buffer.
1616 ///
@@ -33,12 +33,6 @@ public long length() {
3333 return length ;
3434 }
3535
36- /// Returns the raw bit-packed backing segment (LSB-first, one byte per 8 elements).
37- ///
38- /// @return the backing {@link MemorySegment}
39- public MemorySegment segment () {
40- return buffer ;
41- }
4236
4337 /// Returns the boolean value at the given logical index.
4438 ///
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public final class ByteArray implements Array {
1212
1313 private final DType dtype ;
1414 private final long length ;
15- private final MemorySegment buffer ;
15+ final MemorySegment buffer ;
1616
1717 /// Constructs a {@code ByteArray} backed by the given buffer.
1818 ///
@@ -35,12 +35,6 @@ public long length() {
3535 return length ;
3636 }
3737
38- /// Returns the raw backing segment (one byte per element).
39- ///
40- /// @return the backing {@link MemorySegment}
41- public MemorySegment segment () {
42- return buffer ;
43- }
4438
4539 /// Returns the raw byte value at the given logical index.
4640 ///
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public final class DoubleArray implements Array {
1212
1313 private final DType dtype ;
1414 private final long length ;
15- private final MemorySegment buffer ;
15+ final MemorySegment buffer ;
1616
1717 /// Constructs a {@code DoubleArray} backed by the given buffer.
1818 ///
@@ -35,12 +35,6 @@ public long length() {
3535 return length ;
3636 }
3737
38- /// Returns the raw backing segment (little-endian, 8 bytes per element).
39- ///
40- /// @return the backing {@link MemorySegment}
41- public MemorySegment segment () {
42- return buffer ;
43- }
4438
4539 /// Returns the double value at the given logical index.
4640 ///
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public final class Float16Array implements Array {
1212
1313 private final DType dtype ;
1414 private final long length ;
15- private final MemorySegment buffer ;
15+ final MemorySegment buffer ;
1616
1717 /// Creates a new {@code Float16Array} backed by the given memory segment.
1818 ///
@@ -35,12 +35,6 @@ public long length() {
3535 return length ;
3636 }
3737
38- /// Returns the raw backing segment (little-endian, 2 bytes per element).
39- ///
40- /// @return the backing {@link MemorySegment}
41- public MemorySegment segment () {
42- return buffer ;
43- }
4438
4539 /// Returns the element at the given index widened to a single-precision float.
4640 ///
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public final class FloatArray implements Array {
1111
1212 private final DType dtype ;
1313 private final long length ;
14- private final MemorySegment buffer ;
14+ final MemorySegment buffer ;
1515
1616 /// Creates a new {@code FloatArray} backed by the given memory segment.
1717 ///
@@ -34,12 +34,6 @@ public long length() {
3434 return length ;
3535 }
3636
37- /// Returns the raw backing segment (little-endian, 4 bytes per element).
38- ///
39- /// @return the backing {@link MemorySegment}
40- public MemorySegment segment () {
41- return buffer ;
42- }
4337
4438 /// Returns the float value at the given index.
4539 ///
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public final class GenericArray implements Array {
1313
1414 private final DType dtype ;
1515 private final long length ;
16- private final MemorySegment [] buffers ;
16+ final MemorySegment [] buffers ;
1717 private final Array [] children ;
1818
1919 /// Creates a new {@code GenericArray} with the given buffers and children.
@@ -48,10 +48,6 @@ public long length() {
4848 return length ;
4949 }
5050
51- public MemorySegment segment () {
52- return buffers [0 ];
53- }
54-
5551 /// Returns the raw buffer at position {@code i}.
5652 ///
5753 /// @param i buffer index
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public final class IntArray implements Array {
1212
1313 private final DType dtype ;
1414 private final long length ;
15- private final MemorySegment buffer ;
15+ final MemorySegment buffer ;
1616
1717 /// Creates a new {@code IntArray} backed by the given memory segment.
1818 ///
@@ -35,12 +35,6 @@ public long length() {
3535 return length ;
3636 }
3737
38- /// Returns the raw backing segment (little-endian, 4 bytes per element).
39- ///
40- /// @return the backing {@link MemorySegment}
41- public MemorySegment segment () {
42- return buffer ;
43- }
4438
4539 /// Returns the int value at the given index.
4640 ///
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public final class LongArray implements Array {
1212
1313 private final DType dtype ;
1414 private final long length ;
15- private final MemorySegment buffer ;
15+ final MemorySegment buffer ;
1616
1717 /// Creates a new {@code LongArray} backed by the given memory segment.
1818 ///
@@ -35,12 +35,6 @@ public long length() {
3535 return length ;
3636 }
3737
38- /// Returns the raw backing segment (little-endian, 8 bytes per element).
39- ///
40- /// @return the backing {@link MemorySegment}
41- public MemorySegment segment () {
42- return buffer ;
43- }
4438
4539 /// Returns the long value at the given index.
4640 ///
Original file line number Diff line number Diff line change 22
33import io .github .dfa1 .vortex .core .DType ;
44
5- import java .lang .foreign .MemorySegment ;
6-
75/// Decoded {@code vortex.masked} array: a non-nullable child paired with an optional validity bitmap.
86///
97/// <p>Invariant: {@code child} has no actual nulls — nullability is expressed solely via
@@ -42,13 +40,6 @@ public Array inner() {
4240 return child ;
4341 }
4442
45- /// Delegates to {@link #inner()}'s segment; validity is not surfaced here.
46- ///
47- /// @return the primary segment of the inner array
48- public MemorySegment segment () {
49- return ArraySegments .of (child );
50- }
51-
5243 /// Returns the validity bitmap, or {@code null} if all positions are valid.
5344 ///
5445 /// @return the validity bitmap, or {@code null} when all values are valid
You can’t perform that action at this time.
0 commit comments