datafusion-server 0.21.0

Web server library for session-based queries using Arrow and other large datasets as data sources.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// data_source/location/file.rs

use crate::data_source::location::uri;
use crate::response::http_error::ResponseError;
use crate::settings::Settings;

pub fn create_data_file_path(file: &str) -> Result<String, ResponseError> {
    let mut file_path = std::path::PathBuf::from(&Settings::global().server.data_dir);
    file_path.push(uri::to_file_path_and_name(file)?);
    match file_path.to_str() {
        Some(v) => Ok(v.to_owned()),
        None => Err(ResponseError::unsupported_format(format!(
            "Can not decode file path string {file:?}"
        ))),
    }
}