Make the Transform read from an EnrichedDocumentsBatchReader

This commit is contained in:
Kerollmops 2022-06-20 13:48:02 +02:00
parent ea852200bb
commit 6a0a0ae94f
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
7 changed files with 158 additions and 24 deletions

View file

@ -7,7 +7,7 @@ use rayon::ThreadPoolBuildError;
use serde_json::Value;
use thiserror::Error;
use crate::documents::DocumentsBatchCursorError;
use crate::documents::{self, DocumentsBatchCursorError};
use crate::{CriterionError, DocumentId, FieldId, Object, SortError};
pub fn is_reserved_keyword(keyword: &str) -> bool {
@ -36,6 +36,8 @@ pub enum InternalError {
FieldIdMappingMissingEntry { key: FieldId },
#[error(transparent)]
Fst(#[from] fst::Error),
#[error(transparent)]
DocumentsError(#[from] documents::Error),
#[error("Invalid compression type have been specified to grenad.")]
GrenadInvalidCompressionType,
#[error("Invalid grenad file with an invalid version format.")]
@ -185,6 +187,7 @@ macro_rules! error_from_sub_error {
error_from_sub_error! {
FieldIdMapMissingEntry => InternalError,
fst::Error => InternalError,
documents::Error => InternalError,
str::Utf8Error => InternalError,
ThreadPoolBuildError => InternalError,
SerializationError => InternalError,
@ -212,7 +215,10 @@ where
impl From<DocumentsBatchCursorError> for Error {
fn from(error: DocumentsBatchCursorError) -> Error {
Error::from(Into::<grenad::Error>::into(error))
match error {
DocumentsBatchCursorError::Grenad(e) => Error::from(e),
DocumentsBatchCursorError::Utf8(e) => Error::from(e),
}
}
}