Skip to content

Commit

Permalink
[WIP] Clean up and expand log path parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-johnson-databricks committed Sep 19, 2024
1 parent 1a66fb9 commit 98c297c
Show file tree
Hide file tree
Showing 6 changed files with 510 additions and 234 deletions.
2 changes: 1 addition & 1 deletion acceptance/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{TestCaseInfo, TestResult};
pub async fn read_golden(path: &Path, _version: Option<&str>) -> DeltaResult<RecordBatch> {
let expected_root = path.join("expected").join("latest").join("table_content");
let store = Arc::new(LocalFileSystem::new_with_prefix(&expected_root)?);
let files = store.list(None).try_collect::<Vec<_>>().await?;
let files: Vec<_> = store.list(None).try_collect().await?;
let mut batches = vec![];
let mut schema = None;
for meta in files.into_iter() {
Expand Down
2 changes: 2 additions & 0 deletions ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ pub enum KernelError {
InvalidStructDataError,
InternalError,
InvalidExpression,
InvalidLogPath,
}

impl From<Error> for KernelError {
Expand Down Expand Up @@ -374,6 +375,7 @@ impl From<Error> for KernelError {
backtrace: _,
} => Self::from(*source),
Error::InvalidExpressionEvaluation(_) => KernelError::InvalidExpression,
Error::InvalidLogPath(_) => KernelError::InvalidUrlError,
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions kernel/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
str::Utf8Error,
};

use crate::path::CanTryIntoLogPath;
use crate::schema::DataType;

/// A [`std::result::Result`] that has the kernel [`Error`] as the error variant
Expand Down Expand Up @@ -155,6 +156,10 @@ pub enum Error {
/// Expressions did not parse or evaluate correctly
#[error("Invalid expression evaluation: {0}")]
InvalidExpressionEvaluation(String),

/// Unable to parse the name of a log path
#[error("Invalid log path: {0}")]
InvalidLogPath(String),
}

// Convenience constructors for Error types that take a String argument
Expand Down Expand Up @@ -203,6 +208,9 @@ impl Error {
pub fn invalid_expression(msg: impl ToString) -> Self {
Self::InvalidExpressionEvaluation(msg.to_string())
}
pub(crate) fn invalid_log_path(msg: &impl CanTryIntoLogPath) -> Self {
Self::InvalidLogPath(msg.as_url().to_string())
}

pub fn internal_error(msg: impl ToString) -> Self {
Self::InternalError(msg.to_string()).with_backtrace()
Expand Down
5 changes: 5 additions & 0 deletions kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ pub mod engine_data;
pub mod error;
pub mod expressions;
pub mod features;

#[cfg(feature = "developer-visibility")]
pub mod path;
#[cfg(not(feature = "developer-visibility"))]
pub(crate) mod path;

pub mod scan;
pub mod schema;
pub mod snapshot;
Expand Down
Loading

0 comments on commit 98c297c

Please sign in to comment.