1use thiserror::Error;
6
7pub type Result<T> = std::result::Result<T, Error>;
9
10#[derive(Error, Debug)]
12pub enum Error {
13 #[error("GPU initialization failed: {0}\nFalling back to SIMD backend")]
15 GpuInitFailed(String),
16
17 #[error(
19 "VRAM exhausted: {0}\nMorsel-based paging failed to prevent OOM. Please report this issue."
20 )]
21 VramExhausted(String),
22
23 #[error("Backend equivalence failed: GPU result != SIMD result\nGPU: {gpu_result}\nSIMD: {simd_result}")]
25 BackendMismatch {
26 gpu_result: String,
28 simd_result: String,
30 },
31
32 #[error("SQL parse error: {0}")]
34 ParseError(String),
35
36 #[error("Storage error: {0}")]
38 StorageError(String),
39
40 #[error("GPU transfer queue closed (receiver dropped)")]
42 QueueClosed,
43
44 #[error("Invalid input: {0}")]
46 InvalidInput(String),
47
48 #[error("IO error: {0}")]
50 Io(#[from] std::io::Error),
51
52 #[error("Arrow error: {0}")]
54 Arrow(#[from] arrow::error::ArrowError),
55
56 #[error("{0}")]
58 Other(String),
59}
60
61impl From<batuta_common::compression::CompressionError> for Error {
62 fn from(e: batuta_common::compression::CompressionError) -> Self {
63 Self::StorageError(e.to_string())
64 }
65}