Datum.Accessor
and a collection of related
static methods.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
DatumUtils.Accessor<B,
L extends Datum.Layout> Abstract superclass of datum accessors. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
addressOf
(ByteBuffer bb) (package private) static Datum.Input
asAlwaysCopiedDatum
(ByteBuffer bb, int offset, int length) static ByteBuffer
static long
fetchPointer
(ByteBuffer bb, int offset) (package private) static BitSet
fromBitmapset
(long nativeAddress) (package private) static BitSet
static TupleTableSlot.Indexed
indexedTupleSlot
(RegType type, int elements, ByteBuffer nulls, ByteBuffer values) static int
inspectVarlena
(ByteBuffer bb, int offset) For now, just return the inline size (the size to be skipped if stepping over this varlena in a heap tuple).(package private) static ByteBuffer
mapCString
(long nativeAddress) static ByteBuffer
mapCString
(ByteBuffer bb, int offset) (package private) static ByteBuffer
mapFixedLength
(long nativeAddress, int length) static ByteBuffer
mapFixedLength
(ByteBuffer bb, int offset, int length) (package private) static Datum.Input
mapVarlena
(long nativeAddress, ResourceOwner resowner, MemoryContext memcontext) (package private) static Datum.Input
mapVarlena
(ByteBuffer bb, long offset, ResourceOwner resowner, MemoryContext memcontext) static void
storePointer
(ByteBuffer bb, int offset, long value) (package private) static ByteBuffer
Turns aBitSet
into a direct-allocatedByteBuffer
whose address can be passed in C code to PostgreSQL'sbms_copy
and used as abitmapset
.
-
Field Details
-
BIG_ENDIAN
static final boolean BIG_ENDIAN
-
-
Constructor Details
-
DatumUtils
public DatumUtils()
-
-
Method Details
-
indexedTupleSlot
public static TupleTableSlot.Indexed indexedTupleSlot(RegType type, int elements, ByteBuffer nulls, ByteBuffer values) -
addressOf
-
fetchPointer
-
storePointer
-
asReadOnlyNativeOrder
-
mapFixedLength
-
mapFixedLength
-
mapCString
-
mapCString
-
mapVarlena
-
mapVarlena
static Datum.Input mapVarlena(ByteBuffer bb, long offset, ResourceOwner resowner, MemoryContext memcontext) -
inspectVarlena
For now, just return the inline size (the size to be skipped if stepping over this varlena in a heap tuple).This is a reimplementation of some of the top of
postgres.h
, so that this common operation can be done without a JNI call to the C code. -
asAlwaysCopiedDatum
-
toBitmapset
Turns aBitSet
into a direct-allocatedByteBuffer
whose address can be passed in C code to PostgreSQL'sbms_copy
and used as abitmapset
.While the
ByteBuffer
is direct-allocated, it is allocated by Java, not bypalloc
, and the PostgreSQL code must not be allowed to try to grow, shrink, orpfree
it. Hence thebms_copy
.If the result of operations in C will be wanted in Java, the fuss of allocating a different direct
ByteBuffer
for the result can be avoided by carefully letting the C code update thisbitmapset
in place, so that no resizing or freeing can occur. That can be done by OR-ing one extra bit into the JavaBitSet
in advance, at an index higher than the bits of interest, and having the C code manipulate only the lower-indexed bits (such as by using abms_prev_member
loop unrolled with one first call unused).While the
ByteBuffer
returned is read-only (as far as Java is concerned), if it is updated in place by C code, it can be passed afterward tofromBitmapset
to recover the result. -
fromBitmapset
-
fromBitmapset
-