pub struct ObjectIdEncoding { /* private fields */ }
Expand description
The ObjectIdEncoding represents each distinct term in the database with a single unique id. We call such an id object id. Here is an example of the encoding:
?variable
┌─────┐
│ 1 │ ────► <#MyEntity>
├─────┤
│ 2 │ ────► 120^^xsd:integer
├─────┤
│ ... │
└─────┘
§Object ID Mapping
The mapping implementation depends on the storage layer that is being used. For example, an in-memory RDF store will use a different implementation as an on-disk RDF store. The ObjectIdMapping trait defines the contract.
§Strengths and Weaknesses
The object id encoding is very well suited for evaluating joins, as instead of joining variable-length RDF terms, we can directly join the object ids. While we do not have recent numbers for the performance gains, the original pull request quadrupled the performance of some queries (with relatively small datasets!).
However, this also introduces the necessity of decoding the object ids back to RDF terms. For example, by converting it to the PlainTermEncoding. For queries that spend little time on join operations, the cost of decoding the object ids can outweigh the benefits of using the object id encoding.
Furthermore, the encoding introduces the necessity of maintaining the ObjectIdMapping, which can be non-trivial.
§Current Limitation
Currently, this id is fixed to being a 32-bit integer. However, we have an issue that tracks the progress on limiting this limitation.
Implementations§
Source§impl ObjectIdEncoding
impl ObjectIdEncoding
Sourcepub fn new(object_id_size: u8) -> Self
pub fn new(object_id_size: u8) -> Self
Creates a new ObjectIdEncoding.
Sourcepub fn object_id_size(&self) -> u8
pub fn object_id_size(&self) -> u8
Returns the size of the object id.
Trait Implementations§
Source§impl Clone for ObjectIdEncoding
impl Clone for ObjectIdEncoding
Source§fn clone(&self) -> ObjectIdEncoding
fn clone(&self) -> ObjectIdEncoding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ObjectIdEncoding
impl Debug for ObjectIdEncoding
Source§impl Hash for ObjectIdEncoding
impl Hash for ObjectIdEncoding
Source§impl PartialEq for ObjectIdEncoding
impl PartialEq for ObjectIdEncoding
Source§impl TermDecoder<ObjectIdEncoding> for DefaultObjectIdDecoder
impl TermDecoder<ObjectIdEncoding> for DefaultObjectIdDecoder
Source§fn decode_terms(
array: &<ObjectIdEncoding as TermEncoding>::Array,
) -> impl Iterator<Item = ThinResult<Self::Term<'_>>>
fn decode_terms( array: &<ObjectIdEncoding as TermEncoding>::Array, ) -> impl Iterator<Item = ThinResult<Self::Term<'_>>>
array
that are compatible with this
decoder (see TermDecoder for more information). Read moreSource§fn decode_term(
scalar: &<ObjectIdEncoding as TermEncoding>::Scalar,
) -> ThinResult<Self::Term<'_>>
fn decode_term( scalar: &<ObjectIdEncoding as TermEncoding>::Scalar, ) -> ThinResult<Self::Term<'_>>
array
that are compatible with this
decoder (see TermDecoder for more information). Read moreSource§impl TermEncoding for ObjectIdEncoding
impl TermEncoding for ObjectIdEncoding
Source§type Array = ObjectIdArray
type Array = ObjectIdArray
Source§type Scalar = ObjectIdScalar
type Scalar = ObjectIdScalar
Source§fn name(&self) -> EncodingName
fn name(&self) -> EncodingName
Source§fn try_new_array(&self, array: ArrayRef) -> DFResult<Self::Array>
fn try_new_array(&self, array: ArrayRef) -> DFResult<Self::Array>
array
contains a value with the correct encoding (i.e., type and possibly
metadata checks). If yes, returns an instance of Self::Array. Otherwise, an error is
returned.Source§fn try_new_scalar(&self, scalar: ScalarValue) -> DFResult<Self::Scalar>
fn try_new_scalar(&self, scalar: ScalarValue) -> DFResult<Self::Scalar>
scalar
contains a value with the correct encoding (i.e., type and possibly
metadata checks). If yes, returns an instance of Self::Scalar. Otherwise, an error is
returned.Source§fn try_new_datum(
&self,
value: ColumnarValue,
number_rows: usize,
) -> DFResult<EncodingDatum<Self>>
fn try_new_datum( &self, value: ColumnarValue, number_rows: usize, ) -> DFResult<EncodingDatum<Self>>
value
contains a value with the correct encoding (i.e., type and possibly
metadata checks). If yes, returns a datum that either wraps an array or a scalar. Otherwise,
an error is returned.impl Eq for ObjectIdEncoding
impl StructuralPartialEq for ObjectIdEncoding
Auto Trait Implementations§
impl Freeze for ObjectIdEncoding
impl RefUnwindSafe for ObjectIdEncoding
impl Send for ObjectIdEncoding
impl Sync for ObjectIdEncoding
impl Unpin for ObjectIdEncoding
impl UnwindSafe for ObjectIdEncoding
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more