pub struct SpillContext { /* private fields */ }Expand description
쿼리 단위 Spill 컨텍스트.
HashAggregateOperator 등 메모리 집약 연산자에 주입되어,
메모리 사용량이 budget_bytes를 초과하면 RecordBatch를 임시 디스크로 내보냅니다.
Implementations§
Source§impl SpillContext
impl SpillContext
Sourcepub fn with_budget(budget_bytes: usize) -> DbxResult<Self>
pub fn with_budget(budget_bytes: usize) -> DbxResult<Self>
지정된 메모리 예산(바이트)으로 SpillContext 생성.
Sourcepub fn track(&mut self, bytes: usize)
pub fn track(&mut self, bytes: usize)
바이트 단위 메모리 사용량을 등록합니다.
RecordBatch의 크기는 estimate_batch_bytes로 추정합니다.
Sourcepub fn should_spill(&self) -> bool
pub fn should_spill(&self) -> bool
현재 메모리 사용량이 예산을 초과했는지 확인합니다.
Sourcepub fn reset_tracking(&mut self)
pub fn reset_tracking(&mut self)
메모리 사용량 추적을 초기화합니다 (Spill 후 재시작).
Sourcepub fn spill_batches(&mut self, batches: &[RecordBatch]) -> DbxResult<PathBuf>
pub fn spill_batches(&mut self, batches: &[RecordBatch]) -> DbxResult<PathBuf>
Sourcepub fn spill_partition_batch(
&mut self,
side: &str,
part_idx: usize,
batch: RecordBatch,
) -> DbxResult<PathBuf>
pub fn spill_partition_batch( &mut self, side: &str, part_idx: usize, batch: RecordBatch, ) -> DbxResult<PathBuf>
특정 파티션에 속한 RecordBatch를 Spill 합니다 (Grace Hash Join 용).
파일명 규칙: {side}_{part_idx}_{count}.ipc
Sourcepub fn reload_batches(path: &PathBuf) -> DbxResult<Vec<RecordBatch>>
pub fn reload_batches(path: &PathBuf) -> DbxResult<Vec<RecordBatch>>
Spill 파일에서 RecordBatch 목록을 읽어옵니다.
읽기 완료 후 파일은 삭제되지 않습니다 (TempDir drop 시 일괄 삭제).
Sourcepub fn estimate_batch_bytes(batch: &RecordBatch) -> usize
pub fn estimate_batch_bytes(batch: &RecordBatch) -> usize
RecordBatch의 메모리 사용량을 추정합니다 (컬럼 버퍼 합산).
Auto Trait Implementations§
impl Freeze for SpillContext
impl RefUnwindSafe for SpillContext
impl Send for SpillContext
impl Sync for SpillContext
impl Unpin for SpillContext
impl UnsafeUnpin for SpillContext
impl UnwindSafe for SpillContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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